You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Tobias McNulty <tm...@datadesk.com> on 2002/03/22 17:18:34 UTC
XPath selections
If I call selectSingleNode on a given root, with a expression such as
"object[@id=1]", what actual nodes does Xalan search? I am running
Xerces to handle XML parsing and DOM. My concern is this: since
attributes are Nodes in Xerces, will Xalan test against _all_ the
node children of 'object', including its elements, text nodes, etc.,
looking for the attribute 'id'?
Thanks,
Toby
--
Tobias McNulty
Data Description, Inc.
840 Hanshaw Road, Suite 9
Ithaca, NY 14850
Phone: (607) 257-1000
E-mail: tmcnulty@datadesk.com
Web: www.datadesk.com
Re: XPath selections
Posted by Tobias McNulty <tm...@datadesk.com>.
>If I call selectSingleNode on a given root, with a expression such
>as "object[@id=1]", what actual nodes does Xalan search? I am
>running Xerces to handle XML parsing and DOM. My concern is this:
>since attributes are Nodes in Xerces, will Xalan test against _all_
>the node children of 'object', including its elements, text nodes,
>etc., looking for the attribute 'id'?
>
>Thanks,
>Toby
I did more tests; it appears that selectSingleNode does search the
other direct children. It also appears to search _all_ the children
of the node, for example if I have:
<root>
<object>
<data>
<data>
<data>
<r/>
<r/>
</data>
</data>
</data>
<prop id="1"/>
</object>
</root>
and I do a selectSingleNode with <root> as the context and the XPath
expr "prop[@id=1]", Xalan appears to run through the data tree and
grab the values of the <r> elements.
Is this because the DOM to DTM code creates a full replica of the
Xerces DOM in DTM format before running the XPath selection on the
document?
Thanks,
Toby
--
Tobias McNulty
Data Description, Inc.
840 Hanshaw Road, Suite 9
Ithaca, NY 14850
Phone: (607) 257-1000
E-mail: tmcnulty@datadesk.com
Web: www.datadesk.com