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 "Blankenship, David" <Da...@kla-tencor.com> on 2000/07/20 22:01:53 UTC

Schema valication bug?

Xereces-j: 1.1.2
Jdk: Sun 1.3
OS: NT 4.0

I think this is a bug in Xerces, but I am willing to be convinced otherwise.

I have run into a validation problem while trying to build a recursive
structure. I have created a small test case that demonstrates the problem
that I am having. I am using xsd:choice to get around the lack of support
for xsi:type. I am able to validate using XML Spy, but I get the following
errors while validating with Xerces-j:

[error] file:///d:/source/xml/Tree.xml 6:10 Element type "fork" must be
declared.
[error] file:///d:/source/xml/Tree.xml 11:10 Element type "fork" must be
declared.
[error] file:///d:/source/xml/Tree.xml 16:13 The content of element type
"branch" must match "(fork)+".


Thanks,

David
KLA-Tencor Control Solutions


Tree.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.0 NT (http://www.xmlspy.com) by David
Blankenship (KLA-Tencor Corporation Control Solutions) -->
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
	<xsd:element name="root" type="RootType"/>
	<xsd:complexType name="RootType">
		<xsd:element type="TreeType" name="tree"/>
	</xsd:complexType>
	<xsd:complexType name="BranchType">
		<xsd:element name="fork" type="TreeType" minOccurs="1"
maxOccurs="unbounded"/>
	</xsd:complexType>
	<xsd:complexType name="LeafType">
		<xsd:element name="name" type="xsd:string"/>
	</xsd:complexType>
	<xsd:complexType name="TreeType">
		<xsd:choice>
			<xsd:element name="branch" type="BranchType"/>
			<xsd:element name="leaf" type="LeafType"/>
		</xsd:choice>
	</xsd:complexType>
</xsd:schema>



Tree.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.0 NT (http://www.xmlspy.com) by David
Blankenship (KLA-Tencor Corporation Control Solutions) -->
<root xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Tree.xsd">
	<tree>
		<branch>
			<fork>
				<leaf>
					<name>foo</name>
				</leaf>
			</fork>
			<fork>
				<leaf>
					<name>bar</name>
				</leaf>
			</fork>
		</branch>
	</tree>
</root>



Re: Schema valication bug?

Posted by Eric Ye <er...@locus.apache.org>.
There are a couple of bugs in Xerces1.1.2 that causing the problem you saw.
I already fixed them and the latest source in CVS works fine with your
example.

Also, the support for "xsi:type" has also been added to the latest source.

I expect another release coming out real soon.
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Blankenship, David" <Da...@kla-tencor.com>
To: <xe...@xml.apache.org>
Cc: "Atkins, Nathan" <Na...@kla-tencor.com>; "Hatcher, Stephen"
<St...@kla-tencor.com>
Sent: Thursday, July 20, 2000 1:01 PM
Subject: Schema valication bug?


> Xereces-j: 1.1.2
> Jdk: Sun 1.3
> OS: NT 4.0
>
> I think this is a bug in Xerces, but I am willing to be convinced
otherwise.
>
> I have run into a validation problem while trying to build a recursive
> structure. I have created a small test case that demonstrates the problem
> that I am having. I am using xsd:choice to get around the lack of support
> for xsi:type. I am able to validate using XML Spy, but I get the following
> errors while validating with Xerces-j:
>
> [error] file:///d:/source/xml/Tree.xml 6:10 Element type "fork" must be
> declared.
> [error] file:///d:/source/xml/Tree.xml 11:10 Element type "fork" must be
> declared.
> [error] file:///d:/source/xml/Tree.xml 16:13 The content of element type
> "branch" must match "(fork)+".
>
>
> Thanks,
>
> David
> KLA-Tencor Control Solutions
>
>
> Tree.xsd
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- edited with XML Spy v3.0 NT (http://www.xmlspy.com) by David
> Blankenship (KLA-Tencor Corporation Control Solutions) -->
> <xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <xsd:element name="root" type="RootType"/>
> <xsd:complexType name="RootType">
> <xsd:element type="TreeType" name="tree"/>
> </xsd:complexType>
> <xsd:complexType name="BranchType">
> <xsd:element name="fork" type="TreeType" minOccurs="1"
> maxOccurs="unbounded"/>
> </xsd:complexType>
> <xsd:complexType name="LeafType">
> <xsd:element name="name" type="xsd:string"/>
> </xsd:complexType>
> <xsd:complexType name="TreeType">
> <xsd:choice>
> <xsd:element name="branch" type="BranchType"/>
> <xsd:element name="leaf" type="LeafType"/>
> </xsd:choice>
> </xsd:complexType>
> </xsd:schema>
>
>
>
> Tree.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- edited with XML Spy v3.0 NT (http://www.xmlspy.com) by David
> Blankenship (KLA-Tencor Corporation Control Solutions) -->
> <root xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="Tree.xsd">
> <tree>
> <branch>
> <fork>
> <leaf>
> <name>foo</name>
> </leaf>
> </fork>
> <fork>
> <leaf>
> <name>bar</name>
> </leaf>
> </fork>
> </branch>
> </tree>
> </root>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>