<!--
- 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 src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script type="text/javascript">
test(() => {
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="&<>>">Four&<></f><empty/><empty></empty></doc>\n';
var doc = parser.parseFromString(str,"text/xml");
assert_equals(Object.prototype.toString.call(doc) , "[object XMLDocument]");
var ser = new XMLSerializer();
assert_equals(ser.serializeToString(doc) , '<?xml version="1.0"?><!DOCTYPE doc><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/></doc>');
}, "Tests that the 'text to parse' and 'document object serialized' boxes should show the same text, and it should be an XML document");
</script>
</head>
<body>
</body>
</html>