Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How to detect CDATA in XPATH ?

Reply
Thread Tools

How to detect CDATA in XPATH ?

 
 
Nold Fuchs
Guest
Posts: n/a
 
      10-30-2003
Hi !
I need to isolate some nodes without CDATA inside,
the problem is that I can not get an XPATH to differentiate simple
text nodes and CDATA nodes.

Sample XML :
<nodes>
<node>some text</node>
<node><![CDATA[some other text]]></node>
</nodes>

I want to get the first node but not the last one !
Obviously nodes/node/text() will give me both of them,
so how could I do that ?
Thanx in advance !
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      10-30-2003


Nold Fuchs wrote:
> I need to isolate some nodes without CDATA inside,
> the problem is that I can not get an XPATH to differentiate simple
> text nodes and CDATA nodes.
>
> Sample XML :
> <nodes>
> <node>some text</node>
> <node><![CDATA[some other text]]></node>
> </nodes>
>
> I want to get the first node but not the last one !
> Obviously nodes/node/text() will give me both of them,
> so how could I do that ?


I don't think the XPath 1.0 data model distinguishes text nodes from
CDATA text nodes.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
 
Bjoern Hoehrmann
Guest
Posts: n/a
 
      10-30-2003
* Nold Fuchs wrote in comp.text.xml:
>I need to isolate some nodes without CDATA inside,
>the problem is that I can not get an XPATH to differentiate simple
>text nodes and CDATA nodes.


Indeed, that is not possible using XPath 1.0.
 
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
Can I un-CDATA my CDATA section and elaborate a transformation for the contained data? troppfigo@excite.it XML 3 03-06-2006 03:01 AM
"Memory leak" in javax.xml.xpath.XPath Marvin_123456 Java 4 07-29-2005 03:49 PM
Extracting CDATA Text without CDATA Tags??? John Davison Java 1 07-06-2004 11:00 PM
Does XPath text() return CDATA SECTION? Tak Sze XML 2 04-30-2004 12:38 AM
Problem selecting a node with XPATH if attribute value contains backslashes - how to force XPATH string to be treated as literal? Alastair Cameron XML 1 07-08-2003 07:24 PM



Advertisments