I’m filling an XML document manually using C# and I need to have <data> as header and </data> as footer for the whole XML file. Is there an easy way to do that ? I know It can be done but I couldn’t find a way to do it. Keep in mind that I’m updating the entries so I need to make sure that they always come between the header and the footer.
Thanks
Example
<data>
Entry
New Entry 1
New Entry 2
</data>
I’m not sure what you are trying to do makes sense – and I agree with Brian on a lack of way to pre-pend a file without writing a new file. A better approach would be to store the
Entryitems (in a separate file or other storage medium) and then generate the final version as Brian stipulates.If you are manipulating XML content generally, you might consider using Linq to XML or the native .Net XML libraries.