On Sat, 23 Feb 2002, Geir Magnusson Jr. wrote:

> I asked james as I thought it was a dom4j problem, but let me ask here too :
> 
> What is the Xpath expr to match a CDATA element in dom4j?  I thought
> 'text()' is the right answer, but it appears not to be...  It's likely I
> have a bug in my code  - I just want to make sure I am doing the right
> thing..

Yah, usage of the text() node-type-test should match CDATAs and other
text nodes.  You may have syntax a wee bit wonky in the actual XPath.

What's your document and xpath you're using?

Be aware, too, that something as simple as this:

        <foo>

                I am some text

        </foo>

might, depending on the parser, result in like 3 or more blocks
of text within the DOM.  There's not requirement that contiguous
blocks of text be normalized into one.  This is especially true
when dealing with CDATA:

        <foo>
                <![CDATA[I like cheese]]>
        </foo>

Will probably result in 3 text nodes:

        1:      "\n\t"
        2:      "I like cheese"
        3:      "\n"

-bob


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to