forked from dimagi/Vellum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xml2json.html
33 lines (33 loc) · 1.14 KB
/
xml2json.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
<html>
<head>
<title>XML to JSON Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jsone4xml.js"></script>
<script type="text/javascript">
var updateUI = function() {
try {
var toParse = new XML(document.getElementById('form').value);
var res = e4xmlJsonClass.xml2json(toParse);
console.log(res);
document.getElementById("json-output").innerHTML = res.toString();
} catch (err) {
console.log(err);
}
};
</script>
<style>
textarea {
min-width: 80em;
min-height: 25em;
}
</style>
</head>
<body>
<p>Paste a form below to parse.</p>
<form onsubmit="updateUI(); return false;">
<textarea id="form" type="text" placeholder="asdf('bcd', 1, 'foo/bar')" ></textarea>
<input type="submit" value="Parse" />
</form>
Parse Results: <pre><div id="json-output"></div></pre>
</body>
</html>