1DOM = (new DOMParser).parseFromString( 2 '<?xml version="1.0" encoding="ISO-8859-1"?>' + 3 '<!DOCTYPE ROOT [' + 4 ' <!ELEMENT CHILD2 (#PCDATA|GCHILD)*>' + 5 ' <!ATTLIST CHILD2 attr1 CDATA #IMPLIED' + 6 ' CODE ID #REQUIRED>' + 7 ']>' + 8 '<?xml-stylesheet "Data" ?>' + 9 '<ROOT>' + 10 ' <!-- Test Comment -->' + 11 ' <CHILD1 attr1="val1" attr31="31">' + 12 ' <GCHILD name="GCHILD11"/>' + 13 ' <GCHILD name="GCHILD12"/>' + 14 ' Text1' + 15 ' </CHILD1>' + 16 ' <CHILD2 attr1="val2" CODE="1">' + 17 ' <GCHILD name="GCHILD21"/>' + 18 ' <GCHILD name="GCHILD22"/>' + 19 ' </CHILD2>' + 20 ' <foo:CHILD3 xmlns:foo="http://foo.com" foo:name="mike"/>' + 21 ' <lang xml:lang="en">' + 22 ' <foo xml:lang=""/>' + 23 ' <foo/>' + 24 ' <f\xf6\xf8/>' + 25 ' </lang>' + 26 '</ROOT>' + 27 '<?no-data ?>', 28 'application/xml'); 29 30DOM = DOM; 31ROOT = DOM.documentElement; 32 33PI = DOM.firstChild; 34while (PI.nodeType != Node.PROCESSING_INSTRUCTION_NODE) 35 PI = PI.nextSibling; 36 37PI2 = DOM.lastChild; 38COMMENT = ROOT.firstChild 39while (COMMENT.nodeType != Node.COMMENT_NODE) 40 COMMENT = COMMENT.nextSibling; 41 42CHILD1 = DOM.getElementsByTagName("CHILD1")[0]; 43ATTR1 = CHILD1.getAttributeNode("attr1"); 44ATTR31 = CHILD1.getAttributeNode("attr31"); 45CHILD2 = DOM.getElementsByTagName("CHILD2")[0]; 46ATTR2 = CHILD2.getAttributeNode("attr1"); 47IDATTR2 = CHILD2.getAttributeNode('CODE') 48CHILD3 = DOM.getElementsByTagName("CHILD3")[0]; 49if (!CHILD3) 50 CHILD3 = DOM.getElementsByTagName("foo:CHILD3")[0]; 51text = CHILD1.lastChild; 52LANG = DOM.getElementsByTagName("lang")[0]; 53NONASCIIQNAME = DOM.getElementsByTagName("f\xf6\xf8")[0]; 54 55CHILDREN = [CHILD1, CHILD2, CHILD3, LANG]; 56GCHILDREN1 = [CHILD1.getElementsByTagName("GCHILD")[0], CHILD1.getElementsByTagName("GCHILD")[1]]; 57GCHILD11 = GCHILDREN1[0]; 58GCHILD12 = GCHILDREN1[1]; 59TEXT1 = CHILD1.lastChild; 60GCHILDREN2 = [CHILD2.getElementsByTagName("GCHILD")[0], CHILD2.getElementsByTagName("GCHILD")[1]]; 61GCHILD21 = GCHILDREN2[0]; 62GCHILD22 = GCHILDREN2[1]; 63LCHILDREN = [LANG.getElementsByTagName("foo")[0], LANG.getElementsByTagName("foo")[1], LANG.getElementsByTagName("f\xf6\xf8")[0]]; 64LCHILD1 = LCHILDREN[0]; 65LCHILD2 = LCHILDREN[1]; 66