Hi Hugh,
Yikes, you're right! The declaration for <unique> in personal.xsd was
totally bogus; @name means it was looking for a name attribute on the
personal element, and of course there was none (and could not be one).
In case you're interested, the reason the parser can't check for things
like that statically is because of wildcards, substitutionGroups and all
those other mechanisms schemas provide to make your instance document's
content flexible. Anyway, I've changed personal.xsd in CVS so that it now
keys on both the family and given children of name; I think that's what the
original intent was anyway.
Hope that helps,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 416-448-3519, T/L 778-3519
E-mail: [EMAIL PROTECTED]
"Hugh Rodgers" <[EMAIL PROTECTED]> on 07/11/2001 05:41:41 PM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: schema uniqueness validation
I am having trouble getting the Xerces 1.4.1 parser (for
Java) to detect a violation of the uniqueness constraint.
I used the sample schema personal.xsd and the sample XML
file personal-schema.xml that comes with Xerces. I then
changed personal-schema.xml to use the same given name for
the two of the entries, i.e.,
<person id="one.worker">
<name><family>Worker</family> <given>One</given></name>
<email>[EMAIL PROTECTED]</email>
<link manager="Big.Boss"/>
</person>
<person id="two.worker">
<name><family>Worker</family> <given>One</given></name>
<email>[EMAIL PROTECTED]</email>
<link manager="Big.Boss"/>
</person>
The name element is constrained to be unique as follows in
personal.xsd:
<xs:unique name="unique1">
<xs:selector xpath="person"/>
<xs:field xpath="@name"/>
</xs:unique>
But when I run this through the sample program SAX2Writer,
no errors are detected by the parser. Is this a bug in
Xerces 1.4.1?
Thanks -
Hugh Rodgers
---------------------------------------------------------------------
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]