Mister Fanwank
unread,Feb 19, 2012, 10:59:12 PM2/19/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to greasemonkey-users
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.