summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/domparsing/XMLSerializer-serializeToString.html
blob: 60932ee37f9691c9026e52068c35536e418f8b19 (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
<!DOCTYPE HTML>
<meta charset=utf-8>
<html>
 <head>
  <title>domparsing Test: XMLSerializer.serializeToString</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
    <h1>domparsing_XMLSerializer_serializeToString</h1>
  <script>
        function createXmlDoc(){
            var input = '<?xml version="1.0" encoding="UTF-8"?><root><child1>value1</child1></root>';
            var parser = new DOMParser();
            var doc = parser.parseFromString(input, 'text/xml');
            return doc;
        }
        test(function() {
            var serializer = new XMLSerializer ();
            var root = createXmlDoc().documentElement;
            var xmlString=serializer.serializeToString(root);
            assert_equals(xmlString, "<root><child1>value1</child1></root>");
        }, 'check  XMLSerializer.serializeToString method could parsing xmldoc to string');
  </script>
 </body>
</html>