[xml] create node from a string (with xml elements inside)



Hi,

I would like to modify an existing xml file by adding a set of nodes but passed as a parameter to a program like
./modify myxml.xml "//this_element_xpath" "<mynode><mycontent><mytext>hello</mytext></mycontent></mynode>"

but I didn't find any method to create a node(-set) from a string, Does it exist?
I tried xmlNewChild with the node name "mynode" and the content "<mycontent><mytext>hello</mytext></mycontent>" but the <> are encoded so it doesn't work.

could the solution be to parse it as a document then to copy the node(-set)?
I hesitated to try this way thinking that probably a much simpler solution would exist.

do you know a simpler solution to it?

Best regards,
Sylvain


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