XML nodeValue problem

T

travellerw

Ok I'm just about to go crazy. I have been working on this issue for
hours and just can't seem to pinpoint it.

So here is the problem. I'm using the XMLHttpRequest to read in an xml
file, then I would like to write the values of a node out to a
document. Everything seems to work fine, and I get the value only it
seems to be adding a space before and after the value.

Example:
code would be
var value = divNode.firstChild.nodeValue;
document.write ("The Value is:"+value+"_key")
document.writeln ("<br>")

and the output would be
The Value is: Sales_items _key

instead of

The Value is:Sales_items_key

This is a huge issue for me, as I would like to use the value to pass
as a variable in another function. Below is a copy of the source and
the xml file

--------------------- SOURCE --------------------------------
if (req.readyState == 4)
{
// Make sure the status is "OK"
if (req.status == 200)
{
var headerNode =
req.responseXML.getElementsByTagName('resize').item(0)
var change =
headerNode.getElementsByTagName('divs');

for (var i=0;i<=change.length;i++)
{
var divNode = change.item(i);
var value = divNode.firstChild.nodeValue;
document.write ("The Value is:"+value+"_key")

---------------------------XML-------------------------------------------------
<Affected_Divs>
<resize>
<divs>sales_items</divs>
<divs>search_items</divs>
<divs>button_items</divs>
<divs>layaway_buttons</divs>
<divs>refund_buttons</divs>
<divs>customer_buttons</divs>
</resize>
<hide>
<divs>Travis</divs>
<divs>Rhonda</divs>
</hide>
</Affected_Divs>


Any help would be greatly appreciated.
document.writeln ("<br>")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top