Hi John,
Sure you can help--that's the beauty of opensource!
The source of the bug is most probably in
org.apache.xerces.impl.xs.identity.Selector.Matcher. The reason .//* works
is that the Selector is smart enough not to give up matching once it's
found something that it matches (accords to the XPath expression).
Evidently this isn't true for union expressions. So the fix should be to
make it not give up so easily.
Although Xerces's identity constraint validation implementation is in
general very complex, I think this fix should be relatively
straightforward. That said, doing it in a performant manner might be a
little more tricky.
Anyway, if you come up with a patch I (or someone on the Xerces team) will
look it over and if it's good, get it into CVS. If you're able to do this
soon, it might even make it into the next release, which I understand
should be coming along quite soon.
Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 905-413-3519, T/L 969-3519
E-mail: [EMAIL PROTECTED]
Jon Schewe
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
well.com> cc:
Subject: Re: problem with keys
11/13/2003 05:52
PM
Please respond to
xerces-j-user
I was afraid of that. I really need to it to be a key because I have a
keyref for that as well in the real document. Any chance I can help get
this fixed reasonable quickly, since I have an application that needs this
functionality?
Neil Graham writes:
>
> Hi John,
>
> That's a bug. Please file a report in bugzilla, attaching these
> schema/instance documents.
>
> If all you want to assert is really that "all guids must be unique",
then
> there is a workaround: replace your selector's xpath with .//*. This
> produces the correct result on this file anyway.
>
> Hope that helps,
> Neil
> Neil Graham
> XML Parser Development
> IBM Toronto Lab
> Phone: 905-413-3519, T/L 969-3519
> E-mail: [EMAIL PROTECTED]
>
>
>
>
>
> Jon Schewe
> <[EMAIL PROTECTED] To:
[EMAIL PROTECTED]
> well.com> cc:
> Subject: problem with
keys
> 11/07/2003 05:00
> PM
> Please respond to
> xerces-j-user
>
>
>
>
>
> I'm rather stuck here and am wondering if I'm trying to do something
> invalid or what. This schema and instance document validate with xsv,
but
> not with Xerces (2.5.0). Attached are the instance and schema
documents.
> I'm
> using the xerces sample dom.GetElementsByTagName with arguments -v -s.
The
> problem appears to be that xerces doesn't like it when the selector
> of a key contains a parent element and it's child, like so: <xs:selector
> xpath="./dome:Model|./dome:Model/dome:Entity"/>
>
> Any help would be greatly appreciated.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://dome.honeywell.com"
> xmlns="http://dome.honeywell.com"
> xmlns:dome="http://dome.honeywell.com"
> elementFormDefault="qualified" >
>
> <xs:element name="DOME">
> <xs:complexType>
> <xs:sequence minOccurs="1" maxOccurs="unbounded">
> <xs:element name="Model" type="ModelType"/>
> </xs:sequence>
> </xs:complexType>
> <xs:key name="PK">
> <xs:annotation>
> <xs:documentation>
> All guids must be unique within this file
> </xs:documentation>
> </xs:annotation>
> <xs:selector xpath="./dome:Model|./dome:Model/dome:Entity"/>
> <xs:field xpath="@guid"/>
> </xs:key>
> </xs:element>
>
> <xs:simpleType name="guidType">
> <xs:restriction base="xs:string"/>
> </xs:simpleType>
>
> <xs:complexType name="UniqueObjectType">
> <xs:attribute name="guid" type="guidType" use="required"/>
> </xs:complexType>
>
> <xs:complexType name="EntityType">
> <xs:complexContent>
> <xs:extension base="UniqueObjectType" />
> </xs:complexContent>
> </xs:complexType>
>
> <xs:complexType name="ModelType">
> <xs:complexContent>
> <xs:extension base="UniqueObjectType">
> <xs:sequence>
> <xs:element name="Entity" type="EntityType" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> </xs:schema>
> <?xml version="1.0" encoding="UTF-8"?>
> <DOME xmlns="http://dome.honeywell.com"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://dome.honeywell.com test.xsd">
> <Model guid="1">
> <Entity guid="1"/>
> </Model>
> </DOME>
>
>
> --
> Your mouse has moved.
> Windows must restart for change to take effect.
> Reboot now? [OK]
> *My views may not represent those of my employers
>
> ---------------------------------------------------------------------
> 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]
--
Your mouse has moved.
Windows must restart for change to take effect.
Reboot now? [OK]
*My views may not represent those of my employers
---------------------------------------------------------------------
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]