How to detect CDATA in XPATH ?

Discussion in 'XML' started by Nold Fuchs, Oct 30, 2003.

  1. Nold Fuchs

    Nold Fuchs Guest

    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 !
    Nold Fuchs, Oct 30, 2003
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Oct 30, 2003
    #2
    1. Advertising

  3. * 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.
    Bjoern Hoehrmann, Oct 30, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Davison
    Replies:
    1
    Views:
    572
    Hal Rosser
    Jul 7, 2004
  2. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,958
    jan V
    Jul 29, 2005
  3. Alastair Cameron
    Replies:
    1
    Views:
    7,369
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  4. Tak Sze
    Replies:
    2
    Views:
    4,249
    Patrick TJ McPhee
    Apr 30, 2004
  5. Replies:
    3
    Views:
    738
    Joe Kesselman
    Mar 6, 2006
Loading...

Share This Page