1 DOM = (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 30 DOM = DOM; 31 ROOT = DOM.documentElement; 32 33 PI = DOM.firstChild; 34 while (PI.nodeType != Node.PROCESSING_INSTRUCTION_NODE) 35 PI = PI.nextSibling; 36 37 PI2 = DOM.lastChild; 38 COMMENT = ROOT.firstChild 39 while (COMMENT.nodeType != Node.COMMENT_NODE) 40 COMMENT = COMMENT.nextSibling; 41 42 CHILD1 = DOM.getElementsByTagName("CHILD1")[0]; 43 ATTR1 = CHILD1.getAttributeNode("attr1"); 44 ATTR31 = CHILD1.getAttributeNode("attr31"); 45 CHILD2 = DOM.getElementsByTagName("CHILD2")[0]; 46 ATTR2 = CHILD2.getAttributeNode("attr1"); 47 IDATTR2 = CHILD2.getAttributeNode('CODE') 48 CHILD3 = DOM.getElementsByTagName("CHILD3")[0]; 49 if (!CHILD3) 50 CHILD3 = DOM.getElementsByTagName("foo:CHILD3")[0]; 51 text = CHILD1.lastChild; 52 LANG = DOM.getElementsByTagName("lang")[0]; 53 NONASCIIQNAME = DOM.getElementsByTagName("f\xf6\xf8")[0]; 54 55 CHILDREN = [CHILD1, CHILD2, CHILD3, LANG]; 56 GCHILDREN1 = [CHILD1.getElementsByTagName("GCHILD")[0], CHILD1.getElementsByTagName("GCHILD")[1]]; 57 GCHILD11 = GCHILDREN1[0]; 58 GCHILD12 = GCHILDREN1[1]; 59 TEXT1 = CHILD1.lastChild; 60 GCHILDREN2 = [CHILD2.getElementsByTagName("GCHILD")[0], CHILD2.getElementsByTagName("GCHILD")[1]]; 61 GCHILD21 = GCHILDREN2[0]; 62 GCHILD22 = GCHILDREN2[1]; 63 LCHILDREN = [LANG.getElementsByTagName("foo")[0], LANG.getElementsByTagName("foo")[1], LANG.getElementsByTagName("f\xf6\xf8")[0]]; 64 LCHILD1 = LCHILDREN[0]; 65 LCHILD2 = LCHILDREN[1]; 66