Skip to content

Instantly share code, notes, and snippets.

@hourback
Created July 9, 2012 19:46
Show Gist options
  • Save hourback/3078479 to your computer and use it in GitHub Desktop.
Save hourback/3078479 to your computer and use it in GitHub Desktop.
Handling XML output from Solr
var http = require('http-get');
var parser = require('libxml-to-js');
var util = require('util');
var options = {url: 'http://localhost:8080/solr/core1/dataimportdevelopment?command=status'};
var obj = (function(){
var mycallback = function (error, result) {
var xml = "";
if (error) {
console.error(error);
} else {
console.log(typeof result.buffer);
this.xml = result.buffer;
//console.log('The XML document contents: ' + xml);
}
return xml;
}
http.get(options, mycallback);
return mycallback;
})();
console.log(obj());
//console.log(xml);
/*parser(xml, function (error, result) {
if (error) {
console.error('This is the parser error: ' + error);
} else {
console.log('This is the parser result: ' + result);
}
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment