serializing big static XML peaces

  • Thread starter Thread starter Tarscher
  • Start date Start date
T

Tarscher

Hi all,

I need to build XML files. Some XML files are almost entirely static
containing some dynamic content. An example is a file I need to build
that contains about 100 line that are static. Somewhere in the middle
I need to inject some dynamic XML lines.

Someone has an idea on how to best solve this? With a template engine?

Greets,
Stijn
 
Tarscher said:
Hi all,

I need to build XML files. Some XML files are almost entirely static
containing some dynamic content. An example is a file I need to build
that contains about 100 line that are static. Somewhere in the middle
I need to inject some dynamic XML lines.

Someone has an idea on how to best solve this? With a template engine?

* Save the static part in an xml-file on disk
* Open and parse this file with an XML DOM parser
* Use XPath/LINQ on the DOM tree to grab the parent-node
of where you want to add your dunamic content
* Create new nodes with the DOM object, containing your
dynamic content.
* Add them to the selected parent node.
* Save, or use the resulting XML-DOM tree.
 
Back
Top