3 <title>Traversal Test</title>
7 <h2>XML doc elements:</h2>
8 <div style="font-family: Courier; font-size: 14;">
9 <script type="text/javascript" charset="utf-8">
11 if (window.testRunner)
12 testRunner.dumpAsText();
14 var dataURL = 'resources/node-iterator-009-data.xml';
17 var request = new XMLHttpRequest();
18 request.open("GET", dataURL, false /* sync */);
19 request.overrideMimeType("application/xml");
22 if (request.readyState == 4) {
24 if (request.status == 200 || (request.status == 0 && request.responseText.length > 0))
25 walkXML(request.responseXML);
29 function testNodeFiter(n)
31 if (n.tagName == 'studio') return NodeFilter.FILTER_SKIP;
32 return NodeFilter.FILTER_ACCEPT;
35 function walkXML(xmlDoc)
37 var iter = document.createTreeWalker(xmlDoc, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
39 while (curNode = iter.nextNode()) {
40 document.write('<h3>' + curNode.tagName + '</h3><p>' + curNode.textContent + '</p>');