Forum Discussion
nmrao
Champion Level 3
As per below link, you can't directly apply xpath on the data that is inside cdata.
http://stackoverflow.com/questions/19745210/what-xpath-to-select-cdata-content-when-some-childs-exist
So first extract value that is in cdata, then use xmlslurper to parse that data and apply xpath on it.
http://stackoverflow.com/questions/19745210/what-xpath-to-select-cdata-content-when-some-childs-exist
So first extract value that is in cdata, then use xmlslurper to parse that data and apply xpath on it.
sharmameera
9 years agoContributor
Thanks! I will try that out.
- sharmameera9 years agoContributor
Thanks for the information Rao.
The script was really simple, and works fine!
def rootNode = new XmlSlurper().parseText('My CData Text')
assert rootNode.name() == 'The Root node in my CData'
assert rootNode.State.text() == AZ (State being one of the nodes in the CData).
Thanks!
Related Content
- 6 months agomacheshmeh