I am not JavaScript guru and I am hacking here...
I have a script that read a XML doc.
The script reads the node names of the first nodes
fname, lname....
If I use the variable tempNode it does not work (nothing is written to
the div.innerHTML).
if I use the variable teporName it give me the last name for all the
node (which I expected) so I am doing something wrong here. Any Ideas?
I've been searching Google all day.
background on what I am doing...
its for a form for a conference...
If I type in my first name, last name and company I will get info from
a db and populate the form for them. but if there are nodes that are
empty I need to set them to "" (a empty string) or the form won't
populate. (or I need to ship the empty node)
So I need to read the node, see if it has a value and if it does put
the value into the form. if it is empty skip it.
thanks in advance
John
script................................
var root = o.responseXML.documentElement;
nodelist = root.childNodes
words = '';
for(i = 0; i < nodelist.length; i++) {
tempNode = nodelist[i].nodeName;
teporName = 'lname';
tempValue =
root.getElementsByTagName(teporName)[0].firstChild.nodeValue;
/*tempValue =
root.getElementsByTagName(teporName)[0].firstChild.nodeValue;*/
words += i + ' ' + tempNode + ' | value = ' + tempValue + '<br
/>';
}
words += ' done.';
div.innerHTML = words;
xml.............................
−
<person>
<fname>Tracy</fname>
<lname>allman</lname>
<address1/>
<address2/>
<city_town>Plano</city_town>
<county>TX</county>
</person>
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/