Skip to content

Instantly share code, notes, and snippets.

@ncb000gt
Created May 10, 2012 14:10
Show Gist options
  • Save ncb000gt/2653243 to your computer and use it in GitHub Desktop.
Save ncb000gt/2653243 to your computer and use it in GitHub Desktop.
Check for string format.
var libxml = require('libxml');
module.exports.to_string = function(assert) {
var doc1_string = [
'<?xml version="1.0" encoding="UTF-8"?>',
'<root><child to="wongfoo"/></root>',
].join("\n");
var expected_string = "<child/>";
var doc1 = libxml.parseXmlString(doc1_string);
var node = doc1.child(0).node('child');
require('util').print(node + "\n");
require('util').print(require('util').format.apply(console, [node]) + "\n");
console.log(node);
assert.equal(node.toString(), expected_string);
assert.done();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment