Re: [xml] workarounds for SAX and entity replacement

On Sat, Feb 12, 2005 at 04:35:47PM +0000, Graham Bennett wrote:
Hi all,

I'm trying to do entity replacement using the SAX2 interface, but I'm
running into this problem:

where my SAX handler is invoked more than once for each entity.

Does anyone have any workarounds for this problem?  Is anyone
successfully doing entity replacement via the SAX interface?

  well libxml2 does but at the tree level, i.e. it does some copies
but at the DOM nodes level. The reason is historical, libxml was designed
to preserve entities, even within attribute values, i.e. was designed
to be able to cope with editing needs. SAX was added later on as
it appeared as a de-facto API. Doing pure SAX based operations would
require keeping state at the parser level instead of at the tree
level which is what libxml2 does currently. This is not really trivial
the harder is all the border cases of wellformedness and validity checking
and there is plenty of trap to fell into if doing things naively.


Daniel Veillard      | Red Hat Desktop team
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]