gecko-dev/extensions/xmlextras/tests/parseserializedisplay.html
bzbarsky%mit.edu 1b833f021f Switch some internal users of text/xml to application/xml. Bug 247024, patch
by Anne van Kesteren <bug@annevankesteren.nl>, r+sr=bzbarsky
2005-02-27 19:34:11 +00:00

50 lines
1.3 KiB
HTML

<html>
<head>
<title>DOMParser/XMLSerializer test</title>
<style type="text/css">
.box {
display: box;
border: 1px solid black;
margin-bottom: 0.5em;
}
.boxheader {
font-weight: bold;
color: maroon;
}
pre {
margin-left: 2em;
}
</style>
<script type="text/javascript">
function execute()
{
var parser = new DOMParser();
var str =
'<?xml version="1.0"?>\n<?xml-stylesheet href="display.css" type="text/css"?>\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</doc>\n';
var doc = parser.parseFromString(str,"application/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);
}
setTimeout(execute,0);
</script>
</head>
<body>
<h1>DOMParser/XMLSerializer test</h1>
<div class="box"><span class="boxheader">text to parse</span>
<pre id="id1">@@No result@@</pre>
</div>
<div class="box"><span class="boxheader">document object</span>
<pre id="id2">@@No result@@</pre>
</div>
<div class="box"><span class="boxheader">document object serialized</span>
<pre id="id3">@@No result@@</pre>
</div>
</body>
</html>