Re: [xml] Exchanging same XML fragment in multiple XML documents

On Wed, Nov 06, 2002 at 02:39:10PM +0100, Holger Rauch wrote:
I indeed *did* look it up), but was not sure since I had
the impression that accessing nodesetval and nodeTab directly is not
clean; I thought there was some function to access it. Well, obviously I
was wrong... Thanks a lot for clarifying this.

  the structures are public, except the ones in "Internal" or headers not

  copy it in each document using xmlDocCopyNode()

Using this function assumes that I already have an
xmlNodePtr. However, this is not the case when having a textual
representation of an XML fragment. My question thus is: How do I convert a
textual representation of an XML fragment to a node list (xmlNodePtr)?

  Make it a well-formed XML document and parse it.
Uusually enclosing in beginning and end tags is sufficient.
There is a number of problems related to encoding, entities and namespace 
references, but those problems are present too in the fragment parsing
interface to some extend. At least getting back to parsing a full document
expose the limitations associated to your approach (you are mixing layers
of the textual representation and the internal one, and you loose tons
of contextual informations needed to make sense of the first one in the
second one).

  one operates on a single node subtree, and the other does the same on the
full list 

Ok, this wasn't clear to me since the documentation for these two
functions only differs in one word: "tree" in one, and "list" in the

  Well, that's a fairly significant difference !!!


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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