forked from yaronn/xpath.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run xpath on non document element nodes
- Loading branch information
Showing
3 changed files
with
22 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "xpath.js", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"description": "Xpath pure javascript implementation for node.js", | ||
"engines": { "node": ">=0.4.0" }, | ||
"author": "Cameron McCormack (http://mcc.id.au/xpathjs), Yaron Naveh ([email protected], http://webservices20.blogspot.com/)", | ||
"dependencies": { | ||
|
||
}, | ||
"devDependencies": { | ||
"nodeunit": ">=0.6.4", | ||
"nodeunit": ">=0.6.4" | ||
}, | ||
"repository" : { | ||
"type":"git", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var select = require('xpath.js') | ||
, dom = require('xmldom').DOMParser | ||
|
||
var xml = "<book><title>Harry Potter</title></book>" | ||
var doc = new dom().parseFromString(xml) | ||
var nodes = select(doc, "//title") | ||
console.log(nodes[0].localName + ": " + nodes[0].firstChild.data) | ||
console.log("node: " + nodes[0].toString()) |
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