Re: [xml] =?utf-8?q?Does_not_support_the_expression_=3A_/descendant?= =?utf-8?b?Ojpub2RlKCkvcmVjL2NoaWxkOsKtOm5vZGUoKVsxXT8=?=

Thank you Liam, I have got the point.
Modifing the XML file as follows:
<?xml version="1.0" encoding="UTF-8"?>
<rec id="1"><para type="error" position="1"/>
<para type="error" position="2"/>
<para type="error" position="3"/>
<rec id="2"><para type="warning" position="1"/>
<para type="warning" position="2"/>
<para type="warning" position="3"/>
<rec id="3"><para type="info" position="1"/>
<para type="info" position="2"/>
<para type="info" position="3"/>
can get the expected outputs.
From: Liam R E Quin <liam holoweb net>
To: Ming Chen <ciming chen yahoo com>
Cc: "xml gnome org" <xml gnome org>
Sent: Tuesday, January 10, 2012 11:22 AM
Subject: Re: [xml] Does not support the _expression_ : /descendant::node()/rec/child:­:node()[1]?

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.

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

> Shouldnât it have the same output as
> /descendant::node()/rec/child::*[1] and /descendant::node()/rec/para[1]?

The first child node in
    <rec id="1">
      <para type="error" position="1"/>
is the newline and spaces between id="1"> and <para.


Liam Quin - XML Activity Lead, W3C,
Pictures from old books:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]