A
Aziz
Hi Folks
I am trying to access an HTML code stored as CDATA section in the xml
file listed bellow:
<?xml version="1.0"?>
<results count="5">
<![CDATA[
<table><tr><td>Hello World</td></tr></table>
]]>
</results>
The xml tree is the responseXML part of an XmlHttpRequest and is stored
in a the javascript object xmldoc. While trying to test the node type
of the children of the "results"-Element I got different results with
IE and Mozilla:
xmldoc.getElementsByTagName("results")[0].childNodes[0].nodeType -->
MN=>TEXT,IE =>CDATA
xmldoc.getElementsByTagName("results")[0].childNodes[1].nodeType -->
MN=>CDATA,IE =>NULL
I added a non empty text node to the result element:
<results count="5">
blalba text
<![CDATA[...
Now I get this:
xmldoc.getElementsByTagName("results")[0].childNodes[0].nodeType -->
MN=>TEXT,IE =>TEXT
xmldoc.getElementsByTagName("results")[0].childNodes[1].nodeType -->
MN=>CDATA,IE =>CDATA
Does someone have an explanation for this behaviour?
I am using Mozilla 1.5 and IE 6
Cheers,
Aziz
I am trying to access an HTML code stored as CDATA section in the xml
file listed bellow:
<?xml version="1.0"?>
<results count="5">
<![CDATA[
<table><tr><td>Hello World</td></tr></table>
]]>
</results>
The xml tree is the responseXML part of an XmlHttpRequest and is stored
in a the javascript object xmldoc. While trying to test the node type
of the children of the "results"-Element I got different results with
IE and Mozilla:
xmldoc.getElementsByTagName("results")[0].childNodes[0].nodeType -->
MN=>TEXT,IE =>CDATA
xmldoc.getElementsByTagName("results")[0].childNodes[1].nodeType -->
MN=>CDATA,IE =>NULL
I added a non empty text node to the result element:
<results count="5">
blalba text
<![CDATA[...
Now I get this:
xmldoc.getElementsByTagName("results")[0].childNodes[0].nodeType -->
MN=>TEXT,IE =>TEXT
xmldoc.getElementsByTagName("results")[0].childNodes[1].nodeType -->
MN=>CDATA,IE =>CDATA
Does someone have an explanation for this behaviour?
I am using Mozilla 1.5 and IE 6
Cheers,
Aziz