Groovy XMLSlurper namespace error without namespaces
-
06-12-2019 - |
Question
I have following XML that XMLSlurper is unable to parse. I think XMLSlurper thinks the xxx:yyy is some kind of namespace. Is there any chance to change this behavior?
<node>
<application app_name="export"
app_data="nolocal:api_on_answer=sched_hangup +3600 40887ffe-65de-11e1-89da-e9feb0a98acf alloted_timeout"
app_stamp="1330854103808996">
</application>
</node>
I cannot change the XML. The error i get:
The prefix "nolocal" for element "nolocal:api_on_answer" is not bound.. Stacktrace follows:
Message: The prefix "nolocal" for element "nolocal:api_on_answer" is not bound.
Line | Method
->> 48 | doCall in sipsy.admin.WebapiController$_closure4$$ENQh9JnT
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
Solution
Sorry, my fault (as usual :D). I've worked with the wrong data. There are 2 xml strings, the one i've posted and a similiar one, with a tag. shame on me... thank you for your time :)
Just to be complete: If you need to parse not 100% valid XML, you can pass 2 booleans to the constructor of XmlSlurper(a, b). A is for validation and b for namespace awareness.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow