Skip to content

marudor/libxmljs2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

478d57d · Jul 27, 2024
Jul 27, 2024
Jan 3, 2013
Feb 10, 2020
Aug 30, 2021
Apr 22, 2023
Aug 30, 2021
Mar 17, 2019
May 31, 2020
May 4, 2024
Nov 11, 2019
Sep 24, 2009
Mar 14, 2016
May 24, 2024
Oct 22, 2022
Oct 22, 2022
Feb 10, 2020
Jan 29, 2020
Nov 11, 2019
Jul 27, 2024
Jul 27, 2024

Repository files navigation

NO LONGER MAINTAINED

Libxmljs2

LibXML bindings for node.js This package was forked as the original one is fairly unmaintained.

var libxmljs = require('libxmljs2');
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"

Support

API and Examples

Check out the wiki http://github.com/marudor/libxmljs2/wiki.

See the examples folder.

Installation via npm

npm install libxmljs2

Contribute

Start by checking out the open issues. Specifically the desired feature ones.

Requirements

Make sure you have met the requirements for node-gyp. You DO NOT need to manually install node-gyp; it comes bundled with node.