On Sat, 10 Nov 2001, Jason Long wrote:

> Can someone help me with a quick xpath question?
> 
> <root>
>   <a>
>     <b>Text 1</b>
>   </a>
>   Text 2
>   <br />
>   Text 3 
>   <a>
>     <b>Text 5</b>
>   </a>
>   Text 4
> </root>
> 
> I have been using jdom with jaxen and would appreciate some xpath advice.  
> How can I access text that is not directly in a tag by itself?
> For example what would be the syntax to select "Text 2" or "Text 3"?

I think this might work:

        /root/text()

That'll (hopefully) select the text nodes under the <root>.

Be advised that you might also get several others, representing
the line breaks scattered through the document.  Just trim()
each result, and process ones that have a length() > 0.

        -bob


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to