.appendChild help

Posted on 2011-05-03
Last Modified: 2012-05-11
I have an xml document that has the following format (I'm leaving out the details because they aren't pertinent to my question):

I have another xml document that has the following format:

What I need to do is add the second xml document to the first xml document so I get this:

It doesn't matter whether Group2 comes before or after Group1.  I'm using the following in VB 6:
Call xmlResponse.documentElement.appendChild(xmlAssigned)

xmlResponse is document 1 and xmlAssigned is document 2.  THis gives me the following which is close but not quite what I wanted:


Can anyone help me with the correct function I need to use to get what I want?
Question by:dyarosh
    LVL 9

    Expert Comment

    Dim g2 As XmlNode = xmlResponse.CreateElement("Group2")
    'add more stuff to g2 element

    Open in new window


    Author Comment

    I received an error: object doesn't support this object or method

    Here is what I have:

    xmlResponse.documentElement.selectSingleNode("//RecordSets").appendChild (xmlAssigned)

    Any thoughts?

    Accepted Solution

    I finally discovered the correct syntax:

     For iLoop = 0 To xmlAssigned.childNodes.length - 1
            Call xmlResponse.appendChild(xmlAssigned.childNodes(0))

    Author Closing Comment

    I was finally able to find the right combination plus I didn't receive any more feedback from the experts.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    754 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

    24 Experts available now in Live!

    Get 1:1 Help Now