0

I'm implementing a function doing xml signature with libxml. How could I add sibling nodes to root node?

original xml:

<?xml version="1.0"?>
<object>
...
</object>

what I want:

<?xml version="1.0"?>
<object>
...
</object>
<additional node>
...
</additional node>

After parsing, the object node will be the root node, so I can't use xmlNewChild. What function should I use to achieve what I want.

Thank you.

iOS Padawan
  • 418
  • 1
  • 5
  • 16
  • 2
    As that is not a well formed XML document (a document can only have one root node) , I'd not expect that to be supported. – nos May 26 '12 at 13:32
  • Thank you for the advice. But this might happen when signing the whole xml file with detached signature. – iOS Padawan May 26 '12 at 18:25
  • You were right. There's a tricky way to add sibling nodes to root node, but the result xml file can't be parse correctly with libxml. – iOS Padawan May 28 '12 at 07:40

1 Answers1

0

You can't. Libxml is supposed to produce valid xml files, that is having only one root node.

Padawan, if you know a tricky way to do that, please post another answer and accept it yourself.

Jarekczek
  • 7,456
  • 3
  • 46
  • 66