472,807 Members | 5,240 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,807 software developers and data experts.

Cannot append a node from XML into the HTML dom in IE

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?
Thanks.

Apr 19 '07 #1
7 3247
vu******@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/
Apr 20 '07 #2
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

Apr 20 '07 #3
vu******@gmail.com wrote:
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)
For textarea element I would not bother with insertAdjacentHTML, text
controls have a value property to set the text so simply use that as you
do below.

document.getElementById('myInput').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;
insertAdjacentHTML makes sense for elements like div or span elements.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 20 '07 #4
On Apr 20, 10:09 am, Martin Honnen <mahotr...@yahoo.dewrote:
vunet...@gmail.com wrote:
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)

For textarea element I would not bother with insertAdjacentHTML, text
controls have a value property to set the text so simply use that as you
do below.
document.getElementById('myInput').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;

insertAdjacentHTML makes sense for elements like div or span elements.

--

Martin Honnen
http://JavaScript.FAQTs.com/
That's the problem. I am unable to use value for textarea in IE. Maybe
I am doing something wrong?...

Apr 20 '07 #5
On Apr 20, 10:09 am, Martin Honnen <mahotr...@yahoo.dewrote:
vunet...@gmail.com wrote:
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)

For textarea element I would not bother with insertAdjacentHTML, text
controls have a value property to set the text so simply use that as you
do below.
document.getElementById('myInput').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;

insertAdjacentHTML makes sense for elements like div or span elements.

--

Martin Honnen
http://JavaScript.FAQTs.com/
In other words, when I do

document.getElementById('myTextarea').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;

I cannot see anything in that textarea in IE6, but I see it in text
input field. Moreover, when I use some function to grab value of
textarea (which is invisible in my IE), it exists and can be passed on
to another function... That was the problem of my question. If anyone
can suggest anythiing, please let me know.
Thank you

Apr 20 '07 #6
vu******@gmail.com wrote:
document.getElementById('myTextarea').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;

I cannot see anything in that textarea in IE6, but I see it in text
input field.
textarea is a TEXT area. You cant add HTML content in a TEXTarea.

Apr 21 '07 #7
On Apr 20, 11:29 pm, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
vunet...@gmail.com wrote:
document.getElementById('myTextarea').value =
myXHR.documentElement.getElementsByTagName("someno de")
[0].firstChild.nodeValue;
I cannot see anything in that textarea in IE6, but I see it in text
input field.

textarea is a TEXT area. You cant add HTML content in a TEXTarea.
And the answer is: This does not work in my IE6 because of
"Description" name

document.getElementById('Description').value =
myXHR.documentElement.getElementsByTagName("Descri ption")
[0].firstChild.nodeValue;

Apr 23 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Robert Mark Bram | last post by:
Hi All! In the code below, I am reading in an xhtml document and attempting to use selectNodes to find a <p id="rmb"> node.. But the result is: 2 - */* 0 - */p Can anyone suggest what I...
2
by: Michael Lee | last post by:
Does anyone know why the following function works in FireFox but not in IE6? function ShowTable() { clonedNode = document.getElementById("myTable").cloneNode(true); win = window.open();...
3
by: J Krugman | last post by:
This question refers to the DOM. I would like to dynamically append some small amount of text to the all-text content of a <pre> node. I suppose that I could extract the existing content, and...
3
by: David Elliott | last post by:
I wrote an application to scrape a database and create an XSD file which will be annotated by a map file in order to create a Typed DataSet. I was wondering if I could do the annotation using...
2
by: tepaul | last post by:
I am new to the DOM, but i try to figure out this simple tutorial on the book, and make it extractly the same as it is written. but when I run the program it okay, but when I click on the covert...
4
by: glbdev | last post by:
Hi, I posted this in "microsoft.public.xml.msxml-webrelease" but now realize it should probably have been in the ASP group. Sorry if that causes any problems. I have an XML document like:...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
9
by: reachmsn | last post by:
Hi, At the url http://www.python.org/doc/essays/graphs.html there is some code by Guido Van Rossum for computing paths through a graph - I have pasted it below for reference - Let's write a...
7
by: dennis.sprengers | last post by:
I am trying to write an editor object, which adds some functionality and a toolbar to every textarea with a "form-textarea" class. Both FF and IE generate an error in line 20...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.