I am trying to access the body of an external HTML page with jquery. The body of that page contains an XML structure, which I would like to transform to JSON for further data accessing.
$.ajax({
url:'http://pruebanico.comze.com/testxml.html',
dataType:'html',
type:'POST',
timeout:20000,
success:function(response, status) {
var xmlDoc = $.parseXML(response);
xmlBody = xmlDoc.find('body');
alert(xmlBody);
var jsonString = xml2json(xmlBody, '', html);
alert(jsonString);
}
I am using the following xml2json converter: http://www.thomasfrank.se/xml_to_json.html.
The first alert (xmlBody) is empty. I wanted to parse the text content of the body to a valid XML structure as input for the xml2json function, but without much success.