[Greasemonkey] DOMParser and element attributes

chris feldmann cfeldmann at gmail.com
Thu Jul 14 00:10:41 EDT 2005

fuck. I always have to reply to myself to clarify my unclear ass.

Anyway, those last two are in a loop so 
But I get
Error: googleSez.getElementsByTagName("c").getAttribute is not a function

On 7/13/05, chris feldmann <cfeldmann at gmail.com> wrote:
> OK I've got a DOMParser object parsing the XML I get back from google's 
> spellcheck server (www.l.google.com <http://www.l.google.com> - 
> <> according to ethereal, fyi) and I 
> want to get the attributes out. I thought maybe someone here could save me 
> from what is so far a fruitless search. Anyway, I get this from google 
> (sending '*thisr anotther spelling sspeling*')
> *<?xml version="1.0"?>*
> *<spellresult error="0" clipped="0" charschecked="32">*
> *	<c o="0" l="5" s="0">this	Thurs	theirs	those	theist</c>*
> *	<c o="6" l="8" s="1">another	anther	norther	Anthe	Anthea</c>*
> *	<c o="24" l="8" s="1">spelling	sapling	spieling	spilling	spoiling</c>*
> *</spellresult>*
> I want those ordinal and length values. I get the spellresults with this 
> (response loaded into var xmlString):
> 		*var* parser = *new* DOMParser();
> 		*var* googleSez = parser.parseFromString(xmlString, 'application/xml');
> 		*var* replyBlox = googleSez.getElementsByTagName('c');
> And then try various things such as this:
> 		*replyBlox.setAttribute('ordinal', googleSez.getElementsByTagName('c').getAttribute('o'));*
> 		*replyBlox.setAttribute('letters', googleSez.getElementsByTagName('c').getAttribute('l'));*
> ...which does not work, just as nothing else so far has. Can anyone tell 
> me what will? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050713/0b4ea01d/attachment.htm

More information about the Greasemonkey mailing list