Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "xpath", | ||
"version": "0.0.1", | ||
"description": "Xpath pure javascript implementation for node.js", | ||
"version": "0.0.2", | ||
"description": "xpath evaluate and select.", | ||
"engines": { | ||
"node": ">=0.4.0" | ||
"node": ">=0.6.0" | ||
}, | ||
"author": { | ||
"name": "Cameron McCormack", | ||
"url": "http://mcc.id.au/xpathjs" | ||
"name": "goto100" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"nodeunit": ">=0.6.4" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/yaronn/xpath.js.git" | ||
"url": "https://github.com/goto100/xpath.git" | ||
}, | ||
"main": "./xpath.js", | ||
"directories": {}, | ||
"keywords": [ | ||
@@ -31,5 +26,4 @@ "xpath", | ||
} | ||
], | ||
"readme": "## xpath.js\r\nAn xpath module for node, written in pure javascript.\r\n\r\nOriginally written by Cameron McCormack ([blog](http://mcc.id.au/xpathjs)). \r\n\r\nPrepared as a node module by Yaron Naveh ([blog](http://webservices20.blogspot.com/)).\r\n\r\n## Install\r\nInstall with [npm](http://github.com/isaacs/npm):\r\n\r\n npm install xpath.js\r\n\r\nxpath.js is xml engine agnostic but I recommend to use [xmldom](https://github.com/jindw/xmldom):\r\n\r\n npm install xmldom\r\n\r\n\r\n## Your first xpath:\r\n`````javascript\r\n\tvar select = require('xpath.js')\r\n\t , dom = require('xmldom').DOMParser\r\n\r\n\tvar xml = \"<book><title>Harry Potter</title></book>\"\r\n\tvar doc = new dom().parseFromString(xml) \r\n\tvar nodes = select(doc, \"//title\")\r\n\tconsole.log(nodes[0].localName + \": \" + nodes[0].firstChild.data)\r\n\tconsole.log(\"node: \" + nodes[0].toString())\r\n`````\r\n-->\r\n\r\n\ttitle: Harry Potter\r\n\tNode: <title>Harry Potter</title>\r\n\r\n## Get text values directly\r\n`````javascript \r\n var xml = \"<book><title>Harry Potter</title></book>\"\r\n var doc = new dom().parseFromString(xml) \r\n var title = select(doc, \"//title/text()\")[0].data \r\n console.log(title)\r\n````` \r\n-->\r\n \r\n Harry Potter\r\n\r\n## Namespaces\r\n`````javascript \r\n\tvar xml = \"<book><title xmlns='myns'>Harry Potter</title></book>\"\r\n var doc = new dom().parseFromString(xml) \r\n var node = select(doc, \"//*[local-name(.)='title' and namespace-uri(.)='myns/']\")[0]\r\n console.log(node.namespaceURI)\r\n`````\r\n-->\r\n \r\n myns\r\n\t\r\n## Attributes\r\n`````javascript \r\n var xml = \"<book author='J. K. Rowling'><title>Harry Potter</title></book>\"\r\n var doc = new dom().parseFromString(xml) \r\n var author = select(doc, \"/book/@author\")[0].value \r\n console.log(author)\r\n`````\r\n-->\r\n \r\n J. K. Rowling\r\n" | ||
] | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
126519