Skip to content

Instantly share code, notes, and snippets.

@chihchun
Created March 10, 2010 15:29
Show Gist options
  • Save chihchun/327980 to your computer and use it in GitHub Desktop.
Save chihchun/327980 to your computer and use it in GitHub Desktop.
test xpath of libxmljs
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