How to merge two xml files in classic asp?
- by Alex
hi
i using classic asp in my project
i wand to merge two xml's together?
how i merge xml's togethe?
Below is my sample code
XML 1
<?xml version="1.0" encoding="ISO-8859-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
<?xml version="1.0" encoding="ISO-8859-1" ?>
<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, now i 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
%>
Now i getting an error
Microsoft VBScript runtime error '800a01a8'
Object required: 'documentElement'