Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: appending a new element to an existing xml file [Thread Next] Re: appending a new element to an existing xml fileTo: NULL Date: 3/6/2008 10:24:00 AM ofuuzo1@y... wrote: : On 5 Mar, 14:23, ofuu...@yahoo.no wrote: : > Hi, : > Is there anyway I can append a new element to an existing xml without : > first loading the existing file into a variable, adding the new : > element into the variable and saving it by overwriting the existing : > file name? : > : > Thanks : > Ofuuzo : To smplify my question. : I have nth xml files and I want to put all of them together in one xml : file called new.xml. How can I do it? : Example : 1.xml : <head> : <title>Test1</title> : .... : </head> : 2.xml : <head> : <title>Test2</title> : .... : </head> : n.xml : 1.xml : <head> : <title>Test nth</title> : .... : </head> (my second answer, specific to this example). Wrap them all in an additional level of tagging. echo '<new-root>' > joined.xml cat 1.xml >> joined.xml cat 2.xml >> joined.xml ... etc. echo '</new-root>' >> joined.xml Now you have one big xml file with the root of "new-root" (assuming the files are valid, and ignoring issues of the <?xml version="1.0"....> being in there or not. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
