[xml] extend xml Document with new rootNode



Hi list,

I'm new to libxml and need some help.

What I try to do is to extend an existing xml-document with a new root
node. I've already tried some things...

To illustrate the "problem", the actual xml file is something like the
following:

<?xml version="1.0"?>
<data>
  <customer name="" no="">
    <test no="">
      <model></model>
      <date>
        <begin></begin>
        <end></end>
      </date>
      <run>
        <conditions> 
        </conditions>
        <date></date>
        <time></time>
        <vars>
        </vars>
      </run>
    </test>
  </customer>
</data>

And the goal should be:

<?xml version="1.0"?>
<protocol>
  <head>
  </head>
  <body>
    <data>
      <customer name="" no="">
        <test no="">
          <model></model>
          <date>
            <begin></begin>
            <end></end>
          </date>
          <run>
            <conditions> 
            </conditions>
            <date></date>
            <time></time>
            <vars>
            </vars>
          </run>
        </test>
      </customer>
    </data>
  </body>
</protocol>

What is the best way to achieve this?
Perhaps it is relevant that the xml-tree will never be written out to a
file. It's processed "in memory".

Thank you for your help!

greets

Marc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]