[xml] building a doc from fragments



libxml2 noobie question - first the context:
 
I'm writing a simple doc builder API around an existing W3C XML schema. There are a couple of dozen "setter" functions, that allow the caller to set values in various fields of an instance document conforming to the schema. The user builds about 3 different simple constructs, and then calls a "root" level API that glues these smaller objects together. Finally, the user converts to xml text and does something else with the text.
 
Here are my questions:
 
Since I don't really build a "doc" per se, but rather a series of fragments, what is the most appropriate way to build these fragments, and then append them to an doc later? Also, my API allows the insertion at various points of non-well-defined fragments of XML text. How do I parse in such a fragment of XML text, and then insert the root node of that fragment into a parent node that I'm managing?
 
Pointers to existing (sample) code that does these things would be perfectly acceptable, but please don't point me to sample code that doesn't do what I asked for. :) The doc is not very extensive on libxml, and so good sample code is kinda required.
 
Thanks in advance,
John Calcote
Sr. Software Engineer
Novell, Inc.


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