Re: [xml] =?iso-8859-1?q?Does_not_support_the_expression_=3A_/descend?= =?iso-8859-1?q?ant=3A=3Anode=28=29/rec/child=3A=AD=3Anode=28=29=5B1=5D=3F?=
- From: Liam R E Quin <liam holoweb net>
- To: Ming Chen <ciming chen yahoo com>
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] Does not support the expression : /descendant::node()/rec/child::node()[1]?
- Date: Mon, 09 Jan 2012 22:22:05 -0500
On Mon, 2012-01-09 at 18:54 -0800, Ming Chen wrote:
According to the XPath spec (V2.0 section 3.2.3 Unabbreviated
Syntax) : child::node() selects all the children of the context node. Note
that no attribute nodes are returned, because attributes are not
children.
Note, libxml2 actually only supports XPath 1, not XPath 2.
However,
/descendant::node()/rec/child::node()[1]
will match text nodes, and you're getting the blank (whitespace-only)
text node that's the first child of elements, since your input is
"indented".
Shouldnât it have the same output as
/descendant::node()/rec/child::*[1] and /descendant::node()/rec/para[1]?
No.
The first child node in
<rec id="1">
<para type="error" position="1"/>
is the newline and spaces between id="1"> and <para.
Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]