Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:32:23+00:00 2026-06-03T07:32:23+00:00

I receive 2 XML files from a third party service every day and I

  • 0

I receive 2 XML files from a third party service every day and I need to combine them using VBS as it is the only available technology on the server that consumes the XML. Each of the XML files has the same structure –

<section>
    <lot>
        <number>8</number>
        <identifier>au23-zx78a</identifier>
    </lot>
    <lot>
        <number>23</number>
        <identifier>au23-zx78a</identifier>
    </lot>
    ...and so on...
</section>

I need to take all of the lot nodes (including any and all children) from file 1 and insert them into file 2 before saving file 2 to be consumed by another service. Using VBS.

I have searched the web and I have found ways to get a node out using VBS but I am lost on getting the nodes into another file. I have written and scrapped 3 or 4 scripts today because I have not been able to get it right.

I know that the logic is this –

load file 1,
load file 2,
get the lot nodes from file 1,
loop through the lot nodes from file 1 and append them as children of the section node in file 2,
save file 2

Can anyone help me by pointing me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:32:25+00:00Added an answer on June 3, 2026 at 7:32 am

    Here’s a simple way of doing it: load both xml files into MSXML2.DomDocument objects, select all the lot nodes from the first document, clone them and insert them into the second document.

    option explicit
    
    ' collect xml file paths from the command line
    dim xmlpath1: xmlpath1 = WScript.Arguments(0)
    dim xmlpath2: xmlpath2 = WScript.Arguments(1)
    
    ' open up the xml files, this might need some error handling
    dim xmldoc1: set xmldoc1 = CreateObject("MSXML2.DomDocument")
    xmldoc1.async = false
    xmldoc1.load xmlpath1
    xmldoc1.setProperty "SelectionLanguage", "XPath"
    dim xmldoc2: set xmldoc2 = CreateObject("MSXML2.DomDocument")
    xmldoc2.async = false
    xmldoc2.load xmlpath2
    
    ' get a collection of lot nodes
    dim lots: set lots = xmldoc1.selectNodes("/section/lot")
    ' loop through each lot, clone it and add it to the second document
    dim lot
    for each lot in lots
        dim l: set l = lot.cloneNode(true)
        xmldoc2.documentElement.appendChild l
    next
    
    ' overwrite the second document
    xmldoc2.save xmldoc2.url
    

    The script (if called merge-xml.vbs) would be run from the command line

    cscript merge-xml.vbs xml1.xml xml2.xml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to parse a XML file which I get from third party to
I receive some xml-files with embedded base64-encoded images, that I need to decode and
I'm using AJAX to receive an XML response, which I then need to manipulate.
I am having some issues receiving UTF-8 XML files back from DHL API. As
I have used this command to send xml files to a web service named
I am uploading files from local to FTP using perl Net::FTP Module. After uploading
I am using NSXmlParser to extract a string from an XML file. The xml
I'm attempting to receive a response from a restful service, but receive a timeout.
From a XML file I receive decimals on the format: 1.132000 6.000000 Currently I
I will receive an XML from Server, and have to parse the xml file,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.