You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Arnold, Curt" <Cu...@hyprotech.com> on 2000/07/20 22:12:39 UTC

RE: Schema validation bug?

My guess would be it would be the use of locally scoped names,
that is defining a fork element that is only defined in context
of the branch element.

I would first try your example against the W3C's XSV server
http://www.w3.org/2000/06/webdata/xsv which will require you
to put tree.xsd and tree.xml on a http server somewhere.

If Spy and XSV both concur then it is probably a Xerces-J issue,
but given the complex nature of the spec and the early state 
of implementation that should be expected.

If not, then I would suggest that you rewrite your schema
to use schema scoped elements, such as:

 <xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
 	<xsd:element name="root">
 		<xsd:complexType>
 			<xsd:element ref="tree"/>
 		</xsd:complexType>
	</xsd:element>
	<xsd:complexType name="TreeType">
 		<xsd:choice>
 			<xsd:element ref="branch"/>
 			<xsd:element ref="leaf"/>
 		</xsd:choice>
	</xsd:complexType>
	<xsd:element name="tree" type="TreeType"/>
 	<xsd:element name="fork" type="TreeType"/>
 	<xsd:element name="name" type="xsd:string"/>
      <xsd:element name="branch">
		<xsd:complexType>
 			<xsd:element ref="fork" minOccurs="1" maxOccurs="unbounded"/>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="leaf">
		<xsd:complexType>
			<xsd:element ref="name"/>
		</xsd:complexType>
	</xsd:element>
 </xsd:schema>