2 - The contents of this file are subject to the Mozilla Public
3 - License Version 1.1 (the "License"); you may not use this file
4 - except in compliance with the License. You may obtain a copy of
5 - the License at http://www.mozilla.org/MPL/
7 - Software distributed under the License is distributed on an "AS
8 - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 - implied. See the License for the specific language governing
10 - rights and limitations under the License.
12 - The Original Code is Mozilla Test Cases.
14 - The Initial Developer of the Original Code is Netscape Communications
15 - Corp. Portions created by Netscape Communications Corp. are
16 - Copyright (C) 2001 Netscape Communications Corp. All
23 <title>DOMParser/XMLSerializer test
</title>
24 <style type=
"text/css">
27 border: 1px solid black
;
34 <script type=
"text/javascript">
36 if (window
.testRunner
)
37 testRunner
.dumpAsText();
41 var parser
= new DOMParser();
43 '<?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="&<>>">Four&<></f><empty/><empty></empty></doc>\n';
44 var doc
= parser
.parseFromString(str
,"text/xml");
46 document
.getElementById("id1").firstChild
.nodeValue
= str
;
47 document
.getElementById("id2").firstChild
.nodeValue
= doc
;
48 var ser
= new XMLSerializer();
49 document
.getElementById("id3").firstChild
.nodeValue
= ser
.serializeToString(doc
);
54 <body onload=
"execute();">
55 <h1>DOMParser/XMLSerializer test
</h1>
57 <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@@".
60 <div class=
"box"><h2>text to parse
</h2>
61 <pre id=
"id1">@@No result@@
</pre>
64 <div class=
"box"><h2>document object
</h2>
65 <pre id=
"id2">@@No result@@
</pre>
68 <div class=
"box"><h2>document object serialized
</h2>
69 <pre id=
"id3">@@No result@@
</pre>