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 676205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:54:09+00:00 2026-05-14T00:54:09+00:00

I’m using classic ASP in my project. I want to merge two XMLs together.

  • 0

I’m using classic ASP in my project. I want to merge two XMLs together. How do I do this? Below is my sample code:

XML 1

<CATALOG>
<CD>
  <TITLE>1</TITLE> 
  <ARTIST>Bob Dylan</ARTIST> 
  <COUNTRY>USA</COUNTRY> 
  <COMPANY>Columbia</COMPANY> 
  <PRICE>10.90</PRICE> 
  <YEAR>1985</YEAR> 
</CD>
<CD>
  <TITLE>2</TITLE> 
  <ARTIST>Bonnie Tyler</ARTIST> 
  <COUNTRY>UK</COUNTRY> 
  <COMPANY>CBS Records</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1988</YEAR> 
</CD>
<CD>
  <TITLE>3</TITLE> 
  <ARTIST>Dolly Parton</ARTIST> 
  <COUNTRY>USA</COUNTRY> 
  <COMPANY>RCA</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1982</YEAR> 
</CD>
</CATALOG>

XML2

<CATALOG>
<CD>
  <TITLE>4</TITLE> 
  <ARTIST>Gary Moore</ARTIST> 
  <COUNTRY>UK</COUNTRY> 
  <COMPANY>Virgin records</COMPANY> 
  <PRICE>10.20</PRICE> 
  <YEAR>1990</YEAR> 
</CD>
<CD>
  <TITLE>5</TITLE> 
  <ARTIST>Eros Ramazzotti</ARTIST> 
  <COUNTRY>EU</COUNTRY> 
  <COMPANY>BMG</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1997</YEAR> 
</CD>
<CD>
  <TITLE>6</TITLE> 
  <ARTIST>Bee Gees</ARTIST> 
  <COUNTRY>UK</COUNTRY> 
  <COMPANY>Polydor</COMPANY> 
  <PRICE>10.90</PRICE> 
  <YEAR>1998</YEAR> 
</CD>
</CATALOG>

This is ASP code I currently use:

Dim doc1      ''# As MSXML2.DOMDocument30
Dim doc2      ''# As MSXML2.DOMDocument30
Dim doc2Node  ''# As MSXML2.IXMLDOMNode

Set doc1 = createobject("MSXML2.DOMDocument.3.0")
Set doc2 = createobject("MSXML2.DOMDocument.3.0")

doc1.Load "01.xml"
doc2.Load "02.xml"

For Each doc2Node In doc2.documentElement.childNodes 
 doc1.documentElement.appendChild doc2Node
Next

response.write  doc1.xml

But now I’m getting an error:

Microsoft VBScript runtime error '800a01a8' 

Object required: 'documentElement'
  • 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-05-14T00:54:09+00:00Added an answer on May 14, 2026 at 12:54 am

    Expanding on Jørn Schou-Rode’s answer:

    <%
    Dim doc1    'As MSXML2.DOMDocument30
    Dim doc2    'As MSXML2.DOMDocument30
    Dim doc2Node    'As MSXML2.IXMLDOMNode
    
    Set doc1 = createobject("MSXML2.DOMDocument.3.0")
    Set doc2 = createobject("MSXML2.DOMDocument.3.0")
    
    doc1.Load "01.xml"
    doc2.Load "02.xml"
    
    Response.Write ( doc1.xml.Replace("</CATALOG>", doc2.xml.Replace( "<?xml version="1.0" encoding="ISO-8859-1" ?>","").Replace("<CATALOG>","") )
    
    %>
    

    This would replace the tag from doc1.xml with the doc2.xml without the first two lines, but again, would only work for this situation where you have these two xml files and they don’t contain duplicate nodes.

    You could read the files in using the FileSystemObject which would be faster, but the benefit of loading it in the DOM is that it would only load well formed xml.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

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.