Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
290 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
ID: 7085034
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
ID: 7092523
what avner has said is correct and straightforward. Is there anything else that you may need avner to clarify?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 

808 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