[Javascript] AJAX: Reading the XML file

John Warner john at jwarner.com
Fri Feb 9 08:41:24 CST 2007


Have you considered checking for NULL before making the assignment?

John Warner


> -----Original Message-----
> From: javascript-bounces at LaTech.edu 
> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Michael Borchers
> Sent: Friday, February 09, 2007 4:08 AM
> To: javascript at LaTech.edu
> Subject: [Javascript] AJAX: Reading the XML file
> 
> 
> I receive the following XML file and want to parse it into a 
> form input 
> f.e.:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <product>
> <products_name>Dienstleistungen Layout, 
> Redaktion</products_name> <products_price>1300.00</products_price>
> <products_description></products_description>
> </product>I tried it his way and it works fine as long the 
> products_descriptionis not empty, but otherwise, like in this 
> case above, it 
> won't work: var product              = 
> productsRequest.responseXML.getElementsByTagName('product').it
> em(0); var 
> productDescription   = 
> product.getElementsByTagName('products_description').item(0).f
> irstChild.data;which 
> ist the "finest" way to read out my XML file?!thanks 
>





More information about the Javascript mailing list