Permalink
Browse files

add syntax highlight to README.md

  • Loading branch information...
1 parent db95d1c commit 285040fea7856d52d50cb3e5c961c52cde9c2248 @defunctzombie defunctzombie committed Mar 30, 2012
Showing with 17 additions and 15 deletions.
  1. +17 −15 README.md
View
@@ -3,26 +3,28 @@
LibXML bindings for [node.js](http://nodejs.org/)
- var libxmljs = require("libxmljs");
- var xml = '<?xml version="1.0" encoding="UTF-8"?>' +
- '<root>' +
- '<child foo="bar">' +
- '<grandchild baz="fizbuzz">grandchild content</grandchild>' +
- '</child>' +
- '<sibling>with content!</sibling>' +
- '</root>';
+```javascript
+var libxmljs = require("libxmljs");
+var xml = '<?xml version="1.0" encoding="UTF-8"?>' +
+ '<root>' +
+ '<child foo="bar">' +
+ '<grandchild baz="fizbuzz">grandchild content</grandchild>' +
+ '</child>' +
+ '<sibling>with content!</sibling>' +
+ '</root>';
- var xmlDoc = libxmljs.parseXmlString(xml);
+var xmlDoc = libxmljs.parseXmlString(xml);
- // xpath queries
- var gchild = xmlDoc.get('//grandchild');
+// xpath queries
+var gchild = xmlDoc.get('//grandchild');
- console.log(gchild.text()); // prints "grandchild content"
+console.log(gchild.text()); // prints "grandchild content"
- var children = xmlDoc.root().childNodes();
- var child = children[0];
+var children = xmlDoc.root().childNodes();
+var child = children[0];
- console.log(child.attr('foo').value()); // prints "bar"
+console.log(child.attr('foo').value()); // prints "bar"
+```
## Basics

0 comments on commit 285040f

Please sign in to comment.