This Meteor package wraps the libxmljs npm package.
meteor add csats:libxmljs
This package exports XML
. Example usage:
if (Meteor.isServer) {
var xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
+ '<QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd">\n'
+ ' <Answer>\n'
+ ' <QuestionIdentifier>Q2</QuestionIdentifier>\n'
+ ' <FreeText>Change your thoughts and you change the world.</FreeText>\n'
+ ' </Answer>\n'
+ '</QuestionFormAnswers>\n';
// Warning: synchronous!
var xmlDoc = XML.parseXml(xml);
var actual = xmlDoc.get('//xmlns:FreeText', 'http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd').text();
var expected = 'Change your thoughts and you change the world.';
var assert = Npm.require('assert');
assert.equal(actual, expected);
}
Sorry, this package doesn't work on Windows. see polotek/libxmljs#309.
- upstream npm package
- perak:xmlkit - provides older version of libxmljs and also provides node_xslt
MIT