Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy entire content of xml files

Status
Not open for further replies.

sjakiePP

Programmer
Apr 6, 2004
104
NL
Hello,

In Excel 2003 I have made a script that copies the contents of xml files. But this is done one element at the time (rootNode.appendChild(xmlElement)). This takes a lot of time with large files (50mb+).

Is it possible to copy the entire content of a xml file?

The first thing I did to speed things up is to work with a duplicate file. I make a copy of the original file and add the remaining elements to the duplicate.

When I have a file with 5.000 elements and I need 6.000 it is not a problem. Only 1000 elements have to be added, wich is done in a short time. But if I want 60.000 elements it takes a lot longer.

Is there a different way to do this?

Thanks in advance,
Sjakie

---------------------------------------------
Yes, the world is full of strange people.
 
Well, an xml file is just text. So depending on the structure and where in the structure you are doing the additions, you could possibly just treat it as a text file and add text directly.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks, that is something I will look into.

The downside of this choice is I have to find a way to skip <?xml version="1.0" encoding="utf-8"?> and the root element.

---------------------------------------------
Yes, the world is full of strange people.
 
yup. Like I said it will really depend on the structure of the xml and how complicated the insert needs to be. Don't forget to be sure and not lose the closing tag for the root element.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top