Re: [xml] SaxParser: getEntity() callback



On Wed, Oct 22, 2003 at 11:16:03AM +0200, Murray Cumming Comneon com wrote:
Has anyone ever successfully used the getEntity() callback? It needs to
return an xmlEntity instance, but I can't imagine that anyone could create
one with all the right voodoo contents:
http://xmlsoft.org/html/libxml-tree.html#xmlEntity

I can't find any way to get the xmlEntity that would have been created by
libxml automatically if I had set the getEntity() to NULL. That might at
least be a starting point.

I know this is difficult, but I hope it isn't impossible.

  1/ Look at SAX2.c implementation 
  2/ Look at entities.c in 2.6.0 for the predefined static entities
  3/ Look at the XML-1.0 spec about the various processing of entities
     http://www.w3.org/TR/REC-xml#entproc
     consider the complexity of the given table
  4/ Consider the fact that libxml2 may either substitute entities or
     keep them in the tree (including in attributes content)

 You will get an idea of what's difficult, that it's not impossible (since
libxml2 does it !), but that you will have to duplicate code behaviour
from libxml2 in your SAX handler.
 If you want proper entities processing the tree or xmlReader based approach
are definitely simpler since libxml2 take care of the complexity.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]