You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Pete Hendry <pe...@capeclear.com> on 2005/03/16 23:45:18 UTC

validating "lax" wildcard when schema not available

I am using xerces to validate soap messages. The following message is 
failing validation:

<env:Envelope
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns0="http://schemas.xmlsoap.org/ws/2004/03/rm"
    xmlns:ns1="http://schemas.xmlsoap.org/ws/2002/07/utility">
    <env:Header>
        <ns0:Sequence env:encodingStyle="" xsi:type="ns0:SequenceType">
            <ns1:Identifier 
xsi:type="ns1:AttributedURI">http://com.capeclear/uuid/46635529-1b63-4818-1949-7e7d66703425</ns1:Identifier>
            <ns0:MessageNumber xsi:type="xsd:integer">1</ns0:MessageNumber>
            <ns0:LastMessage xsi:type="xsd:string"/>
        </ns0:Sequence>
    </env:Header>
    <env:Body>
        <ns3:Echo xmlns:ns3="http://demo.capeclear.com/ASyncEcho.xsd1">
            <Identifier>4</Identifier>
            <Message>abcdef</Message>
        </ns3:Echo>
    </env:Body>
</env:Envelope>

with the error

    cvc-elt.4.2: Cannot resolve 'ns0:SequenceType' to a type definition 
for element 'ns0:Sequence'.

The soap-env schema defines <env:Header> as

  <xs:complexType name="Header" >
    <xs:sequence>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />

    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>


As you can see this has processContents="lax". Should the contents of 
ns0:Sequence not be skipped if xerces cannot locate a schema component 
to validate against? Does the fact it contains an xsi:type affect this 
behaviour? I don't want to require all headers have associated (or at 
least available) schemas and can't control whether xsi:type is present 
on each header (I assume it should still skip even with xsi:type present 
otherwise lax would be fairly meaningless).

Or is this a bug in xerces? I'm using Xerces-J 2.6.2 with JDK 1.4.2_06.

Pete

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


Re: validating "lax" wildcard when schema not available

Posted by Pete Hendry <pe...@capeclear.com>.
Nobody going to take a stab at answering this?

Pete

Pete Hendry wrote:

> I am using xerces to validate soap messages. The following message is 
> failing validation:
>
> <env:Envelope
>    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:ns0="http://schemas.xmlsoap.org/ws/2004/03/rm"
>    xmlns:ns1="http://schemas.xmlsoap.org/ws/2002/07/utility">
>    <env:Header>
>        <ns0:Sequence xsi:type="ns0:SequenceType">
>            <ns1:Identifier 
> xsi:type="ns1:AttributedURI">http://com.capeclear/uuid/46635529-1b63-4818-1949-7e7d66703425</ns1:Identifier> 
>
>            <ns0:MessageNumber 
> xsi:type="xsd:integer">1</ns0:MessageNumber>
>            <ns0:LastMessage xsi:type="xsd:string"/>
>        </ns0:Sequence>
>    </env:Header>
>    <env:Body>
>        <ns3:Echo xmlns:ns3="http://demo.capeclear.com/ASyncEcho.xsd1">
>            <Identifier>4</Identifier>
>            <Message>abcdef</Message>
>        </ns3:Echo>
>    </env:Body>
> </env:Envelope>
>
> with the error
>
>    cvc-elt.4.2: Cannot resolve 'ns0:SequenceType' to a type definition 
> for element 'ns0:Sequence'.
>
> The soap-env schema defines <env:Header> as
>
>  <xs:complexType name="Header" >
>    <xs:sequence>
>      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" 
> processContents="lax" />
>    </xs:sequence>
>    <xs:anyAttribute namespace="##other" processContents="lax" />
>  </xs:complexType>
>
>
> As you can see this has processContents="lax". Should the contents of 
> ns0:Sequence not be skipped if xerces cannot locate a schema component 
> to validate against? Does the fact it contains an xsi:type affect this 
> behaviour? I don't want to require all headers have associated (or at 
> least available) schemas and can't control whether xsi:type is present 
> on each header (I assume it should still skip even with xsi:type 
> present otherwise lax would be fairly meaningless).
>
> Or is this a bug in xerces? I'm using Xerces-J 2.6.2 with JDK 1.4.2_06.
>
> Pete
>

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