Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > xpath to select text nodes and <br>

Reply
Thread Tools

xpath to select text nodes and <br>

 
 
Marek
Guest
Posts: n/a
 
      06-24-2008
Hello,

I need to select all descendant text nodes and br elements using a
xpath query. So this xml:

<a>
<b>text a</b> text b<br />
<c>text c</c> text d<br />
</a>

results in this node list:

1. text a
2. text b
3. <br>
4. text c
5. text d
6. <br>

I tried a/descendant::*[text() or self::br] but that got me some weird
results.

Thanks
 
Reply With Quote
 
 
 
 
Marek
Guest
Posts: n/a
 
      06-24-2008
On 24. Jún, 21:38 h., "szomiz"
<(E-Mail Removed)> wrote:
> > I tried a/descendant::*[text() or self::br] but that got me some weird
> > results.

>
> a/descendant::node()[self::text() or self::br]
>
> a/descendant::node()[not(node())]
>
> sz.


Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xpath select all nodes under document root eggie5 XML 1 10-02-2007 07:43 PM
Should Xpath select nodes containing default values?? aman.coe@gmail.com XML 2 10-22-2005 03:30 AM
Text nodes and element nodes query asd Java 3 05-23-2005 10:01 AM
mz js select nodes with xpath, having by specific attribute named'class' the 'subvalue part' set Marek Mänd Javascript 1 02-20-2005 04:43 PM
XPath: How to select all nodes which don't have children` Hannes Heckner XML 1 10-13-2003 09:43 AM



Advertisments