Re: validation issue for extensible schema - XMLSpy issue ?

I have found that the processContent feature is inconsitently implemented in
various products, so we ended up removing it from our ANY definitions.  It
was easier to predict what a parser would do without it than with it.

(A former posting of the above).
http://lists.w3.org/Archives/Public/xmlschema-dev/2003Jan/0069.html

Regard,
Paul Kiel


----- Original Message -----
From: "Laurent Le Meur" <laurent.lemeur@afp.com>
To: <xmlschema-dev@w3.org>; "newsml" <newsml@yahoogroups.com>
Sent: Friday, February 14, 2003 7:22 AM
Subject: validation issue for extensible schema - XMLSpy issue ?


>
> Hi,
>
> I'm looking for a way to create an extensible schema, that can act as a
> container for any structure, but with the capability to validate xml
> instances against the container schema AND the payload schema.
>
> My parser is XMLSpy5 rel3, and I reach bizarre conclusions.
>
> the container schema : a.xsd
> -----------------------------
> A simple test schema : a can contain anything ; unqualified elements.
> Use the <any> element with processContents="strict", the only option
> that provoques validation of the inner structure with XMLSpy.
>
> <xsd:schema xmlns="urn:newsml:iptc.org:a"
> targetNamespace="urn:newsml:iptc.org:a"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
> <xsd:element name="a">
> <xsd:complexType>
> <xsd:complexContent>
> <xsd:restriction base="xsd:anyType">
> <xsd:sequence>
> <xsd:any
> namespace="##other" processContents="strict" minOccurs="0"
> maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
> the payload schema : b.xsd
> ---------------------------
> A simple test schema : b can contain bb* (string) ; unqualified elements
>
> <xsd:schema targetNamespace="urn:newsml:iptc.org:b"
> xmlns="urn:newsml:iptc.org:b"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
> <xsd:element name="b">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="bb" minOccurs="0"
> maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="bb" type="xsd:string"/>
> </xsd:schema>
>
> first tests
> -------------
> Instance1 is valid (fine):
> <a xmlns="urn:newsml:iptc.org:a"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:newsml:iptc.org:a  a.xsd   urn:newsml:iptc.org:b
> b.xsd ">
> <b xmlns="urn:newsml:iptc.org:b" ><bb>ffff</bb></b>
> </a>
>
> Instance2, with a 'c' element, is invalid (so far so good ; at least
> I've got what I wanted):
> <a xmlns="urn:newsml:iptc.org:a"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:newsml:iptc.org:a  a.xsd   urn:newsml:iptc.org:b
> b.xsd ">
> <b xmlns="urn:newsml:iptc.org:b" ><bb>ffff</bb><c/></b>
> </a>
>
> Now the issues
> ---------------
> Instance3 is invalid (I just reversed 'a' and 'b' schemaLocation
> information ; ????):
> <a xmlns="urn:newsml:iptc.org:a"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:newsml:iptc.org:b  b.xsd  urn:newsml:iptc.org:a
> a.xsd">
> <b xmlns="urn:newsml:iptc.org:b" ><bb>ffff</bb><c/></b>
> </a>
>
> Instance4 is valid (I entered a false URL for the 'b' namespace, the
> validator should say no!; same result if I suppress the 'b' information
> in schemaLocation ; ????):
> <a xmlns="urn:newsml:iptc.org:a"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:newsml:iptc.org:a  a.xsd  urn:newsml:iptc.org:b
> c.xsd  ">
> <b xmlns="urn:newsml:iptc.org:b" ><bb>ffff</bb><c/></b>
> </a>
>
> I tend to believe that XMLSpy uses the 'strict' processContents option
> in 'a' as a 'lax' option, and the 'lax' option as a 'skip' option.
>
> Does anybody has seen such problems in "real life", with other
> validating parser ?
>
>
> Laurent Le Meur
> Agence France Presse
> Member of IPTC (www.iptc.org) - creators of NewsML: the XML news wrapper
>
>

Received on Friday, 14 February 2003 09:49:27 UTC