Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Evaluating an XPath Expression in the browser (tested in Firefox)
- // For Cross-Browser stuff, check the small library Sarissa.js (http://dev.abiss.gr/sarissa/)
- var doc = new DOMParser().parseFromString("<root><a>A<b/>A<c/></a><b/></root>", "text/xml")
- var iterator = doc.evaluate('//b', doc.documentElement, null,XPathResult.ANY_TYPE, null );
- console.log(iterator)
- try {
- var thisNode = iterator.iterateNext();
- while (thisNode) {
- console.log( thisNode );
- thisNode = iterator.iterateNext();
- }
- }
- catch (e) {
- dump( 'Error: Document tree modified during iteration ' + e );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement