How to detect CDATA in XPATH ?

N

Nold Fuchs

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 !
 
M

Martin Honnen

Nold said:
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.
 
B

Bjoern Hoehrmann

* 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top