xpath to select text nodes and <br>

Discussion in 'XML' started by Marek, Jun 24, 2008.

  1. Marek

    Marek Guest

    Hello,

    I need to select all descendant text nodes and br elements using a
    xpath query. So this xml:

    <a>
    <b>text a</b> text b<br />
    <c>text c</c> text d<br />
    </a>

    results in this node list:

    1. text a
    2. text b
    3. <br>
    4. text c
    5. text d
    6. <br>

    I tried a/descendant::*[text() or self::br] but that got me some weird
    results.

    Thanks
    Marek, Jun 24, 2008
    #1
    1. Advertising

  2. Marek

    Marek Guest

    On 24. Jún, 21:38 h., "szomiz"
    <> wrote:
    > > I tried a/descendant::*[text() or self::br] but that got me some weird
    > > results.

    >
    > a/descendant::node()[self::text() or self::br]
    >
    > a/descendant::node()[not(node())]
    >
    > sz.


    Thanks
    Marek, Jun 24, 2008
    #2
    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. asd
    Replies:
    3
    Views:
    428
    Arnaud Berger
    May 23, 2005
  2. Hannes Heckner
    Replies:
    1
    Views:
    759
    Martin Honnen
    Oct 13, 2003
  3. Replies:
    2
    Views:
    860
  4. eggie5
    Replies:
    1
    Views:
    526
    Joseph Kesselman
    Oct 2, 2007
  5. Marek Mänd
    Replies:
    1
    Views:
    291
    Martin Honnen
    Feb 20, 2005
Loading...

Share This Page