How do I store xml as a string variable in javascript?

striker1972

New Member
I trying to store a piece of xml into a string variable in javascript and in IE8 it keeps throwing an error. FireFox doesn't show the error but of course in IE8 it does. Swictching browsers isn't an option so I have to try to solve this one. The purpose of the function is to check if the items of a list exist in an xml object or not. So if there is a better way to do that check I am open to that as well. The system we pull from has a function to convert the xml to a string. At the bottom is an output of what that retrieves. Here is the function. \[code\]function commodityExists(newCommodityCode){ var comExists = new Boolean(0); newCommodityCode = ">" + newCommodityCode + "<" var strXML = 'tw.local.aribaHeader.commodities.toXMLString()'; //ERROR HERE strXML = strXML.toString(); if(strXML.indexOf(newCommodityCode,0)>0){ comExists=true; } return comExists; }; \[/code\]Here is the output from strXML.toString(); but as you can see it is essentially xml.\[code\] var strXML =
 
Back
Top