The schema is invalid. Please refer to Eddie's reply.
And Xerces does report an error if the "schema-full-checking" feature is
turned on. (-f option on the samples.)
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]
Loz
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
net.co.uk> cc:
Subject: Allowable schema
representations
07/31/2002 06:56
AM
Please respond to
xerces-j-user
If I define an XML schema as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!-- strange.xsd -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost/strange"
xmlns="http://localhost/strange"
elementFormDefault="qualified">
<xsd:complexType name="C1">
<xsd:sequence>
<xsd:element name="A" type
="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="C2">
<xsd:sequence>
<xsd:element name="A" type="C1"/>
<xsd:element name="A" type
="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="A" type="C2"/>
</xsd:schema>
then an instance document looks like
<?xml version="1.0" encoding="UTF-8"?>
<!-- strange.xml -->
<A xmlns="http://localhost/strange"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://localhost/strange strange.xsd">
<A>
<A>foo</A>
</A>
<A>bar</A>
</A>
Is there anything inherently wrong with having an "A" element used in
many different ways? Xerces will certainly validate the document OK, and
I couldn't find anything in the xml-schema spec that invalidates this.
It looks strange to me, as I don't think you could have defined this
structure using a DTD. Does anyone have a view on this?
cheers
Loz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]