1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

store the line numbder in element->content, may break some software, need

* DOCBparser.c HTMLparser.c HTMLtree.c SAX.c debugXML.c parser.c
  tree.c xpointer.c: store the line numbder in element->content,
  may break some software, need a configuration mechanism
Daniel
This commit is contained in:
Daniel Veillard
2001-07-12 01:20:08 +00:00
parent 96037891e6
commit 7db3773a5c
10 changed files with 84 additions and 115 deletions

View File

@ -1,3 +1,9 @@
Thu Jul 12 21:20:17 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* DOCBparser.c HTMLparser.c HTMLtree.c SAX.c debugXML.c parser.c
tree.c xpointer.c: store the line numbder in element->content,
may break some software, need a configuration mechanism
2001-07-10 Darin Adler <darin@bentspoon.com> 2001-07-10 Darin Adler <darin@bentspoon.com>
* .cvsignore: * .cvsignore:

View File

@ -2458,7 +2458,8 @@ static int areBlanks(docbParserCtxtPtr ctxt, const xmlChar *str, int len) {
if (ctxt->node == NULL) return(0); if (ctxt->node == NULL) return(0);
lastChild = xmlGetLastChild(ctxt->node); lastChild = xmlGetLastChild(ctxt->node);
if (lastChild == NULL) { if (lastChild == NULL) {
if (ctxt->node->content != NULL) return(0); if ((ctxt->node->type != XML_ELEMENT_NODE) &&
(ctxt->node->content != NULL)) return(0);
} else if (xmlNodeIsText(lastChild)) } else if (xmlNodeIsText(lastChild))
return(0); return(0);
return(1); return(1);

View File

@ -1782,7 +1782,8 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
if (ctxt->node == NULL) return(0); if (ctxt->node == NULL) return(0);
lastChild = xmlGetLastChild(ctxt->node); lastChild = xmlGetLastChild(ctxt->node);
if (lastChild == NULL) { if (lastChild == NULL) {
if (ctxt->node->content != NULL) return(0); if ((ctxt->node->type != XML_ELEMENT_NODE) &&
(ctxt->node->content != NULL)) return(0);
} else if (xmlNodeIsText(lastChild)) { } else if (xmlNodeIsText(lastChild)) {
return(0); return(0);
} else if (xmlStrEqual(lastChild->name, BAD_CAST"b")) { } else if (xmlStrEqual(lastChild->name, BAD_CAST"b")) {

View File

@ -538,7 +538,8 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
} }
return; return;
} }
if ((cur->content == NULL) && (cur->children == NULL)) { if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
(cur->children == NULL)) {
if ((info != NULL) && (info->saveEndTag != 0) && if ((info != NULL) && (info->saveEndTag != 0) &&
(xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) &&
(xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) {
@ -557,7 +558,7 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
return; return;
} }
xmlBufferWriteChar(buf, ">"); xmlBufferWriteChar(buf, ">");
if (cur->content != NULL) { if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
xmlChar *buffer; xmlChar *buffer;
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
@ -1039,7 +1040,8 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
} }
return; return;
} }
if ((cur->content == NULL) && (cur->children == NULL)) { if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
(cur->children == NULL)) {
if ((info != NULL) && (info->saveEndTag != 0) && if ((info != NULL) && (info->saveEndTag != 0) &&
(xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) &&
(xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) {
@ -1060,7 +1062,8 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
return; return;
} }
xmlOutputBufferWriteString(buf, ">"); xmlOutputBufferWriteString(buf, ">");
if (cur->content != NULL) { if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL)) {
/* /*
* Uses the OutputBuffer property to automatically convert * Uses the OutputBuffer property to automatically convert
* invalids to charrefs * invalids to charrefs

2
SAX.c
View File

@ -966,6 +966,8 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
parent = ctxt->myDoc->children; parent = ctxt->myDoc->children;
} }
ctxt->nodemem = -1; ctxt->nodemem = -1;
if (ctxt->input != NULL)
ret->content = (void *) ctxt->input->line;
/* /*
* We are parsing a new node. * We are parsing a new node.

View File

@ -248,7 +248,8 @@ xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) {
fprintf(output, ", MIXED "); fprintf(output, ", MIXED ");
break; break;
} }
if (elem->content != NULL) { if ((elem->type != XML_ELEMENT_NODE) &&
(elem->content != NULL)) {
char buf[5001]; char buf[5001];
buf[0] = 0; buf[0] = 0;
@ -602,7 +603,8 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) {
if (node->properties != NULL) if (node->properties != NULL)
xmlDebugDumpAttrList(output, node->properties, depth + 1); xmlDebugDumpAttrList(output, node->properties, depth + 1);
if (node->type != XML_ENTITY_REF_NODE) { if (node->type != XML_ENTITY_REF_NODE) {
if (node->content != NULL) { if ((node->type != XML_ELEMENT_NODE) &&
(node->content != NULL)) {
shift[2 * i] = shift[2 * i + 1] = ' ' ; shift[2 * i] = shift[2 * i + 1] = ' ' ;
shift[2 * i + 2] = shift[2 * i + 3] = 0 ; shift[2 * i + 2] = shift[2 * i + 3] = 0 ;
fprintf(output, shift); fprintf(output, shift);
@ -818,7 +820,8 @@ xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output) {
fprintf(output, "SYSTEM \"%s\"", cur->SystemID); fprintf(output, "SYSTEM \"%s\"", cur->SystemID);
if (cur->orig != NULL) if (cur->orig != NULL)
fprintf(output, "\n orig \"%s\"", cur->orig); fprintf(output, "\n orig \"%s\"", cur->orig);
if (cur->content != NULL) if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL))
fprintf(output, "\n content \"%s\"", cur->content); fprintf(output, "\n content \"%s\"", cur->content);
fprintf(output, "\n"); fprintf(output, "\n");
} }

View File

@ -405,6 +405,9 @@ struct _xmlNode {
xmlNs *nsDef; /* namespace definitions on this node */ xmlNs *nsDef; /* namespace definitions on this node */
}; };
#define XML_GET_CONTENT(n) ((n)->type == XML_ELEMENT_PTR ? NULL : (n)->content)
#define XML_GET_LINE(n) ((n)->type == XML_ELEMENT_PTR ? (int) (n)->content : 0)
/** /**
* xmlDoc: * xmlDoc:
* *

View File

@ -1477,7 +1477,8 @@ static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
lastChild = xmlGetLastChild(ctxt->node); lastChild = xmlGetLastChild(ctxt->node);
if (lastChild == NULL) { if (lastChild == NULL) {
if (ctxt->node->content != NULL) return(0); if ((ctxt->node->type != XML_ELEMENT_NODE) &&
(ctxt->node->content != NULL)) return(0);
} else if (xmlNodeIsText(lastChild)) } else if (xmlNodeIsText(lastChild))
return(0); return(0);
else if ((ctxt->node->children != NULL) && else if ((ctxt->node->children != NULL) &&

145
tree.c
View File

@ -904,7 +904,8 @@ xmlNodeListGetRawString(xmlDocPtr doc, xmlNodePtr list, int inLine) {
if (list == NULL) return(NULL); if (list == NULL) return(NULL);
while (node != NULL) { while (node != NULL) {
if (node->type == XML_TEXT_NODE) { if ((node->type == XML_TEXT_NODE) ||
(node->type == XML_CDATA_SECTION_NODE)) {
if (inLine) { if (inLine) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
ret = xmlStrcat(ret, node->content); ret = xmlStrcat(ret, node->content);
@ -2248,12 +2249,10 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
/* /*
* If cur is a TEXT node, merge its content with adjacent TEXT nodes * If cur is a TEXT node, merge its content with adjacent TEXT nodes
* or with parent->content if parent->content != NULL.
* cur is then freed. * cur is then freed.
*/ */
if (cur->type == XML_TEXT_NODE) { if (cur->type == XML_TEXT_NODE) {
if (((parent->type == XML_ELEMENT_NODE) || if ((parent->type == XML_TEXT_NODE) &&
(parent->type == XML_TEXT_NODE)) &&
(parent->content != NULL)) { (parent->content != NULL)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
xmlNodeAddContent(parent, cur->content); xmlNodeAddContent(parent, cur->content);
@ -2284,31 +2283,17 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
} }
/* /*
* Handle the case where parent->content != NULL, in that case it will * Coalescing
* create a intermediate TEXT node.
*/ */
if (((parent->type == XML_ELEMENT_NODE) || (parent->type == XML_TEXT_NODE)) && if ((parent->type == XML_TEXT_NODE) &&
(parent->content != NULL)) { (parent->content != NULL)) {
xmlNodePtr text;
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
text = xmlNewDocText(parent->doc, parent->content); xmlNodeAddContent(parent, cur->content);
#else #else
text = xmlNewDocText(parent->doc, xmlBufferContent(parent->content)); xmlNodeAddContent(parent, xmlBufferContent(cur->content));
#endif #endif
if (text != NULL) { xmlFreeNode(cur);
text->next = parent->children; return(parent);
if (text->next != NULL)
text->next->prev = text;
parent->children = text;
UPDATE_LAST_CHILD_AND_PARENT(parent)
#ifndef XML_USE_BUFFER_CONTENT
xmlFree(parent->content);
#else
xmlBufferFree(parent->content);
#endif
parent->content = NULL;
}
} }
if (parent->children == NULL) { if (parent->children == NULL) {
parent->children = cur; parent->children = cur;
@ -2368,13 +2353,22 @@ xmlFreeNodeList(xmlNodePtr cur) {
xmlFreeNodeList(cur->children); xmlFreeNodeList(cur->children);
if (cur->properties != NULL) if (cur->properties != NULL)
xmlFreePropList(cur->properties); xmlFreePropList(cur->properties);
if (cur->type != XML_ENTITY_REF_NODE) if ((cur->type != XML_ELEMENT_NODE) &&
(cur->type != XML_XINCLUDE_START) &&
(cur->type != XML_XINCLUDE_END) &&
(cur->type != XML_ENTITY_REF_NODE)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
if (cur->content != NULL) xmlFree(cur->content); if (cur->content != NULL) xmlFree(cur->content);
#else #else
if (cur->content != NULL) xmlBufferFree(cur->content); if (cur->content != NULL) xmlBufferFree(cur->content);
#endif #endif
if (cur->nsDef != NULL) xmlFreeNsList(cur->nsDef); }
if (((cur->type == XML_ELEMENT_NODE) ||
(cur->type == XML_XINCLUDE_START) ||
(cur->type == XML_XINCLUDE_END)) &&
(cur->nsDef != NULL))
xmlFreeNsList(cur->nsDef);
/* /*
* When a node is a text node or a comment, it uses a global static * When a node is a text node or a comment, it uses a global static
* variable for the name of the node. * variable for the name of the node.
@ -2430,12 +2424,18 @@ xmlFreeNode(xmlNodePtr cur) {
xmlFreeNodeList(cur->children); xmlFreeNodeList(cur->children);
if (cur->properties != NULL) if (cur->properties != NULL)
xmlFreePropList(cur->properties); xmlFreePropList(cur->properties);
if (cur->type != XML_ENTITY_REF_NODE) if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL) &&
(cur->type != XML_ENTITY_REF_NODE) &&
(cur->type != XML_XINCLUDE_END) &&
(cur->type != XML_XINCLUDE_START)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
if (cur->content != NULL) xmlFree(cur->content); xmlFree(cur->content);
#else #else
if (cur->content != NULL) xmlBufferFree(cur->content); xmlBufferFree(cur->content);
#endif #endif
}
/* /*
* When a node is a text node or a comment, it uses a global static * When a node is a text node or a comment, it uses a global static
* variable for the name of the node. * variable for the name of the node.
@ -2756,7 +2756,11 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
ret->name = xmlStringComment; ret->name = xmlStringComment;
else if (node->name != NULL) else if (node->name != NULL)
ret->name = xmlStrdup(node->name); ret->name = xmlStrdup(node->name);
if ((node->content != NULL) && (node->type != XML_ENTITY_REF_NODE)) { if ((node->type != XML_ELEMENT_NODE) &&
(node->content != NULL) &&
(node->type != XML_ENTITY_REF_NODE) &&
(node->type != XML_XINCLUDE_END) &&
(node->type != XML_XINCLUDE_START)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
ret->content = xmlStrdup(node->content); ret->content = xmlStrdup(node->content);
#else #else
@ -2900,32 +2904,6 @@ xmlNodePtr xmlCopyNodeList(xmlNodePtr node) {
return(ret); return(ret);
} }
/**
* xmlCopyElement:
* @elem: the element
*
* Do a copy of the element definition.
*
* Returns: a new xmlElementPtr, or NULL in case of error.
xmlElementPtr
xmlCopyElement(xmlElementPtr elem) {
xmlElementPtr ret;
if (elem == NULL) return(NULL);
ret = xmlNewDocElement(elem->doc, elem->ns, elem->name, elem->content);
if (ret == NULL) return(NULL);
if (!recursive) return(ret);
if (elem->properties != NULL)
ret->properties = xmlCopyPropList(elem->properties);
if (elem->nsDef != NULL)
ret->nsDef = xmlCopyNamespaceList(elem->nsDef);
if (elem->children != NULL)
ret->children = xmlCopyElementList(elem->children);
return(ret);
}
*/
/** /**
* xmlCopyDtd: * xmlCopyDtd:
* @dtd: the dtd * @dtd: the dtd
@ -3412,7 +3390,6 @@ xmlNodeGetContent(xmlNodePtr cur) {
return(NULL); return(NULL);
while (tmp != NULL) { while (tmp != NULL) {
switch (tmp->type) { switch (tmp->type) {
case XML_ELEMENT_NODE:
case XML_CDATA_SECTION_NODE: case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE: case XML_TEXT_NODE:
if (tmp->content != NULL) if (tmp->content != NULL)
@ -3547,14 +3524,6 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
switch (cur->type) { switch (cur->type) {
case XML_DOCUMENT_FRAG_NODE: case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE: case XML_ELEMENT_NODE:
if (cur->content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
xmlFree(cur->content);
#else
xmlBufferFree(cur->content);
#endif
cur->content = NULL;
}
if (cur->children != NULL) xmlFreeNodeList(cur->children); if (cur->children != NULL) xmlFreeNodeList(cur->children);
cur->children = xmlStringGetNodeList(cur->doc, content); cur->children = xmlStringGetNodeList(cur->doc, content);
UPDATE_LAST_CHILD_AND_PARENT(cur) UPDATE_LAST_CHILD_AND_PARENT(cur)
@ -3635,14 +3604,6 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
switch (cur->type) { switch (cur->type) {
case XML_DOCUMENT_FRAG_NODE: case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE: case XML_ELEMENT_NODE:
if (cur->content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
xmlFree(cur->content);
#else
xmlBufferFree(cur->content);
#endif
cur->content = NULL;
}
if (cur->children != NULL) xmlFreeNodeList(cur->children); if (cur->children != NULL) xmlFreeNodeList(cur->children);
cur->children = xmlStringLenGetNodeList(cur->doc, content, len); cur->children = xmlStringLenGetNodeList(cur->doc, content, len);
UPDATE_LAST_CHILD_AND_PARENT(cur) UPDATE_LAST_CHILD_AND_PARENT(cur)
@ -3721,28 +3682,9 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
switch (cur->type) { switch (cur->type) {
case XML_DOCUMENT_FRAG_NODE: case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE: { case XML_ELEMENT_NODE: {
xmlNodePtr last = NULL, newNode; xmlNodePtr last, newNode;
if (cur->children != NULL) { last = cur->last;
last = cur->last;
} else {
if (cur->content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
cur->children = xmlStringGetNodeList(cur->doc, cur->content);
#else
cur->children = xmlStringGetNodeList(cur->doc,
xmlBufferContent(cur->content));
#endif
UPDATE_LAST_CHILD_AND_PARENT(cur)
#ifndef XML_USE_BUFFER_CONTENT
xmlFree(cur->content);
#else
xmlBufferFree(cur->content);
#endif
cur->content = NULL;
last = cur->last;
}
}
newNode = xmlNewTextLen(content, len); newNode = xmlNewTextLen(content, len);
if (newNode != NULL) { if (newNode != NULL) {
xmlAddChild(cur, newNode); xmlAddChild(cur, newNode);
@ -4738,7 +4680,9 @@ xmlIsBlankNode(xmlNodePtr node) {
const xmlChar *cur; const xmlChar *cur;
if (node == NULL) return(0); if (node == NULL) return(0);
if (node->type != XML_TEXT_NODE) return(0); if ((node->type != XML_TEXT_NODE) &&
(node->type != XML_CDATA_SECTION_NODE))
return(0);
if (node->content == NULL) return(1); if (node->content == NULL) return(1);
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
cur = node->content; cur = node->content;
@ -5619,13 +5563,14 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
if (cur->properties != NULL) if (cur->properties != NULL)
xmlAttrListDump(buf, doc, cur->properties); xmlAttrListDump(buf, doc, cur->properties);
if ((cur->content == NULL) && (cur->children == NULL) && if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
(cur->children == NULL) &&
(!xmlSaveNoEmptyTags)) { (!xmlSaveNoEmptyTags)) {
xmlBufferWriteChar(buf, "/>"); xmlBufferWriteChar(buf, "/>");
return; return;
} }
xmlBufferWriteChar(buf, ">"); xmlBufferWriteChar(buf, ">");
if (cur->content != NULL) { if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
xmlChar *buffer; xmlChar *buffer;
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
@ -6047,13 +5992,13 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
if (cur->properties != NULL) if (cur->properties != NULL)
xmlAttrListDumpOutput(buf, doc, cur->properties, encoding); xmlAttrListDumpOutput(buf, doc, cur->properties, encoding);
if ((cur->content == NULL) && (cur->children == NULL) && if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
(!xmlSaveNoEmptyTags)) { (cur->children == NULL) && (!xmlSaveNoEmptyTags)) {
xmlOutputBufferWriteString(buf, "/>"); xmlOutputBufferWriteString(buf, "/>");
return; return;
} }
xmlOutputBufferWriteString(buf, ">"); xmlOutputBufferWriteString(buf, ">");
if (cur->content != NULL) { if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
xmlChar *buffer; xmlChar *buffer;
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT

View File

@ -1421,7 +1421,8 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
} }
} else if ((cur == start) && } else if ((cur == start) &&
(list == NULL) /* looks superfluous but ... */ ) { (list == NULL) /* looks superfluous but ... */ ) {
if (cur->type == XML_TEXT_NODE) { if ((cur->type == XML_TEXT_NODE) ||
(cur->type == XML_CDATA_SECTION_NODE)) {
const xmlChar *content = cur->content; const xmlChar *content = cur->content;
if (content == NULL) { if (content == NULL) {
@ -2317,7 +2318,8 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) {
* We should have a text (or cdata) node ... * We should have a text (or cdata) node ...
*/ */
len = 0; len = 0;
if (cur->content != NULL) { if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
len = xmlStrlen(cur->content); len = xmlStrlen(cur->content);
#else #else
@ -2383,7 +2385,8 @@ xmlXPtrMatchString(const xmlChar *string, xmlNodePtr start, int startindex,
while (stringlen > 0) { while (stringlen > 0) {
if ((cur == *end) && (pos + stringlen > *endindex)) if ((cur == *end) && (pos + stringlen > *endindex))
return(0); return(0);
if (cur->content != NULL) {
if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
len = xmlStrlen(cur->content); len = xmlStrlen(cur->content);
#else #else
@ -2481,7 +2484,7 @@ xmlXPtrSearchString(const xmlChar *string, xmlNodePtr *start, int *startindex,
stringlen = xmlStrlen(string); stringlen = xmlStrlen(string);
while (cur != NULL) { while (cur != NULL) {
if (cur->content != NULL) { if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
len = xmlStrlen(cur->content); len = xmlStrlen(cur->content);
#else #else
@ -2578,7 +2581,8 @@ xmlXPtrGetLastChar(xmlNodePtr *node, int *indx) {
while (cur != NULL) { while (cur != NULL) {
if (cur->last != NULL) if (cur->last != NULL)
cur = cur->last; cur = cur->last;
else if (cur->content != NULL) { else if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL)) {
#ifndef XML_USE_BUFFER_CONTENT #ifndef XML_USE_BUFFER_CONTENT
len = xmlStrlen(cur->content); len = xmlStrlen(cur->content);
#else #else