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.

Wow. Cool. Be careful when updating from cvs. You'll probably get a lot of
conflicts. I really look forward to the patch.

> > > 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;

There's bool get/set methods for that in xmlpp::Parser in cvs now.
 
> void on_entity_declaration() {
>   xmlAddDocEntity();
> }

I already added on_entity_declaration() too, but mine is empty.

> xmlEntity* on_get_entity() {
>   return xmlGetDocEntity();
> }
> 
> Problem is, I don't want getEntity() to be called. I want
> characters()... entityReference()... characters()...

Isn't get_entity() called for every entity reference?

> so I can 
> stick the
> entity reference into the tree.

What tree? Do you mean a custom data structure, or part of libxml?

> 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++.

It's not too bad if we can isolate it and make it optional.

> 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.

You mean, use the DOM Parser?

Murray Cumming
www.murrayc.com
murrayc usa net




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