RE: [xml] Substitution of nested entity references




-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Sent: Thursday, April 18, 2002 1:19 PM
To: Henke, Markus
Cc: 'xml gnome org'
Subject: Re: [xml] Substitution of nested entity references


On Thu, Apr 18, 2002 at 11:34:24AM +0200, Henke, Markus wrote:
Well, that task is actual challenging my modest abilities... :)
I guess i'm lack of some very internals of libxml.
However, i don't want to give up without a fight, maybe we can
clarify some points i'm thinking about!?

<snip />

It is very complex, in part because XML entities handling 
is complex, in part due to SAX, in part due to my lack of
global vision when I coded this initially.

Daniel

 
Yep, it's complex. Maybe to complex for me (by now... 8)
So i've tried a possibly quite naive approach by adding some
lines to "xmlStringGetNodeList()"
(and "xmlStringLenGetNodeList()") that recursivly build the
child node list for an entity declaration (which was NULL before,
the initial problem).
I've no idea if this will produce side effects or break other
things, in a (simple) test it works, also my patch for the
complete (recursiv) entity substitution seems to work with it.
What do you think about it (pls don't laugh at me if it's too
strange...  8)?




=== Excerpt, complete patch attached ===

*** tree.c.orig Thu Mar 21 05:35:12 2002
--- tree.c      Thu Apr 18 17:24:27 2002
***************
*** 658,663 ****
--- 658,674 ----
                        if (val != NULL) xmlFree(val);
                        return(ret);
                    }
+                       else if ((ent != NULL) && (ent->children == NULL)) {
+                               xmlNodePtr tmp;
+ 
+                               ent->children =
+                                       xmlStringGetNodeList(doc, (const
xmlChar*)node->content);
+                               tmp = ent->children;
+                               while (tmp) {
+                                       tmp->parent = (xmlNodePtr)ent;
+                                       tmp = tmp->next;
+                               }
+                       }
                    if (last == NULL)
                        last = ret = node;
                    else {
***************

Attachment: tree.c.patch
Description: Binary data



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