Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xml dom char 1 object required???

From: Ivan <ivanfernandez80@-----.--->
To: NULL
Date: 4/6/2008 7:14:00 AM
On Apr 6, 1:08=A0pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> Ivan wrote:
> > Hi i am usign teh following loop to go find a note vdn and get its
> > attribut value but i am getting "char 1 object required" what's wrong
> > with that piece of code???
>
> > Thanks
>
> > var m=3DxmlDoc.documentElement.childNodes;
>
> > for (i=3D0;i<m.length;i++)
> > {
>
> > Line 277: m=3DxmlDoc.getElementsByTagName("VDN")[i].attributes;
> > var vdnarxio=3Dm.getNamedItem("id").nodeValue;
> > }
>
> Well you use m.length where m is the childNodes collection of the
> documentElement, but instead of looping through that collection you loop
> through getElementsByTagName("VDN") which is a different collection.
> Additionally you use the same variable m to assign a different
> collection, the attributes collection, that can't work.
>
> So instead of your code you should rather use e.g.
> =A0 =A0var vdnList =3D xmlDoc.getElementsByTagName("VDN");
> =A0 =A0for (var i =3D 0, l =3D vdnList.length; i < l; i++) {
> =A0 =A0 =A0var vdn =3D vdnList[i];
> =A0 =A0 =A0var id =3D vdn.getAttribute("id");
> =A0 =A0}
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/

Thanks for that :-)


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent