473,738 Members | 7,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3297
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 insertAdjacentH TML.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 20 '07 #2
On Apr 20, 6:37 am, Martin Honnen <mahotr...@yaho o.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 insertAdjacentH TML.

--

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.getEle mentById('myTex tArea').insertA djacentHTML('af terBegin',
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue)

Do I need to do the same for text input elements too? Though it works
well doing this in IE (why?):

document.getEle mentById('myInp ut').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;

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.getEle mentById('myTex tArea').insertA djacentHTML('af terBegin',
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue)
For textarea element I would not bother with insertAdjacentH TML, text
controls have a value property to set the text so simply use that as you
do below.

document.getEle mentById('myInp ut').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;
insertAdjacentH TML 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...@yaho o.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.getEle mentById('myTex tArea').insertA djacentHTML('af terBegin',
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue)

For textarea element I would not bother with insertAdjacentH TML, text
controls have a value property to set the text so simply use that as you
do below.
document.getEle mentById('myInp ut').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;

insertAdjacentH TML 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...@yaho o.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.getEle mentById('myTex tArea').insertA djacentHTML('af terBegin',
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue)

For textarea element I would not bother with insertAdjacentH TML, text
controls have a value property to set the text so simply use that as you
do below.
document.getEle mentById('myInp ut').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;

insertAdjacentH TML makes sense for elements like div or span elements.

--

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

document.getEle mentById('myTex tarea').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;

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.getEle mentById('myTex tarea').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;

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.contac t" <scripts.cont.. .@gmail.com>
wrote:
vunet...@gmail. com wrote:
document.getEle mentById('myTex tarea').value =
myXHR.documentE lement.getEleme ntsByTagName("s omenode")
[0].firstChild.nod eValue;
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
"Descriptio n" name

document.getEle mentById('Descr iption').value =
myXHR.documentE lement.getEleme ntsByTagName("D escription")
[0].firstChild.nod eValue;

Apr 23 '07 #8

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

Similar topics

7
2794
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 am doing wrong?
2
8517
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(); win.document.body.appendChild(clonedNode); } I am trying to display a table with id="myTable" in a new window. IE6
3
1893
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 replace the <pre> node in question with a new <pre> node that has the extended content. But the existing content is longish, and it seems to me wasteful to rewrite it all just to have a small amount of text tacked on to the end. Is there a way to...
3
4296
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 XSLT. Here is background on Typed DataSet: Using Annotations with a Typed DataSet http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconUsingAnnotationsWithTypedDataSet.asp I need to append an attribute a specific XML...
2
1306
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 button it says that it is output is undefined Main File --------------------------------------------------------------------- <html> <head><title>
4
3419
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: <MainNode> <Value>First Value</Value> </MainNode>
4
8282
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 problems and this one is really getting to me... I have a page that allows you to Browse Authors. There are three drop down boxes that auto-populate via AJAX. I have a file which it calls and returns the dynamically built XML file in the boxes...
9
1860
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 simple function to determine a path between two nodes. It takes a graph and the start and end nodes as arguments. It will return a list of nodes (including the start and end nodes) comprising the path. When no path can be found, it returns None....
7
3356
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 (container.appendChild(this.toolbar);) saying "Node cannot be inserted at the specified point in the hierarchy" code: "3" I have two questions: - who would help me with this error - please provide other feedback about my code, since I want to write a solid...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.