Page 1 of 1

Multiple Input files, single output ...

Posted: Mon Jul 30, 2007 10:02 pm
by edubble
Here's the dilemma - I frequently rename files and archive them but I would now also like to audit what I've done to ensure I didn't miss anything along the way. Here is a sample of what an xml file looks like prior to file name changes:

Code: Select all


<CurrentFileNames>
<CurrentFileName>foo1.txt</CurrentFileName>
<CurrentFileName>foo2.txt</CurrentFileName>
<CurrentFileName>foo3.txt</CurrentFileName>
<CurrentFileName>foo4.txt</CurrentFileName>
<CurrentFileName>foo5.txt</CurrentFileName>
<CurrentFileName>foo6.txt</CurrentFileName>
<CurrentFileName>foo7.txt</CurrentFileName>
<CurrentFileName>foo8.txt</CurrentFileName>
</CurrentFileNames>
<UpdatedFileNames>
<UpdatedFileName>goo1.txt</UpdatedFileName>
<UpdatedFileName>goo2.txt</UpdatedFileName>
<UpdatedFileName>goo3.txt</UpdatedFileName>
<UpdatedFileName>goo4.txt</UpdatedFileName>
<UpdatedFileName>goo5.txt</UpdatedFileName>
<UpdatedFileName>goo6.txt</UpdatedFileName>
<UpdatedFileName>goo7.txt</UpdatedFileName>
<UpdatedFileName>goo8.txt</UpdatedFileName>
</UpdatedFileNames>
As you can see, it shows the current file names and the names I will use after renaming. We'll call this file foo.xml.

Now, AFTER renaming files, it looks somewhat like this:

Code: Select all


<CurrentFileNames>
<CurrentFileName>goo1.txt</CurrentFileName>
<CurrentFileName>goo2.txt</CurrentFileName>
<CurrentFileName>goo3.txt</CurrentFileName>
<CurrentFileName>goo4.txt</CurrentFileName>
<CurrentFileName>goo5.txt</CurrentFileName>
<CurrentFileName>goo6.txt</CurrentFileName>
<CurrentFileName>goo7.txt</CurrentFileName>
<CurrentFileName>goo8.txt</CurrentFileName>
</CurrentFileNames>
We'll call this goo.xml.

How would I pull "UpdatedFileName" from foo.xml and "CurrentFileName" from goo.xml into a single output file?

The desired output would be something like:

Code: Select all


<UpdatedFileNames>
<UpdatedFileName>goo1.txt</UpdatedFileName>
<UpdatedFileName>goo2.txt</UpdatedFileName>
<UpdatedFileName>goo3.txt</UpdatedFileName>
<UpdatedFileName>goo4.txt</UpdatedFileName>
<UpdatedFileName>goo5.txt</UpdatedFileName>
<UpdatedFileName>goo6.txt</UpdatedFileName>
<UpdatedFileName>goo7.txt</UpdatedFileName>
<UpdatedFileName>goo8.txt</UpdatedFileName>
</UpdatedFileNames>
<CurrentFileNames>
<CurrentFileName>goo1.txt</CurrentFileName>
<CurrentFileName>goo2.txt</CurrentFileName>
<CurrentFileName>goo3.txt</CurrentFileName>
<CurrentFileName>goo4.txt</CurrentFileName>
<CurrentFileName>goo5.txt</CurrentFileName>
<CurrentFileName>goo6.txt</CurrentFileName>
<CurrentFileName>goo7.txt</CurrentFileName>
<CurrentFileName>goo8.txt</CurrentFileName>
</CurrentFileNames>
With the updatedfilenames coming from "foo.xml" and the currentfilenames comeing from "goo.xml".

thoughts?

Posted: Thu Aug 02, 2007 10:44 am
by george
Hi,

You can use the document function to access XML data from other files.

Best Regards,
George