[xml] Changing the content of a node



Hi,

I have an XML tree like this one:

1: <?xml version="1.0"?>
2: <data>
3: <level1>
4:      some_text
5: <level2>
6: <level3>2.5</level3>
7: </level2>
8: </level1>
9: </data>

and I want to modify the content at <level1> node, i.e. replace "some_text" by "modified_text"

After using xmlNodeSetContent, the tree becomes :

1: <?xml version="1.0"?>
2: <data>
3: <level1>
4:       modified_text
5': </level1>
6': </data>

How to keep the <level2> subtree (lines 5 to 7 of the original XML) ?

Thanks in advance.
Marc



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