forked from abdolence/x2js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_issues.html
42 lines (36 loc) · 1.05 KB
/
check_issues.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE 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>