[Axl] howto add a new node to xml document?

Francis Brosnan Blazquez francis at aspl.es
Fri Jan 26 11:40:54 CET 2007

El vie, 26-01-2007 a las 12:19 +0200, Kostis Mentzelos escribió:
> Hi list,

Hi Kostis,

> after searching a lot for a simple xml library I found this one and I 
> realy like it very much!

Thanks for your comments, really welcome!

> anyway, I whould like to ask if it is possible and how to add a new node 
> to an xml document.
> what I have already done is:
> I am opening an xml file with fopen, reading all the contents into 
> xmlbuffer .
> use:
> axl_doc_parse to get the axldoc

This looks good. You can also use axl_doc_parse_from_file (which
internally does the same).

> axl_doc_get_root to get root node.
> axl_node_create and axl_node_set_content to create a new node and add 
> content to it.
> *** I don't know how to add the new node to root node
> then I call axl_doc_dump_pretty_to_file to write the xml document back 
> to file.
> and finaly axl_doc_free.

Looks nice Kostis. To add a new child node to the root document (or any
other xml node, that is, axlNode) you can use axl_node_set_child. Check
function documentation for more details [1].

Alternatively, to add content or a comment you can use:
axl_node_set_content and axl_node_set_comment.



> regards,
> Kostis Mentzelos
> _______________________________________________
> Axl mailing list
> Axl at lists.aspl.es
> http://lists.aspl.es/cgi-bin/mailman/listinfo/axl
Francis Brosnan Blazquez <francis at aspl.es>
Advanced Software Production Line, S.L.

More information about the Axl mailing list