Created
July 9, 2012 19:46
-
-
Save hourback/3078479 to your computer and use it in GitHub Desktop.
Handling XML output from Solr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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