How to Change method in XML DOM
In this articles i am going to explain about how to use XML DOM Change node.
We change value of an element in DOM
DOM is a collection of node, and DOM node do not have a text value.
The text node is store the value in a child node.
Node text is the way to get the value of the child node.
The getElementsByTagName() method returns a node list.
Node list containing all elements in same order as they appear source documents.
We change the value in a text node
The nodeValue property is used to change the value of a text node.
The following code changes the text node value:
xmlDoc = loadXMLDoc("library.xml");
a = xmlDoc.getElementsByTagName("title").childNodes;
a.nodeValue = "C# Language";
Define the code
- First we create XML http object and open it.
- XML http script send the request to the server.
- "loadxmldoc.html" get the data.
- Set the response as an XML DOM object.
- Document. write is print the document
- Change the node value of the text node to "C# language"
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here