Re: [xml] XML fragments

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Sun Feb 28 1999 - 10:34:03 EST


  Hi Havoc,

> Can I convince libxml to parse an XML fragment? Just a part of a document?
>
> Something like:
>
> <foo>
> Text
> </foo>
> <bar>
> Text
> </bar>
>
> It appears to only parse the first element, since a complete document is
> supposed to be contained in an element I guess.

  Yes, and yes :-)

Concerning the second point, yes the XML specification allow only one
root in an XML document.
Concerning the first point you need to use the xmlParseElement() function:

http://rpmfind.net/veillard/XML/gnome-xml-parserinternals.html#XMLPARSEELEMENT

This is part of the parser internal routines set exported through
parserInternals.h available in the latests libxml packages (or CVS).

  The problem is to generate the parser context input corresponding to
your piece of input. I currently don't export such a function, it's
lacking from the API. I will try to provide those ASAP by splitting
the functions like xmlSAXParseMemory() in an initialization part and
and the actuall call to the parser. I will try to do that and commit it
this afternoon.

  BTW, could you indicate what kind of use you have in mind ? If this
turn out to be useful to others I may move it directly in tree.h .

Daniel

-- 
	    [Yes, I have moved back to France !]
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux, WWW, rpmfind,
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | rpm2html, XML,
http://www.w3.org/People/W3Cpeople.html#Veillard | badminton, and Kaffe.
----
Message from the list xml@rufus.w3.org
Archived at : http://rufus.w3.org/veillard/XML/messages
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rufus.w3.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:26 EDT