consumerportal
Version:
mydna Custimised for you
43 lines (36 loc) • 1.08 kB
HTML
<html>
<head>
<script type="text/javascript" src="xml2json.js"></script>
</head>
<body>
<h1>Check issues html</h1>
<script type="text/javascript">
var x2js = new X2JS({
arrayAccessFormPaths : [
/.*\.test3\.item/,
"MyOperation.test4.item",
function(obj, childName, path) {
return false;
}
],
datetimeAccessFormPaths : [
"MyOperation.testdt"
],
stripWhitespaces : true,
enableToStringFunc : true
});
var xmlText =
"<MyOperation myAttr='SuccessAttrValue'>"+
"<testdt>2002-10-10T12:00:00-05:00</testdt>"+
"<ctest><![CDATA[Hello world!]]></ctest>"+
"<description test-attr='hey'>< --> &lt;</description>"+
"</MyOperation>";
var jsonObj = x2js.xml_str2json( xmlText );
console.log(jsonObj);
console.log(jsonObj.MyOperation.testdt);
console.log(jsonObj.MyOperation.description);
console.log( x2js.json2xml_str( jsonObj ) );
console.log( "Ok!" );
</script>
</body>