Hi Guillaume,

Looks like you've found a bug (unless the improvements XSQC has enabled you
to make have changed the picture).  I'm not sure when I'll get time to look
in to this; we're all pretty busy with Xerces2 now.  But I'll put it on the
to-do list.

Assuming it is a bug:  If I'm right about where the bug is it has to do
with the way we're handling XPath unions.  I believe what's happening is
that if the first step of the lefthand argument matches, the parser won't
bother ever looking at the right.  So you have two choices:

1.  Bite the bullet and use ".//".
2.  Move the <key> to the model:foos declaration and use ".//" there.  Of
course this won't assure uniqueness between model:foos elements, but at
least your <keyref>s should be able to find all the keys they need.

Hope that helps,
Neil

Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  416-448-3519, T/L 778-3519
E-mail:  [EMAIL PROTECTED]



Guillaume Rousse <[EMAIL PROTECTED]> on 08/23/2001 11:13:52 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  Re: xpath error


Ainsi parlait [EMAIL PROTECTED] :
> Hi Guillaume,
Hi Neil. Thanks for the reply.

> Looks like you have two choices to me:
>
> <key name="fooKey">
>   <selector xpath="model:foos/model:foo | model:foos/*/model:foo"/>
>   <field xpath="@id"/>
> </key>
>
> which should do exactly what you want but isn't perhaps as pretty as you
> might like; or
I used this solution as i have many model:foo hanging around, not only
under
model:foos element. However, this syntax seems to be badly handled by
xerces-j, and only the first proposition seems to be used.

This time with real data :
<key name="nameKey">
      <selector xpath="model:data/model:names/*/model:name |
model:data/model:names/model:name"/>
      <field xpath="@id"/>
    </key>
gives
[Error] pocilloporidae.xml:1185:11: Key with value [ID Value:  name1] not
found for identity constraint of element "dataset"

<key name="nameKey">
      <selector xpath="model:data/model:names/model:name |
model:data/model:names/*/model:name"/>
      <field xpath="@id"/>
    </key>
gives
[Error] pocilloporidae.xml:1185:11: Key with value [ID Value:  name4] not
found for identity constraint of element "dataset".[Error]
[..]
[Error] pocilloporidae.xml:1185:11: Key with value [ID Value:  name10] not
found for identity constraint of element "dataset".
[..]
[Error] pocilloporidae.xml:1185:11: Key with value [ID Value:  name15] not
found for identity constraint of element "dataset".
Etc...

name1 is toplevel, while others are deepest in name hierachy.

Full document and schema are available, if you want to check if i'm just
dumb
or if i've found a bug. I'm using a self-build xerces-j 1.4.2 /
Document is at
http://bohm.snv.jussieu.fr/~rousse/recherche/osis/model/src/xml/data/pocilloporidae.xml

Schema is at
ttp://bohm.snv.jussieu.fr/~rousse/recherche/osis/model/src/xml/schema/model.xsd

--
Guillaume Rousse <[EMAIL PROTECTED]>
GPG key http://bohm.snv.jussieu.fr/~rousse/gpgkey.html

---------------------------------------------------------------------
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]

Reply via email to