Reputation: 3614
I'm having one strange issue in IE 11 while developing custom app that talk to backend service via xml.
The strange thing is that both firefox and chrome can parse the response that I receive, but IE fails,, and I'm completely lost..
If someone can take a look I would be very appreciative.
I'll post example reponse from server,, cuted version of xml doc,, but you'll get the idea
<root>
<wizardhead>
<inputparametar/>
<outputparametar>69439</outputparametar>
<iserror/>
<repeaterror/>
<errormessage/>
<actionstorename>dbo.ncspWizardExec</actionstorename>
<wizardname>459570</wizardname>
</wizardhead>
</root>
the peace of code that parses that xml to extract the values for particular use is here:
window.ro = ro; // var ro is the source XML as string (saving to global var just for ease of testing)
var fnd = document.getElementsByTagName.bind( ro ); // bind 'gebtn' on ro document
var hdd = fnd('wizardhead')[0] ; // reference wizardhead WORKS
var hd2 = hdd.getElementsByTagName('outputparametar')[0].innerHTML; // this FAILS!
the error that I see in developer tools (F12) is on line where I need to compare the hd2 value:
like this => ... (1 == hd2.toString() )
Unable to get property 'toString' of undefined or null reference
Watches panel in devtools show that current env vars are like..
hdd => [object Element]
hd2 => undefined
thanks, oserk
Upvotes: 3
Views: 3451
Reputation: 3614
Ok guys,, couple a days after .. I found solution to my problem!
Hope that's gonna help someone with similar issues :)
Reading through w3c docs here: w3c docs I found out that I can reference elements in two ways..
element = collection.item(index)
element = collection[index]
so I applied that to my code ,, for example this line
var hd2 = hdd.getElementsByTagName('outputparametar')[0].innerHTML
to be called like this:
var hd2 = hdd.getElementsByTagName('outputparametar').item(0).textContent
and you see, it worked :)
So I guess IE has some issues with the way it parses and references child nodes with index of maturity > 1 (cose it parses successfully first level!) but got some permission issues inside dom somehow..
OK, lesson learned, use second method instead and we're free of cross browser issues,, for now, at least :)
cheers, k
Upvotes: 2