- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 19 Mar 2001 11:36:08 +0000
- To: "Jean-Guillaume LALANNE" <jean-guillaume.lalanne@coming.fr>
- Cc: <xmlschema-dev@w3.org>
"Jean-Guillaume LALANNE" <jean-guillaume.lalanne@coming.fr> writes: > excuse me if this message is unappropriate for this list.. > I'm a newbie to the list.. > I have a question.. > I have been trying to use inheritence with my XML schemas but up to now I > don't really manage... > > It looks like I have a problem with the namespace declaration in my XML > Instance. > > Here is the problem : > > Schema 1: AMContent.xsd > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema > targetNamespace="http://www.coming.fr/validation/WHIP-1.0/Schemas/whip-amcontent" > xmlns:whip-amcontent="http://www.coming.fr/validation/WHIP-1.0/Schemas/whip-amcontent" > xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"> > > > <xsd:element name="site-content"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="whip-amcontent:module-list"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > > <xsd:element name="module-list"> > > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="whip-amcontent:module" minOccurs="0" > maxOccurs="unbounded"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > > <xsd:element name="module" type="whip-amcontent:moduleType"/> > > <xsd:complexType name="moduleType"> > <xsd:sequence> > <xsd:element ref="whip-amcontent:name"/> > <xsd:element ref="whip-amcontent:description"/> > <xsd:element ref="whip-amcontent:details-list"/> > </xsd:sequence> > </xsd:complexType> > > <xsd:element name="name" type="xsd:string"/> > > <xsd:element name="description" type="xsd:string"/> > > <xsd:element name="details-list"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="whip-amcontent:details" minOccurs="0" > maxOccurs="unbounded"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > > <xsd:element name="details" type="whip-amcontent:detailsType"/> > > <xsd:complexType name="detailsType"/> > > > </xsd:schema> > > Schema 2: editorial.xsd > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema > targetNamespace="http://www.coming.fr/validation/WHIP-1.0/Schemas/whip-amcontent" > xmlns:whip-amcontent="http://www.coming.fr/validation/WHIP-1.0/Schemas/whip-amcontent" > xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"> > > <xsd:include > schemaLocation="D:\Users\jgl\WHIP1\src\coming\whip\testing_area\AMContent.xsd"/> > > <xsd:element name="editorial"> > <xsd:complexType> > <xsd:complexContent> > <xsd:extension base="whip-amcontent:moduleType"/> > </xsd:complexContent> > </xsd:complexType> > </xsd:element> > > </xsd:schema> > > XML Instance : amcontent-test.xml > > <?xml version="1.0" encoding="UTF-8"?> > <site-content > xmlns="http://www.coming.fr/validation/WHIP-1.0/Schemas/whip-amcontent" > xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" > xsi:schemaLocation="http://www.coming.fr/validation/WHIP-1.0/Schemas/whip-amcontent > D:\Users\jgl\WHIP1\src\coming\whip\testing_area\AMContent.xsd"> > > <module-list> > <editorial xsi:type="whip-amcontent:moduleType"> > <name>aaaaa</name> > <description>bbbbb</description> > <details-list/> > </editorial> > </module-list> > > </site-content> > > Of course, this document is not validated by XMLSpy or xerces1.3.0, because > > the only schema loaded is the schema located at > D:\Users\jgl\WHIP1\src\coming\whip\testing_area\AMContent.xsd.... > > And in this schema, the element editorial doesn't exist in the namespace > "whip-amcontent". > > To validate my XML instance, I will need a way to load also the > editorial.xsd schema file to make the parser aware in the current > working namespace ("whip-amcontent") of the element "editorial" > ...!!!! > > I have been thinking about pointing the file editorial.xsd from the > file AMContent.xsd with the "<xsd:include>" feature. But this is > definitively NOT the solution because the editorial.xsd already > points onto the AMContent.xsd file and it is causing a fatal error > in the parsers (infinite loop). That's a bug in those parsers -- the spec. explicitly says they should handle such situations. > So my question is how can I tell the parser to also parse my > file editorial.xsd to validate my XML file...???? A simpler alternative which should work is simply to use editorial.xsd in the schemaLocation hint in your instance, instead of AMContent.xsd. ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Monday, 19 March 2001 06:36:13 UTC