You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Mukul Gandhi (JIRA)" <xe...@xml.apache.org> on 2011/05/24 18:13:47 UTC

[jira] [Commented] (XERCESJ-1510) XML Schema Validation ignores parent any declaration

    [ https://issues.apache.org/jira/browse/XERCESJ-1510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038644#comment-13038644 ] 

Mukul Gandhi commented on XERCESJ-1510:
---------------------------------------

I had a quick look at the WSDL file and the schema you've cited.

The XML document (your WSDL file) doesn't seem to conform to the WSDL schema you're using (at URL, http://schemas.xmlsoap.org/wsdl/).

I don't see how the following element in your WSDL document,

<plnk:partnerLinkType name="HelloPartnerLinkType">
     <plnk:role name="me" portType="tns:HelloPortType"/>
     <plnk:role name="you" portType="tns:HelloPortType"/>
</plnk:partnerLinkType>

can appear as the list child element of wsdl:definitions.

There doesn't seem to be any wild-card in the schema that you've cited, which allows this.

Conclusion: this doesn't appear to be the the bug you're suspecting. perhaps you need to look for a different version of WSDL schema, which allows for the extension element you want to have at the desired position.

> XML Schema Validation ignores parent any declaration
> ----------------------------------------------------
>
>                 Key: XERCESJ-1510
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1510
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: JAXP (javax.xml.validation)
>    Affects Versions: 2.11.0
>            Reporter: Aaron Anderson
>
> I am attempting to validate a WSDL document that contains an extension. According to the WSDL schema the definitions type parent allows the any wildcard definition. However, during validation, the extention element is reported as being invalid. I enabled debugging on the org.apache.xerces.impl.xs.models.XSDFACM class to try to troubleshoot the problem.
> package xercestest;
> import java.net.URL;
> import javax.xml.XMLConstants;
> import javax.xml.transform.stream.StreamSource;
> import javax.xml.validation.Schema;
> import javax.xml.validation.SchemaFactory;
> import javax.xml.validation.Validator;
> public class XercesTest {
>     public static void main(String[] args) {
>         try {
>             SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
>             StreamSource src = new StreamSource(new URL("http://schemas.xmlsoap.org/wsdl/").openStream());
>             Schema schema = sf.newSchema(src);
>             Validator validator = schema.newValidator();
>             src = new StreamSource(new URL("http://svn.apache.org/repos/asf/ode/trunk/bpel-test/src/test/resources/bpel/2.0/HelloWorld2//HelloWorld2.wsdl").openStream());
>             validator.validate(src);
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
> run:
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Any Node: firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 0ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 0ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 0ms
> Seq Node firstPos={ 0 1 2 } lastPos={ 2 }
>    Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>       Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>          Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>       Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>          Any Node: firstPos={ 1 } lastPos={ 1 }
>    Leaf: (pos=2), (elemIndex=null) firstPos={ 2 } lastPos={ 2 }
> DFA build: 0ms
> Seq Node firstPos={ 0 1 2 3 4 5 6 7 8 } lastPos={ 8 }
>    Seq Node Nullable firstPos={ 0 1 2 3 4 5 6 7 } lastPos={ 0 1 2 3 4 5 6 7 }
>       Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>          Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>             Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>          Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>             Any Node: firstPos={ 1 } lastPos={ 1 }
>       Rep Node Nullable firstPos={ 2 3 4 5 6 7 } lastPos={ 2 3 4 5 6 7 }
>          Choice Node firstPos={ 2 3 4 5 6 7 } lastPos={ 2 3 4 5 6 7 }
>             Choice Node firstPos={ 2 3 4 5 6 } lastPos={ 2 3 4 5 6 }
>                Choice Node firstPos={ 2 3 4 5 } lastPos={ 2 3 4 5 }
>                   Choice Node firstPos={ 2 3 4 } lastPos={ 2 3 4 }
>                      Choice Node firstPos={ 2 3 } lastPos={ 2 3 }
>                         Leaf: (pos=2), (elemIndex="http://schemas.xmlsoap.org/wsdl/":import) firstPos={ 2 } lastPos={ 2 }
>                         Leaf: (pos=3), (elemIndex="http://schemas.xmlsoap.org/wsdl/":types) firstPos={ 3 } lastPos={ 3 }
>                      Leaf: (pos=4), (elemIndex="http://schemas.xmlsoap.org/wsdl/":message) firstPos={ 4 } lastPos={ 4 }
>                   Leaf: (pos=5), (elemIndex="http://schemas.xmlsoap.org/wsdl/":portType) firstPos={ 5 } lastPos={ 5 }
>                Leaf: (pos=6), (elemIndex="http://schemas.xmlsoap.org/wsdl/":binding) firstPos={ 6 } lastPos={ 6 }
>             Leaf: (pos=7), (elemIndex="http://schemas.xmlsoap.org/wsdl/":service) firstPos={ 7 } lastPos={ 7 }
>    Leaf: (pos=8), (elemIndex=null) firstPos={ 8 } lastPos={ 8 }
> DFA build: 16ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 16ms
> Seq Node firstPos={ 0 1 2 } lastPos={ 2 }
>    Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>       Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>          Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>       Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>          Any Node: firstPos={ 1 } lastPos={ 1 }
>    Leaf: (pos=2), (elemIndex=null) firstPos={ 2 } lastPos={ 2 }
> DFA build: 16ms
> Seq Node firstPos={ 0 1 2 3 } lastPos={ 3 }
>    Seq Node Nullable firstPos={ 0 1 2 } lastPos={ 0 1 2 }
>       Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>          Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>             Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>          Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>             Any Node: firstPos={ 1 } lastPos={ 1 }
>       Rep Node Nullable firstPos={ 2 } lastPos={ 2 }
>          Leaf: (pos=2), (elemIndex="http://schemas.xmlsoap.org/wsdl/":part) firstPos={ 2 } lastPos={ 2 }
>    Leaf: (pos=3), (elemIndex=null) firstPos={ 3 } lastPos={ 3 }
> DFA build: 16ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 16ms
> Seq Node firstPos={ 0 1 2 } lastPos={ 2 }
>    Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>       Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>          Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>       Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>          Leaf: (pos=1), (elemIndex="http://schemas.xmlsoap.org/wsdl/":operation) firstPos={ 1 } lastPos={ 1 }
>    Leaf: (pos=2), (elemIndex=null) firstPos={ 2 } lastPos={ 2 }
> DFA build: 16ms
> Seq Node firstPos={ 0 1 2 5 } lastPos={ 8 }
>    Seq Node firstPos={ 0 1 2 5 } lastPos={ 2 3 4 5 6 7 }
>       Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>          Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>             Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>          Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>             Any Node: firstPos={ 1 } lastPos={ 1 }
>       Choice Node firstPos={ 2 5 } lastPos={ 2 3 4 5 6 7 }
>          Seq Node firstPos={ 2 } lastPos={ 2 3 4 }
>             Leaf: (pos=2), (elemIndex="http://schemas.xmlsoap.org/wsdl/":input) firstPos={ 2 } lastPos={ 2 }
>             Rep Node Nullable firstPos={ 3 } lastPos={ 3 4 }
>                Seq Node firstPos={ 3 } lastPos={ 3 4 }
>                   Leaf: (pos=3), (elemIndex="http://schemas.xmlsoap.org/wsdl/":output) firstPos={ 3 } lastPos={ 3 }
>                   Rep Node Nullable firstPos={ 4 } lastPos={ 4 }
>                      Leaf: (pos=4), (elemIndex="http://schemas.xmlsoap.org/wsdl/":fault) firstPos={ 4 } lastPos={ 4 }
>          Seq Node firstPos={ 5 } lastPos={ 5 6 7 }
>             Leaf: (pos=5), (elemIndex="http://schemas.xmlsoap.org/wsdl/":output) firstPos={ 5 } lastPos={ 5 }
>             Rep Node Nullable firstPos={ 6 } lastPos={ 6 7 }
>                Seq Node firstPos={ 6 } lastPos={ 6 7 }
>                   Leaf: (pos=6), (elemIndex="http://schemas.xmlsoap.org/wsdl/":input) firstPos={ 6 } lastPos={ 6 }
>                   Rep Node Nullable firstPos={ 7 } lastPos={ 7 }
>                      Leaf: (pos=7), (elemIndex="http://schemas.xmlsoap.org/wsdl/":fault) firstPos={ 7 } lastPos={ 7 }
>    Leaf: (pos=8), (elemIndex=null) firstPos={ 8 } lastPos={ 8 }
> DFA build: 31ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 31ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 31ms
> Seq Node firstPos={ 0 1 2 3 } lastPos={ 3 }
>    Seq Node Nullable firstPos={ 0 1 2 } lastPos={ 0 1 2 }
>       Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>          Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>             Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>          Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>             Any Node: firstPos={ 1 } lastPos={ 1 }
>       Rep Node Nullable firstPos={ 2 } lastPos={ 2 }
>          Leaf: (pos=2), (elemIndex="http://schemas.xmlsoap.org/wsdl/":operation) firstPos={ 2 } lastPos={ 2 }
>    Leaf: (pos=3), (elemIndex=null) firstPos={ 3 } lastPos={ 3 }
> DFA build: 31ms
> Seq Node firstPos={ 0 1 2 } lastPos={ 2 }
>    Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>       Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>          Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>       Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>          Any Node: firstPos={ 1 } lastPos={ 1 }
>    Leaf: (pos=2), (elemIndex=null) firstPos={ 2 } lastPos={ 2 }
> DFA build: 31ms
> Seq Node firstPos={ 0 1 2 } lastPos={ 2 }
>    Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>       Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>          Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>       Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>          Any Node: firstPos={ 1 } lastPos={ 1 }
>    Leaf: (pos=2), (elemIndex=null) firstPos={ 2 } lastPos={ 2 }
> DFA build: 31ms
> Seq Node firstPos={ 0 1 2 3 4 5 } lastPos={ 5 }
>    Seq Node Nullable firstPos={ 0 1 2 3 4 } lastPos={ 0 1 2 3 4 }
>       Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>          Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>             Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>          Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>             Any Node: firstPos={ 1 } lastPos={ 1 }
>       Seq Node Nullable firstPos={ 2 3 4 } lastPos={ 2 3 4 }
>          Seq Node Nullable firstPos={ 2 3 } lastPos={ 2 3 }
>             Rep Node Nullable firstPos={ 2 } lastPos={ 2 }
>                Leaf: (pos=2), (elemIndex="http://schemas.xmlsoap.org/wsdl/":input) firstPos={ 2 } lastPos={ 2 }
>             Rep Node Nullable firstPos={ 3 } lastPos={ 3 }
>                Leaf: (pos=3), (elemIndex="http://schemas.xmlsoap.org/wsdl/":output) firstPos={ 3 } lastPos={ 3 }
>          Rep Node Nullable firstPos={ 4 } lastPos={ 4 }
>             Leaf: (pos=4), (elemIndex="http://schemas.xmlsoap.org/wsdl/":fault) firstPos={ 4 } lastPos={ 4 }
>    Leaf: (pos=5), (elemIndex=null) firstPos={ 5 } lastPos={ 5 }
> DFA build: 47ms
> Seq Node firstPos={ 0 1 2 3 } lastPos={ 3 }
>    Seq Node Nullable firstPos={ 0 1 2 } lastPos={ 0 1 2 }
>       Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>          Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>             Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>          Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>             Any Node: firstPos={ 1 } lastPos={ 1 }
>       Rep Node Nullable firstPos={ 2 } lastPos={ 2 }
>          Leaf: (pos=2), (elemIndex="http://schemas.xmlsoap.org/wsdl/":port) firstPos={ 2 } lastPos={ 2 }
>    Leaf: (pos=3), (elemIndex=null) firstPos={ 3 } lastPos={ 3 }
> DFA build: 47ms
> Seq Node firstPos={ 0 1 2 } lastPos={ 2 }
>    Seq Node Nullable firstPos={ 0 1 } lastPos={ 0 1 }
>       Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>          Leaf: (pos=0), (elemIndex="http://schemas.xmlsoap.org/wsdl/":documentation) firstPos={ 0 } lastPos={ 0 }
>       Rep Node Nullable firstPos={ 1 } lastPos={ 1 }
>          Any Node: firstPos={ 1 } lastPos={ 1 }
>    Leaf: (pos=2), (elemIndex=null) firstPos={ 2 } lastPos={ 2 }
> DFA build: 47ms
> Seq Node firstPos={ 0 1 } lastPos={ 1 }
>    Rep Node Nullable firstPos={ 0 } lastPos={ 0 }
>       Any Node: firstPos={ 0 } lastPos={ 0 }
>    Leaf: (pos=1), (elemIndex=null) firstPos={ 1 } lastPos={ 1 }
> DFA build: 47ms
> org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'plnk:partnerLinkType'. One of '{"http://schemas.xmlsoap.org/wsdl/":import, "http://schemas.xmlsoap.org/wsdl/":types, "http://schemas.xmlsoap.org/wsdl/":message, "http://schemas.xmlsoap.org/wsdl/":portType, "http://schemas.xmlsoap.org/wsdl/":binding, "http://schemas.xmlsoap.org/wsdl/":service}' is expected.
>         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:282)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:481)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3571)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1982)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:788)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
>         at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:875)
>         at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
>         at org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:186)
>         at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:129)
>         at javax.xml.validation.Validator.validate(Validator.java:127)
>         at xercestest.XercesTest.main(XercesTest.java:34)
> BUILD SUCCESSFUL (total time: 0 seconds)
> In the oneTransition method of the XSDFACM class if the fTransTable contains a -1 one the element is skipped. In the table below fTranTable[2][1] corresponds to the parent any definition which is why the content is being reported as being invalid.
> fTransTable
> 0  1,1,2,2,2,2,2,2
> 1  -1,1,2,2,2,2,2,2
> 2  -1,-1,2,2,2,2,2,2
>  Unfortunately I don't fully understand the DFA table generation code fully so I cannot suggest a patch.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org