Created
March 10, 2010 15:29
-
-
Save chihchun/327980 to your computer and use it in GitHub Desktop.
test xpath of libxmljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'); | |
var libxml = require("./modules/libxmljs"); | |
var doc = libxml.parseXmlString("<html><head><link rel='alternate' title='rss' href='rss' /></head><body><link rel='alternate' title='foo' href='bar' /></body></html>"); | |
var elems = doc.get ('//head'); | |
elems = elems.find('.//link'); | |
for (var i in elems) { | |
sys.puts(elems[i].path()); | |
sys.puts(elems[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment