When you get the data, then parse:
> var lang = new DOMParser().parseFromString(response.responseText,
> "text/xml").getElementsByTagName('title')[0].getAttribute('lang');
Modified example from http://wiki.greasespot.net/GM_xmlhttpRequest:
> GM_xmlhttpRequest({
> method: "GET",
> url: "http://www.example.net/",
> headers: {
> "User-Agent": "Mozilla/5.0", // If not specified,
> navigator.userAgent will be used.
> "Accept": "text/xml" // If not specified, browser defaults
> will be used.
> },
> onload: function(response) {
> // Inject responseXML into existing Object (only appropriate for XML
> content).
> if (!response.responseXML) {
> response.responseXML = new DOMParser()
> .parseFromString(response.responseText, "text/xml");
> }
> * // create response.lang
> ** response.lang =
> response.responseXML.getElementsByTagName('title')[0].getAttribute('lang');
> *
> GM_log([
> response.status,
> response.statusText,
> response.readyState,
> response.responseHeaders,
> response.responseText,
> response.finalUrl,
> response.responseXML,
> *response.lang,
> * ].join("\n"));
> }
> });
2012/8/8 Valentine S. <[email protected]>
> 1. Show your code.
> 2. Did you manage to get the data?
>
>
> 2012/8/8 awesome <[email protected]>
>
>> sorry.. i lol, what i meant was:
>>
>>
>> <book category="cooking">
>> <title lang="en">Everyday Italian</title>
>> <author>Giada De Laurentiis</author>
>> <year>2005</year>
>> <price>30.00</price>
>> </book>
>>
>> This isn't the XML file i'm trying to parse, that has sensitive data, but
>> i can assure you it's structured properly.. it's stored online on my
>> server, i've already set the XML's url as a variable called path_to_xml,
>> and i honestly have no idea if i'm using a regular expression or DOM.. I
>> tried modifying the sample code from the GM_xmlhttpRequest wiki page
>> here<http://wiki.greasespot.net/GM_xmlhttpRequest>.
>> It didn't work.. and no, i'm not using JQuery.
>>
>> Thank you for the reply!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "greasemonkey-users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/greasemonkey-users/-/2kGRMNHKf-4J.
>>
>> 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.
>>
>
>
>
> --
> Валентин Сарычев, +79629250516
> http://valentine-sarychev.moikrug.ru/
>
>
--
Валентин Сарычев, +79629250516
http://valentine-sarychev.moikrug.ru/
--
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.