Solved

Is it possible to using the appendchild method to load and external xml file to apend to the existing XML node

Posted on 2002-06-17
4
287 Views
Last Modified: 2010-08-05
Is it possible to using the appendchild method to load and external xml file to apend to the XML node
we specify in the program? Currently the normal way to do that is to create appropriate element, createTextNode
assign text to the element and finally using the node appendchild method to append the new record in.

 xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
 xmlDoc.async = false;
 xmlDoc.load("tree/tree.xml");
 entity = xmlDoc.documentElement.selectSingleNode("//entity[@id='" + parentEntityID +"']");
 newEntity = xmlDoc.createElement("entity");
 attribute = xmlDoc.createAttribute("id");
 attribute.text = document.uniqueID;
 newEntity.attributes.setNamedItem(attribute);
 element = xmlDoc.createElement(entity.childNodes(0).baseName);
 element.text = '123';
 newEntity.appendChild(element);
 element = xmlDoc.createElement(entity.childNodes(1).baseName);
 element.text = 'images/paper.gif';
 newEntity.appendChild(element);
 element = xmlDoc.createElement(entity.childNodes(2).baseName);
 element.text = 'images/paper.gif';
 newEntity.appendChild(element);
 entity.selectSingleNode("contents").appendChild(newEntity);


is it another way where i can load the external XML file to append to the node in entity?
0
Comment
Question by:munchun
4 Comments
 
LVL 14

Accepted Solution

by:
avner earned 100 total points
Comment Utility
using MSXML you can use :

xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
xmlDoc.loadXML("<ROOT><CHILD>text</CHILD></ROOT>");

Then you can append this object :
xmlDoc.documentElement , to some other element.


0
 
LVL 23

Expert Comment

by:b1xml2
Comment Utility
what avner has said is correct and straightforward. Is there anything else that you may need avner to clarify?
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now