javascript - Parsing XML with JSON, also containing XML, embedded in an attribute of a tag -
i have xml response, similar below, need parse <message>
out of contained within json inside of attribute. comes in form of string.
"<response attr1='hello' bar='{ \"int\": 50, \"bool\": false, \"message\":\"< message > test message <a href=\"http://www.blah.com\">here</a> < /message >\" }'/>;"
i've found nice pure javascript answers such here perfect however, can see example above, xml contains json xml within, , parser parses <a>
, <message>
tags need preserve.
what easiest way of going implementing this? solution needs pure javascript, no libraries.
edit: https://jsfiddle.net/ree3c7w0/ shows attempt @ trying extract json whilst preserving xml within json , way escape xml within json
you need use software escape xml embedding json , escape json embedding xml.
Comments
Post a Comment