summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/dom-parse-serialize.html
blob: a076483f6ef18737391f8120cc85c97c6b071593 (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!--
   - The contents of this file are subject to the Mozilla Public
   - License Version 1.1 (the "License"); you may not use this file
   - except in compliance with the License. You may obtain a copy of
   - the License at http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS
   - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
   - implied. See the License for the specific language governing
   - rights and limitations under the License.
   -
   - The Original Code is Mozilla Test Cases.
   -
   - The Initial Developer of the Original Code is Netscape Communications
   - Corp.  Portions created by Netscape Communications Corp. are
   - Copyright (C) 2001 Netscape Communications Corp.  All
   - Rights Reserved.
   -
   - Contributor(s):
  -->
<html>
<head>
<title>DOMParser/XMLSerializer test</title>
<style type="text/css">
.box {
  display: box;
  border: 1px solid black;
  margin-bottom: 0.5em;
}
pre {
  margin-left: 2em;
}
</style>
<script type="text/javascript">

if (window.testRunner)
    testRunner.dumpAsText();

function execute()
{
  var parser = new DOMParser();
  var str =
    '<?xml version="1.0"?>\n<!DOCTYPE doc [\n<!ATTLIST d id ID #IMPLIED>\n]>\n<doc>\n  <foo xmlns="foobar">One</foo> <x:bar xmlns:x="barfoo">Two</x:bar>\n  <d id="id3">Three</d>\n<f id="&amp;&lt;&gt;>">Four&amp;&lt;&gt;</f><empty/><empty></empty></doc>\n';
  var doc = parser.parseFromString(str,"text/xml");

  document.getElementById("id1").firstChild.nodeValue = str;
  document.getElementById("id2").firstChild.nodeValue = doc;
  var ser = new XMLSerializer();
  document.getElementById("id3").firstChild.nodeValue = ser.serializeToString(doc);
}

</script>
</head>
<body onload="execute();">
<h1>DOMParser/XMLSerializer test</h1>

<div>The "text to parse" and "document object serialized" boxes should show the same text, and it should be an XML document, not "@@No result@@".
</div>

<div class="box"><h2>text to parse</h2>
<pre id="id1">@@No result@@</pre>
</div>
<br>
<div class="box"><h2>document object</h2>
<pre id="id2">@@No result@@</pre>
</div>
<br>
<div class="box"><h2>document object serialized</h2>
<pre id="id3">@@No result@@</pre>
</div>

</body>
</html>