Re: [xml] Still trying to handle entities using the SAX interface



On Wed, Apr 18, 2001 at 03:04:00PM +0200, Fabrizio Ammollo wrote:
I discovered that line 4931 in parser.c is triggering the error :

  error in your viewpoint ....

ret = xmlParseBalancedChunkMemory(ctxt->myDoc,
      ctxt->sax, NULL, ctxt->depth,
      value, &list);

The problem is that the third parameter should be a pointer to my initial 
user_data, instead it is passed as NULL, so from within the called function 
the original value is lost, and eventually my characters() callback function 
is called with the wrong user_data.

I modified the line in this way :

ret = xmlParseBalancedChunkMemory(ctxt->myDoc,
      ctxt->sax, ctxt->userData, ctxt->depth,
      value, &list);

My program works as I expected, but I reran the "make check" and I have 
discovered that MANY tests, mainly those related to entities but also others 
that contain entities, don't work anymore as they should.

  right, so i won't take this change, someone already suggested it before
and I came to the same conclusion, it breaks all non-SAX parsing.

For what I have so far understood about how the library works, it is certain 
that the change I have made impacts also on the normal DOM building behaviour.

  right

What I think is that ctxt->userData should be passed instead of NULL only if 
the parsing was initially called from the SAX API functions, but apparently 
there is nothing which indicates this. :-(
Before going further, do you think this is the right approach to follow 
(except using the DOM API) ?

  Well using SAX if you make use of non-trivial entities is hard, I warned you
about this. To put it simply doing all the checkings required for well
formedness and validation in the presence of entities is complex, breaking
all this for the people using only SAX (and hence a minimal subset of libxml)
is not something I'm gonna approve.
  Now if you make a patch wich don't break binary compatibility and don't
break the whole enviroment I will certainely take it.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
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]