-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
51 lines (47 loc) · 1.63 KB
/
index.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
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>
<body>
<div id="app">
<div class="dialog">
<h1>Simple-Javascript-XML-Parser</h1>
<sub>Created with CodeSandbox</sub>
<p>A really basic, light-weight Javascript XML parser using a good dollop of Regex. Not intended to be a
comprehensive,
robust XML parser that deals with all eventualities but should handle simple XML okay.</p>
<a href="https://github.com/cjbailey/Simple-Javascript-XML-Parser/tree/master/">View on Github</a>
</div>
<div class="dialog">
<h2>How to use</h2>
<code>
let xml = "<root lang='en'><foo a='qwe'><foobar>hello world</foobar></foo></root>";<br/>
let xmlDoc = new XmlDocument(xml);<br/>
xmlDoc.toString();
</code>
<h3>XmlElement</h3>
<code>xmlDoc.children ... <i>(An array of XmlElement objects)</i> ...<br/></code>
<h3>XmlAttribute</h3>
<code>let element = xmlDoc.children[0];<br/>
element.attributes ... <i>(An array of XmlAttribute objects)</i> ...<br/>
</code>
<h3>XmlTextContent</h3>
<code>let text = new XmlTextContent("hello world");<br/>
let element = new XmlElement("p", ...attributes);<br/>
element.append(text);</code>
</div>
<div class="dialog">
<h2>Tester</h2>
<h4>Input</h4>
<textarea id="xml-import" lang="xml"></textarea>
<button id="xml-parse-btn">Parse it!</button>
<h4>Output</h4>
<textarea id="xml-parsed-result" readonly></textarea>
</div>
</div>
<script src="src/index.js">
</script>
</body>
</html>