On Apr 20, 6:37 am, Martin Honnen <mahotr...@yahoo.dewrote:
vunet...@gmail.com wrote:
I cannot append a node from XML into the HTML dom (textarea field) in
IE. But I can for the text input html elements! Is anyone aware of
this and what is the possible solution?
The XML DOM IE uses is implemented by MSXML, the HTML DOM IE uses by
MSHTML. These are separate DOM implementations and you cannot move nodes
from one implementation to the other. It usually makes no sense
attempting that anyway as XML nodes make no sense in a HTML document. IE
supports XML data islands however where you can embed XML in HTML, to do
that you need to create an HTML element with tag name 'xml' and then
that element can contain an XML DOM.
If your XML DOM contains XHTML elements and that is the reason why you
want to move the nodes into the HTML document then with IE you need to
use the serialized markup (xml property of an XML DOM node) and insert
that into the HTML DOM with innerHTML or insertAdjacentHTML.
--
Martin Honnen
http://JavaScript.FAQTs.com/
Thank you for a very good explanation. So, if I understood correctly,
if I have an XML Http Request response object named, say, myXHR, and I
would want to place one of its node values to textarea in IE, then I
would do something similar to this:
document.getElementById('myTextArea').insertAdjace ntHTML('afterBegin',
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue)
Do I need to do the same for text input elements too? Though it works
well doing this in IE (why?):
document.getElementById('myInput').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;
Thanks