Did you manage to find a solution to your problem because I'm facing the same issue ...
So far I found 2 solutions:
- Escape all characters in my CDATA to obtain a "clean" encoded string (with < instead of < etc.)
- Use XSLT to extract CDATA value
We 'solved' it the following way:
substring-before(substring-after(serialize(xpath_to_cdata_node, false), "CDATA["), "]]")
I know it's ugly, but it gets the job done without having to use additional steps in the process.
I escaped the offending characters in the XML file
"<" --> "<"
">" --> ">"
"&" --> "&"
"\"" --> """
"'" --> "'"
This approach was a bit tricky since the ampersand is both a character to be escaped when it is by itself, or a character NOT to be escaped when it is part of the escape sequence. Our data was extremely "open" and we couldn't discount the possibility that these escape sequences alread existed prior to us attempting to replace other unescaped characters.
Hindsight being 20/20, it might have been easier to use XSLT to strip away the CDATA tags in the LiveCycle process. Take a look at Willem-Paul's solution. A fairly lengthy XPATH statement, but potentially a lot less work than what I did.
Something like this I think:
substring-before(substring-after(serialize(/process_data/xmlProperties/properties/generati on/inputGenDocs/inputGenDoc[number(/process_data/@numDocIdx)], false), "CDATA["), "]]")
Just found out there is an another, easier, way. A post on stackoverflow got me on to this: simply use the XSLT component in a process to 'convert' the incoming xml to the same xml. This will automagically convert all CDATA tags to encoded text tags which of course can than accessed used xpath without any problems.
I used the exact xslt given in the answer in the XSLT component and it works like a charm.
Here's the direct link to the answer on stackoverflow: http://stackoverflow.com/a/10543572