Re: [xml] Questions about libxml2's API...



On Tue, Dec 04, 2007 at 06:19:53PM +0100, Roland Mainz wrote:

Hi!

----

  Hi

I am currently working on SAX/xmlSAXParseFile libxml2 bindings for
ksh93/kash and have a few questions about the API:
- Is there a way to provide a "default encoding setting" which should be
used if the document itself doesn't define a character set ?

  I don't understand the question. The XML standard defines how things
should be checked in the absence of informations, in the document. If you
provide that information it overrides the normal procxessing (and if you
guess wrong you get a fatal error).
More doc 
  http://xmlsoft.org/encoding.html
  http://www.w3.org/TR/REC-xml/#sec-guessing

- How can I turn-off the libxml2 feature that it resolves all entities
(e.g. how can I do my own entity resolving) ?

  By default in SAX mode if you don't ask for entity replacement I
think libxml let you provide it (see the entity callback). NOTE:
this is hairy, complex to get right in the general case, and one reason
I recomment to not use SAX at all.

- How can I abort a SAX parser run from within a callback function ?

  xmlStopParser()

- Is there a way to get |xmlSAXParseFile()| to accept stdin as input to
allow it's use in pipe chains ?

  "-"

- Is |xmlSAXParseFile()| fully thread-safe (important since ksh93 will
get thread support soon) ?

doc here
  http://xmlsoft.org/threads.html

- Is |xmlSAXParseFile()| re-entrant, e.g. can I call |xmlSAXParseFile()|
from within a callback during another |xmlSAXParseFile()| ? For example

  That should work the parsing contexts are different 

for a simple RSS browser I would have to call |xmlSAXParseFile()| to
decode the RSS stream and then |xmlSAXParseFile()| a 2nd time (from
within a callback) to decode the XHTML data (I've already tried but
something weired is going on somehow the '<' and '>' characters seem to
"disappear" from the charatcer data stream).

  No idea, sounds weird.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]