I need to parse an XML/HTML file within the cloud-code of parse.com.
I've got a string which contains the source-code of the html file.
I've already tried multiple frameworks like jsdom etc, but nothing seems to work in the Parse.com-cloudcode environment.
This code for example results in an error in the jsdom-file. But I've got no idea what the real problem is. Because the "<" ">" tags are set correctly in the jsdom.js-file.
var jsdom = require("cloud/jsdom.js");
var window = jsdom.jsdom().createWindow();
var jquery = require("cloud/jquery-1.11.2.min.js")(window);
var dataHtml = httpResponse.text;
response.success(jquery.$(dataHtml).find("body").text());
Error:
{"code":141,"error":"Error: Uncaught SyntaxError: Unexpected token \u003c in jsdom.js:5\n at Object.Parse.Cloud.httpRequest.success (main.js:9:21)
Is there another possibility to parse a string with XPath or dom in the parse.com-cloudcode?