469,358 Members | 1,610 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

How to detect CDATA in XPATH ?

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 !
Jul 20 '05 #1
2 4859


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/

Jul 20 '05 #2
* 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.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Max | last post: by
4 posts views Thread by Rich Wallace | last post: by
1 post views Thread by yosh | last post: by
15 posts views Thread by aidy | last post: by
2 posts views Thread by C | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.