Re: [xml] Debugging included entites

On Tue, Jan 08, 2002 at 04:30:11AM +1000, Keith Isdale wrote:
Hi all,

I mention that I've been having trouble debgging document entities. There 

   which is normal with XSLT, entities have to be substitued by their
content to conform to the XPath data model and once done there is nothing
left in the tree referencing the original entities.

seems to be now way arround it other than get a small amount of code added to 
libxml2  to allow me to know when enties are refenced, 

The notification that I get from libxml is via the function 
xmlAddEntityReference. Which has parameters of
   1) Entity declation being refernced
   2) The first node in the copy of the entity refenced 
   3) The last node in the copy of the entity refenced        

   I spent a bit of time on your last message on the subject and I agree
that not modifying the tree is by far the simplest. I'm just somewhat 
annoyed that this introduces another global variable, (and another
API) but the principle looks sound.
   The other possibility is to tag the start and the end of the list
of nodes included from an entity with special markers like XInclude
does. Maybe this special handling could reuse the XInclude existing tree
type to avoid introducing new node type.

This has been tested and works on a small scale. The implemation on the 
xsldbg side is complex . I'm having difficulties dertmining the very bottom 
node in the entity reference.   It translates the entity references (that it 
was notified of) to an unique line number range within the "master" document 
. And then determines which "line number offset" applied to what entities as 
needed.  xsldbg is able to debug small included documents but fails on large, 
complex inclusion. This probably is due to bugs in the xsldbg code. So at 
this stage I'd rather it not be commited to cvs. 

  Complex inclusion is often recursive, this might be where you're having
a problem. Especially if libxml duplicate the trees using a tree copy which
won't be notified by the callback.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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