Re: [libxml++] RE: [xml] SaxParser: getEntity() callback



On Wed, 2003-10-22 at 07:39, Murray Cumming Comneon com wrote:
From: Daniel Veillard [mailto:veillard redhat com] 
On Wed, Oct 22, 2003 at 11:16:03AM +0200, 
Murray Cumming Comneon com wrote:
Has anyone ever successfully used the getEntity() callback? 

Yes, I have in my libxml++ working copy. It accomplishes proper
substitution when the sax parser generates the content for the
characters() 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

The abbreviated code to do it, at least for internal general/parsed
entities, looks like this:

with parser_context.replaceEntities = 1;

void on_entity_declaration() {
  xmlAddDocEntity();
}

xmlEntity* on_get_entity() {
  return xmlGetDocEntity();
}

Problem is, I don't want getEntity() to be called. I want
characters()... entityReference()... characters()... so I can stick the
entity reference into the tree. This is the complicated part Daniel
VEILLARD refers to, and I believe him especially after the friendly IRC
chat ;-) and reviewing the spec further.

I realize, it may be undesirable to duplicate some of the libxml2 code,
and that may be unacceptable for inclusion into libxml++. I just have
not had time yet to review the libxml2 source in this area. I do
appreciate Daniel's pointers. Maybe, eventually, we can find a way to
expose some of the facilities within publicly. Necessity is the mother
of invention. Either it will be necessary enough for me that I make
something work for my project alone or libxml2/libxml++, or I take the
different approach Daniel suggests and totally re-think my architecture.

+-DRD-+





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]