Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1510

XML Schema Validation ignores parent any declaration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.11.0
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            aaronanderson Aaron Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: