Subject: Re: Compact XPath syntax
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 26 Dec 2007 18:17:27 +0530
|
Writing a bit late to this thread ...
On Dec 20, 2007 5:14 AM, Ramkumar Menon <ramkumar.menon@xxxxxxxxx> wrote:
> Consider another XML.
>
> <a>
> <b>
> <c>
> </b>
> <f>
> <c>
> </f>
> </a>
> I could refer to the node "c" as "!c", which matches all "c" nodes at
> all levels. I specify something on the lines of !c[parent::b] or
> !c[parent::f] to address the respective "c" nodes.
Personally speaking, I find XPath capabilities to address parts of XML
document fine. To my opinion, it's a great language in fact.
In XPath, we write XPath expressions to reach nodes from a context
node. We can use various axes and node types provided, in our
expressions.
Incidentally, for the above example, I would write the expression as:
//c[parent::b]
//c[parent::f]
(in these examples, we filter nodes using a predicate).
or //c (if you want to select all 'c' elements everywhere in the tree).
--
Regards,
Mukul Gandhi
|