Re: [xml] building a doc from fragments



On Fri, Jun 30, 2006 at 10:54:09PM -0600, John Calcote wrote:
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?

  In general XML doesn't define semantic for this. You parse document,
there is no notion of parsing a fragement. Many thing in parsing are contextual
like namespace, base, entities, etc...
I really suggest reading the specs before trying to do this kind of things.

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 point is that what you ask for really doesn't match any standard
processing it it will be custom. The closest to what you seems to have in
mind are:
   http://xmlsoft.org/html/libxml-parser.html#xmlParseBalancedChunkMemory
   and 
   http://xmlsoft.org/html/libxml-parser.html#xmlParseInNodeContext

 but really it's outside the definition of normal document parsing as
defined in XML-1.0

The doc is not very extensive on libxml,
and so good sample code is kinda required.

  We take patches !

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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