mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-08 17:42:14 +03:00
integrated a couple of fixes and a new API function
* parser.c include/libxml/parserInternals.h tree.c: integrated a couple of fixes and a new API function xmlSetEntityReferenceFunc() from Keith Isdale and dedicated to xsldbg the XSLT debugger. Daniel
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
Sun Jan 13 15:07:49 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c include/libxml/parserInternals.h tree.c: integrated
|
||||
a couple of fixes and a new API function xmlSetEntityReferenceFunc()
|
||||
from Keith Isdale and dedicated to xsldbg the XSLT debugger.
|
||||
|
||||
Sun Jan 13 14:23:21 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* threads.c: applied Serguei Narojnyi's patch to add native
|
||||
|
@@ -394,6 +394,18 @@ void xmlParserInputShrink (xmlParserInputPtr in);
|
||||
void htmlInitAutoClose (void);
|
||||
htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
|
||||
const char *encoding);
|
||||
|
||||
/*
|
||||
* Specific function to keep track of entities references
|
||||
* and used by the XSLT debugger
|
||||
*/
|
||||
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
|
||||
xmlNodePtr firstNode,
|
||||
xmlNodePtr lastNode);
|
||||
|
||||
void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
53
parser.c
53
parser.c
@@ -99,6 +99,10 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
|
||||
void *user_data, int depth, const xmlChar *URL,
|
||||
const xmlChar *ID, xmlNodePtr *list);
|
||||
|
||||
static void
|
||||
xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode,
|
||||
xmlNodePtr lastNode);
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Parser stacks related functions and macros *
|
||||
@@ -5254,8 +5258,10 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
||||
if (list->next == NULL)
|
||||
ent->last = list;
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
list = ent->children;
|
||||
if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)
|
||||
xmlAddEntityReference(ent, list, NULL);
|
||||
}
|
||||
} else {
|
||||
while (list != NULL) {
|
||||
@@ -5297,15 +5303,20 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
||||
* In the first occurrence list contains the replacement
|
||||
*/
|
||||
if (list == NULL) {
|
||||
xmlNodePtr new, cur;
|
||||
xmlNodePtr new = NULL, cur, firstChild = NULL;
|
||||
cur = ent->children;
|
||||
while (cur != NULL) {
|
||||
new = xmlCopyNode(cur, 1);
|
||||
if (firstChild == NULL){
|
||||
firstChild = new;
|
||||
}
|
||||
xmlAddChild(ctxt->node, new);
|
||||
if (cur == ent->last)
|
||||
break;
|
||||
cur = cur->next;
|
||||
}
|
||||
if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)
|
||||
xmlAddEntityReference(ent, firstChild, new);
|
||||
} else {
|
||||
/*
|
||||
* the name change is to avoid coalescing of the
|
||||
@@ -10226,6 +10237,44 @@ xmlParseDoc(xmlChar *cur) {
|
||||
return(xmlSAXParseDoc(NULL, cur, 0));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Specific function to keep track of entities references *
|
||||
* and used by the XSLT debugger *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
static xmlEntityReferenceFunc xmlEntityRefFunc = NULL;
|
||||
|
||||
/**
|
||||
* xmlAddEntityReference:
|
||||
* @ent : A valid entity
|
||||
* @firstNode : A valid first node for children of entity
|
||||
* @lastNode : A valid last node of children entity
|
||||
*
|
||||
* Notify of a reference to an entity of type XML_EXTERNAL_GENERAL_PARSED_ENTITY
|
||||
*/
|
||||
static void
|
||||
xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode,
|
||||
xmlNodePtr lastNode)
|
||||
{
|
||||
if (xmlEntityRefFunc != NULL) {
|
||||
(*xmlEntityRefFunc) (ent, firstNode, lastNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlSetEntityReferenceFunc:
|
||||
* @func : A valid function
|
||||
*
|
||||
* Set the function to call call back when a xml reference has been made
|
||||
*/
|
||||
void
|
||||
xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func)
|
||||
{
|
||||
xmlEntityRefFunc = func;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
|
11
tree.c
11
tree.c
@@ -2642,9 +2642,13 @@ xmlCopyProp(xmlNodePtr target, xmlAttrPtr cur) {
|
||||
ret->parent = target;
|
||||
|
||||
if ((cur->ns != NULL) && (target != NULL)) {
|
||||
xmlNsPtr ns;
|
||||
|
||||
xmlNsPtr ns;
|
||||
if (target->doc)
|
||||
ns = xmlSearchNs(target->doc, target, cur->ns->prefix);
|
||||
else if (cur->doc) /* target may not yet have a doc : KPI */
|
||||
ns = xmlSearchNs(cur->doc, target, cur->ns->prefix);
|
||||
else
|
||||
ns = NULL;
|
||||
ret->ns = ns;
|
||||
} else
|
||||
ret->ns = NULL;
|
||||
@@ -2786,6 +2790,9 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
||||
xmlBufferContent(node->content),
|
||||
xmlBufferLength(node->content));
|
||||
#endif
|
||||
}else{
|
||||
if (node->type == XML_ELEMENT_NODE)
|
||||
ret->content = (void*)(long) node->content;
|
||||
}
|
||||
if (parent != NULL)
|
||||
xmlAddChild(parent, ret);
|
||||
|
Reference in New Issue
Block a user