JSPM

  • Created
  • Published
  • Downloads 50426
  • Score
    100M100P100Q151177F

libxml bindings for v8 javascript engine

Package Exports

  • libxmljs
  • libxmljs/lib/element

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (libxmljs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Libxmljs

Build Status

LibXML bindings for node.js

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.parseXml(xml);

// xpath queries
var gchild = xmlDoc.get('//grandchild');

console.log(gchild.text());  // prints "grandchild content"

var children = xmlDoc.root().childNodes();
var child = children[0];

console.log(child.attr('foo').value()); // prints "bar"

Basics

API and Examples

Check out the wiki http://github.com/polotek/libxmljs/wiki.

See the examples folder.

Requirements

You will need have the libxml2 library installed and also the libxml2-devel (libxml2-dev on debian systems) package. This comes with the xml2-config utility that is needed for compiling. This command must be in your path.

Installation

npm

npm install libxmljs

source

To build with node-gyp:

node-gyp configure
node-gyp build

Alternatively, run make.

tests

npm test