From: Jonathan W. <co...@co...> - 2003-09-30 14:34:54
|
On Mon, Sep 29, 2003 at 02:17:14PM -0400, Dan Dennedy wrote: > > > --it always goes back to that! So, I would need the SAX > > > event exposed, and a very simple node subclass. > > > > So I think a large part of this is: Adding > > class Entity : public Node > > and telling libxml to give us Entities instead of substituting them. I > > think there's some libxml function for that. (We should add the option > > to libxml++ as well). IIRC the libxml function is xmlSubstituteEntitiesDefault() But I'm not sure it affects the SAX interface. > I did some work over the weekend. I extended SaxParser with internal > subset, entity declaration, and entity reference callbacks. In my parser > implementation, I also implemented the getEntity callback and told > SaxParser to use it, but I was curious about the difference between > getEntity and reference. I was able to get everything working except for > keeping entity references in tact That was the main problem I found when looking at entity support in SaxParser. I didn't find a way to do it that wasn't klugy and didn't expose the raw libxml types. I gave up after a brief struggle. > --at least as far as xml serialization > is concerned. I need to anaylze the resultant node tree further to see > if content is a list of text and entity reference nodes. Either, > libxml2, encodes entity references from "&ref;" to "&ref;" or I can > set resolveEntities=1 in the libxml2 parser context to make it expand. > The SAX reference callback is never called upon. jon -- "The tools we use have a profound (and devious!) influence on our thinking habits, and, therefore, on our thinking abilities." - Edsger Dijkstra |