0 down vote favorite
share [g+] share [fb] share [tw]

I'm working on a Greasemonkey script that will download an XML file
via GM_xmlhttpRequest, do some Regex work on it, then convert is back
into an XML object and post it back to the website, again, with
GM_xmlhttpRequest.

I have successfully been able to download the XML file, but I can't
convert it to an XML object.

    downloadedXML.toString();
    downloadedXML = downloadedXML.replace(/<\?xml.+\?>/, "");
    downloadedXML = downloadedXML.replace(/sometag>/g, "anothertag>");
    downloadedXML=new XML(downloadedXML);

This code works fine when it's in a webpage and I copy/paste the XML
into a text box manually and copy the text box contents into the
downloadedXML variable, but in Greasemonkey it throws a fit, saying:

Error: uncaught exception: ReferenceError: xml is not defined

Or, if I switch new XML(downloadedXML); to
downloadedXML.toXmlString(); it gives me:

Error: uncaught exception: TypeError: downloadedXML.toXmlString is not
a function

I'm not sure what's happening or how to fix this. Googling around
doesn't give me any results of people with a similar problem.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to