Commit 39c7d71a authored by Daniel Veillard's avatar Daniel Veillard

Jumbo patch, resync of W3C/Gnome CVS trees:

- uri.c tree.c SAX.c parser.c entities.c debugXML.c: finished
  the cleanup of the computation of URI references when seeking
  external entities. The URI reference string and the resulting
  URI are both stored now.
- parser.c HTMLparser.c valid.c nanoftp.c nanohttp.c xpath.c:
  large s(n)printf checks and cleanup from Denis Barbier
  <barbier@imacs.polytechnique.fr>
- xmlversion.h.in tree.h: couple of SGML declarations for a
  possible docbook module.
- result/VC/ : a couple of test output changed due to the change
  of the entities URI
Daniel
parent b513f5a0
Sun Sep 10 17:53:48 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* uri.c tree.c SAX.c parser.c entities.c debugXML.c: finished
the cleanup of the computation of URI references when seeking
external entities. The URI reference string and the resulting
URI are both stored now.
* parser.c HTMLparser.c valid.c nanoftp.c nanohttp.c xpath.c:
large s(n)printf checks and cleanup from Denis Barbier
<barbier@imacs.polytechnique.fr>
* xmlversion.h.in tree.h: couple of SGML declarations for a
possible docbook module.
* result/VC/ : a couple of test output changed due to the change
of the entities URI
Sun Sep 10 15:59:58 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.h: added a _private field for linking user's data
......
......@@ -630,7 +630,7 @@ htmlTagLookup(const xmlChar *tag) {
int
htmlCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
int i, index;
char **close;
char **close = NULL;
if (htmlStartCloseIndexinitialized == 0) htmlInitAutoClose();
......@@ -3535,6 +3535,10 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
xmlMalloc(5 * sizeof(htmlParserInputPtr));
if (ctxt->inputTab == NULL) {
fprintf(stderr, "htmlInitParserCtxt: out of memory\n");
ctxt->inputNr = 0;
ctxt->inputMax = 0;
ctxt->input = NULL;
return;
}
ctxt->inputNr = 0;
ctxt->inputMax = 5;
......@@ -3546,12 +3550,35 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
/* Allocate the Node stack */
ctxt->nodeTab = (htmlNodePtr *) xmlMalloc(10 * sizeof(htmlNodePtr));
if (ctxt->nodeTab == NULL) {
fprintf(stderr, "htmlInitParserCtxt: out of memory\n");
ctxt->nodeNr = 0;
ctxt->nodeMax = 0;
ctxt->node = NULL;
ctxt->inputNr = 0;
ctxt->inputMax = 0;
ctxt->input = NULL;
return;
}
ctxt->nodeNr = 0;
ctxt->nodeMax = 10;
ctxt->node = NULL;
/* Allocate the Name stack */
ctxt->nameTab = (xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
if (ctxt->nameTab == NULL) {
fprintf(stderr, "htmlInitParserCtxt: out of memory\n");
ctxt->nameNr = 0;
ctxt->nameMax = 10;
ctxt->name = NULL;
ctxt->nodeNr = 0;
ctxt->nodeMax = 0;
ctxt->node = NULL;
ctxt->inputNr = 0;
ctxt->inputMax = 0;
ctxt->input = NULL;
return;
}
ctxt->nameNr = 0;
ctxt->nameMax = 10;
ctxt->name = NULL;
......
......@@ -181,12 +181,13 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
return(-1);
if (encoding != NULL) {
#ifndef HAVE_SNPRINTF
#ifdef HAVE_SNPRINTF
snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s",
encoding);
#else
sprintf(newcontent, "text/html; charset=%s", encoding);
#else /* HAVE_SNPRINTF */
snprintf(newcontent, 99, "text/html; charset=%s", encoding);
#endif /* HAVE_SNPRINTF */
newcontent[99] = 0;
#endif
newcontent[sizeof(newcontent) - 1] = 0;
}
cur = doc->children;
......
......@@ -311,13 +311,26 @@ xmlParserInputPtr
resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr ret;
char *URI;
const char *base = NULL;
if (ctxt->input != NULL)
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, base);
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.resolveEntity(%s, %s)\n", publicId, systemId);
#endif
return(xmlLoadExternalEntity((const char *) systemId,
(const char *) publicId, ctxt));
ret = xmlLoadExternalEntity((const char *) URI,
(const char *) publicId, ctxt);
if (URI != NULL)
xmlFree(URI);
return(ret);
}
/**
......@@ -409,6 +422,18 @@ entityDecl(void *ctx, const xmlChar *name, int type,
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt,
"Entity(%s) already defined in the internal subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
char *URI;
const char *base = NULL;
if (ctxt->input != NULL)
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, base);
ent->URI = URI;
}
} else if (ctxt->inSubset == 2) {
ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId,
systemId, content);
......@@ -416,6 +441,18 @@ entityDecl(void *ctx, const xmlChar *name, int type,
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt,
"Entity(%s) already defined in the external subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
char *URI;
const char *base = NULL;
if (ctxt->input != NULL)
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, base);
ent->URI = URI;
}
} else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt,
......@@ -1603,3 +1640,73 @@ htmlDefaultSAXHandlerInit(void)
htmlDefaultSAXHandler.error = xmlParserError;
htmlDefaultSAXHandler.fatalError = xmlParserError;
}
/*
* Default handler for HTML, builds the DOM tree
*/
xmlSAXHandler sgmlDefaultSAXHandler = {
internalSubset,
NULL,
NULL,
NULL,
NULL,
getEntity,
NULL,
NULL,
NULL,
NULL,
NULL,
setDocumentLocator,
startDocument,
endDocument,
startElement,
endElement,
NULL,
characters,
ignorableWhitespace,
NULL,
comment,
xmlParserWarning,
xmlParserError,
xmlParserError,
getParameterEntity,
NULL,
NULL,
};
/**
* sgmlDefaultSAXHandlerInit:
*
* Initialize the default SAX handler
*/
void
sgmlDefaultSAXHandlerInit(void)
{
sgmlDefaultSAXHandler.internalSubset = internalSubset;
sgmlDefaultSAXHandler.externalSubset = NULL;
sgmlDefaultSAXHandler.isStandalone = NULL;
sgmlDefaultSAXHandler.hasInternalSubset = NULL;
sgmlDefaultSAXHandler.hasExternalSubset = NULL;
sgmlDefaultSAXHandler.resolveEntity = NULL;
sgmlDefaultSAXHandler.getEntity = getEntity;
sgmlDefaultSAXHandler.getParameterEntity = NULL;
sgmlDefaultSAXHandler.entityDecl = NULL;
sgmlDefaultSAXHandler.attributeDecl = NULL;
sgmlDefaultSAXHandler.elementDecl = NULL;
sgmlDefaultSAXHandler.notationDecl = NULL;
sgmlDefaultSAXHandler.unparsedEntityDecl = NULL;
sgmlDefaultSAXHandler.setDocumentLocator = setDocumentLocator;
sgmlDefaultSAXHandler.startDocument = startDocument;
sgmlDefaultSAXHandler.endDocument = endDocument;
sgmlDefaultSAXHandler.startElement = startElement;
sgmlDefaultSAXHandler.endElement = endElement;
sgmlDefaultSAXHandler.reference = NULL;
sgmlDefaultSAXHandler.characters = characters;
sgmlDefaultSAXHandler.cdataBlock = NULL;
sgmlDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
sgmlDefaultSAXHandler.processingInstruction = NULL;
sgmlDefaultSAXHandler.comment = comment;
sgmlDefaultSAXHandler.warning = xmlParserWarning;
sgmlDefaultSAXHandler.error = xmlParserError;
sgmlDefaultSAXHandler.fatalError = xmlParserError;
}
......@@ -109,6 +109,7 @@ void cdataBlock (void *ctx,
void xmlDefaultSAXHandlerInit (void);
void htmlDefaultSAXHandlerInit (void);
void sgmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
}
#endif
......
......@@ -249,11 +249,11 @@ void xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) {
break;
}
if (elem->content != NULL) {
char buf[1001];
char buf[5001];
buf[0] = 0;
xmlSprintfElementContent(buf, elem->content, 1);
buf[1000] = 0;
buf[5000] = 0;
fprintf(output, "%s", buf);
}
printf("\n");
......@@ -325,15 +325,19 @@ void xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) {
}
if (ent->ExternalID) {
fprintf(output, shift);
fprintf(output, "ExternalID=%s\n", ent->ExternalID);
fprintf(output, " ExternalID=%s\n", ent->ExternalID);
}
if (ent->SystemID) {
fprintf(output, shift);
fprintf(output, "SystemID=%s\n", ent->SystemID);
fprintf(output, " SystemID=%s\n", ent->SystemID);
}
if (ent->URI != NULL) {
fprintf(output, shift);
fprintf(output, " URI=%s\n", ent->URI);
}
if (ent->content) {
fprintf(output, shift);
fprintf(output, "content=");
fprintf(output, " content=");
xmlDebugDumpString(output, ent->content);
fprintf(output, "\n");
}
......@@ -434,6 +438,10 @@ void xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) {
fprintf(output, shift);
fprintf(output, "SystemID=%s\n", ent->SystemID);
}
if (ent->URI) {
fprintf(output, shift);
fprintf(output, "URI=%s\n", ent->URI);
}
if (ent->content) {
fprintf(output, shift);
fprintf(output, "content=");
......@@ -618,7 +626,7 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) {
void xmlDebugDumpNode(FILE *output, xmlNodePtr node, int depth) {
xmlDebugDumpOneNode(output, node, depth);
if (node->children != NULL)
if ((node->children != NULL) && (node->type != XML_ENTITY_REF_NODE))
xmlDebugDumpNodeList(output, node->children, depth + 1);
}
......@@ -695,6 +703,11 @@ void xmlDebugDumpDocumentHead(FILE *output, xmlDocPtr doc) {
xmlDebugDumpString(output, doc->encoding);
fprintf(output, "\n");
}
if (doc->URL != NULL) {
fprintf(output, "URL=");
xmlDebugDumpString(output, doc->URL);
fprintf(output, "\n");
}
if (doc->standalone)
fprintf(output, "standalone=true\n");
if (doc->oldNs != NULL)
......@@ -714,6 +727,47 @@ void xmlDebugDumpDocument(FILE *output, xmlDocPtr doc) {
xmlDebugDumpNodeList(output, doc->children, 1);
}
void xmlDebugDumpDTD(FILE *output, xmlDtdPtr dtd) {
if (dtd == NULL)
return;
if (dtd->type != XML_DTD_NODE) {
fprintf(output, "PBM: not a DTD\n");
return;
}
if (dtd->name != NULL)
fprintf(output, "DTD(%s)", dtd->name);
else
fprintf(output, "DTD");
if (dtd->ExternalID != NULL)
fprintf(output, ", PUBLIC %s", dtd->ExternalID);
if (dtd->SystemID != NULL)
fprintf(output, ", SYSTEM %s", dtd->SystemID);
fprintf(output, "\n");
/*
* Do a bit of checking
*/
if ((dtd->parent != NULL) && (dtd->doc != dtd->parent->doc))
fprintf(output, "PBM: Dtd doc differs from parent's one\n");
if (dtd->prev == NULL) {
if ((dtd->parent != NULL) && (dtd->parent->children != (xmlNodePtr)dtd))
fprintf(output, "PBM: Dtd has no prev and not first of list\n");
} else {
if (dtd->prev->next != (xmlNodePtr) dtd)
fprintf(output, "PBM: Dtd prev->next : back link wrong\n");
}
if (dtd->next == NULL) {
if ((dtd->parent != NULL) && (dtd->parent->last != (xmlNodePtr) dtd))
fprintf(output, "PBM: Dtd has no next and not last of list\n");
} else {
if (dtd->next->prev != (xmlNodePtr) dtd)
fprintf(output, "PBM: Dtd next->prev : forward link wrong\n");
}
if (dtd->children == NULL)
fprintf(output, " DTD is empty\n");
else
xmlDebugDumpNodeList(output, dtd->children, 1);
}
void xmlDebugDumpEntities(FILE *output, xmlDocPtr doc) {
int i;
xmlEntityPtr cur;
......@@ -1456,9 +1510,29 @@ xmlShellPwd(xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node,
next = cur->parent;
}
if (occur == 0)
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), "%c%s%s", sep, name, buffer);
#else
sprintf(buf, "%c%s%s", sep, name, buffer);
else
#endif
else
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), "%c%s[%d]%s",
sep, name, occur, buffer);
#else
sprintf(buf, "%c%s[%d]%s", sep, name, occur, buffer);
#endif
buf[sizeof(buf) - 1] = 0;
/*
* This test prevents buffer overflow, because this routine
* is only called by xmlShell, in which the second argument is
* 500 chars long.
* It is a dirty hack before a cleaner solution is found.
* Documentation should mention that the second argument must
* be at least 500 chars long, and could be stripped if too long.
*/
if (strlen(buffer) + strlen(buf) > 499)
break;
strcpy(buffer, buf);
cur = next;
} while (cur != NULL);
......@@ -1516,9 +1590,14 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
if (ctxt->node == (xmlNodePtr) ctxt->doc)
sprintf(prompt, "%s > ", "/");
else if (ctxt->node->name)
sprintf(prompt, "%s > ", ctxt->node->name);
else
#ifdef HAVE_SNPRINTF
snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
#else
sprintf(buf, "%s > ", ctxt->node->name);
#endif
else
sprintf(prompt, "? > ");
prompt[sizeof(prompt) - 1] = 0;
cmdline = ctxt->input(prompt);
if (cmdline == NULL) break;
......
......@@ -42,6 +42,8 @@ void xmlDebugDumpDocumentHead(FILE *output,
xmlDocPtr doc);
void xmlDebugDumpDocument (FILE *output,
xmlDocPtr doc);
void xmlDebugDumpDTD (FILE *output,
xmlDtdPtr doc);
void xmlDebugDumpEntities (FILE *output,
xmlDocPtr doc);
void xmlLsOneNode (FILE *output,
......
......@@ -76,6 +76,8 @@ void xmlFreeEntity(xmlEntityPtr entity) {
xmlFree((char *) entity->ExternalID);
if (entity->SystemID != NULL)
xmlFree((char *) entity->SystemID);
if (entity->URI != NULL)
xmlFree((char *) entity->URI);
if (entity->content != NULL)
xmlFree((char *) entity->content);
if (entity->orig != NULL)
......@@ -198,6 +200,8 @@ xmlAddEntity(xmlEntitiesTablePtr table, const xmlChar *name, int type,
ret->length = 0;
ret->content = NULL;
}
ret->URI = NULL; /* to be computed by the layer knowing
the defining entity */
ret->orig = NULL;
table->nb_entities++;
......@@ -590,8 +594,6 @@ xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) {
xmlEntitiesTablePtr table;
xmlEntityPtr ret;
if (doc == NULL)
return(NULL);
if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
table = (xmlEntitiesTablePtr) doc->intSubset->entities;
ret = xmlGetEntityFromTable(table, name, 1);
......@@ -619,8 +621,6 @@ xmlEntityPtr
xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) {
xmlEntitiesTablePtr table;
if (doc == NULL)
return(NULL);
if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
table = (xmlEntitiesTablePtr) doc->extSubset->entities;
return(xmlGetEntityFromTable(table, name, 0));
......@@ -783,11 +783,13 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
#ifndef USE_UTF_8
} else if ((sizeof(xmlChar) == 1) && (*cur >= 0x80)) {
char buf[10], *ptr;
#ifdef HAVE_SNPRINTF
snprintf(buf, 9, "&#%d;", *cur);
snprintf(buf, sizeof(buf), "&#%d;", *cur);
#else
sprintf(buf, "&#%d;", *cur);
#endif
buf[sizeof(buf) - 1] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
#endif
......@@ -795,10 +797,11 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
char buf[10], *ptr;
#ifdef HAVE_SNPRINTF
snprintf(buf, 9, "&#%d;", *cur);
snprintf(buf, sizeof(buf), "&#%d;", *cur);
#else
sprintf(buf, "&#%d;", *cur);
#endif
buf[sizeof(buf) - 1] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
}
......@@ -918,9 +921,15 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
} else if (*cur >= 0x80) {
if ((doc->encoding != NULL) || (html)) {
/*
* TODO !!!
* Bjrn Reese <br@sseusa.com> provided the patch
xmlChar xc;
xc = (*cur & 0x3F) << 6;
if (cur[1] != 0) {
xc += *(++cur) & 0x3F;
*out++ = xc;
} else
*/
*out++ = *cur;
*out++ = *cur;
} else {
/*
* We assume we have UTF-8 input.
......@@ -933,10 +942,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
"xmlEncodeEntitiesReentrant : input not UTF-8\n");
doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
#ifdef HAVE_SNPRINTF
snprintf(buf, 9, "&#%d;", *cur);
snprintf(buf, sizeof(buf), "&#%d;", *cur);
#else
sprintf(buf, "&#%d;", *cur);
#endif
buf[sizeof(buf) - 1] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
continue;
......@@ -967,11 +977,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
"xmlEncodeEntitiesReentrant : char out of range\n");
doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
#ifdef HAVE_SNPRINTF
snprintf(buf, 9, "&#%d;", *cur);
snprintf(buf, sizeof(buf), "&#%d;", *cur);
#else
sprintf(buf, "&#%d;", *cur);
#endif
buf[9] = 0;
buf[sizeof(buf) - 1] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
cur++;
......@@ -981,11 +991,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
* We could do multiple things here. Just save as a char ref
*/
#ifdef HAVE_SNPRINTF
snprintf(buf, 9, "&#x%X;", val);
snprintf(buf, sizeof(buf), "&#x%X;", val);
#else
sprintf(buf, "&#x%X;", val);
#endif
buf[9] = 0;
buf[sizeof(buf) - 1] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
cur += l;
......@@ -995,11 +1005,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
char buf[10], *ptr;
#ifdef HAVE_SNPRINTF
snprintf(buf, 9, "&#%d;", *cur);
snprintf(buf, sizeof(buf), "&#%d;", *cur);
#else
sprintf(buf, "&#%d;", *cur);
#endif
buf[9] = 0;
buf[sizeof(buf) - 1] = 0;
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
}
......
......@@ -55,6 +55,7 @@ struct _xmlEntity {
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
struct _xmlEntity *nexte; /* next entity in the hash table */
const xmlChar *URI; /* the full URI as computed */
#ifdef WITH_EXTRA_ENT_DETECT
/* Referenced entities name stack */
......
......@@ -87,28 +87,32 @@ void
xmlParserError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input;
xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
va_list args;
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
if (ctxt != NULL) {
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) &&
(ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
}
xmlParserPrintFileInfo(input);
}
xmlParserPrintFileInfo(input);
fprintf(stderr, "error: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
xmlParserPrintFileContext(input);
if (cur != NULL) {
xmlParserPrintFileInfo(cur);
fprintf(stderr, "\n");
xmlParserPrintFileContext(cur);
if (ctxt != NULL) {
xmlParserPrintFileContext(input);
if (cur != NULL) {
xmlParserPrintFileInfo(cur);
fprintf(stderr, "\n");
xmlParserPrintFileContext(cur);
}
}
}
......@@ -125,29 +129,32 @@ void
xmlParserWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input;
xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
va_list args;
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
if (ctxt != NULL) {
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) &&
(ctxt->inputNr > 1)) {
cur = input;
input = ctxt->inputTab[ctxt->inputNr - 2];
}
xmlParserPrintFileInfo(input);
}
xmlParserPrintFileInfo(input);
fprintf(stderr, "warning: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
xmlParserPrintFileContext(input);
if (cur != NULL) {
xmlParserPrintFileInfo(cur);
fprintf(stderr, "\n");
xmlParserPrintFileContext(cur);
if (ctxt != NULL) {
xmlParserPrintFileContext(input);
if (cur != NULL) {
xmlParserPrintFileInfo(cur);
fprintf(stderr, "\n");
xmlParserPrintFileContext(cur);
}
}
}
......@@ -164,21 +171,25 @@ void
xmlParserValidityError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input;
xmlParserInputPtr input = NULL;
va_list args;
input = ctxt->input;
if ((input->filename == NULL) && (ctxt->inputNr > 1))
input = ctxt->inputTab[ctxt->inputNr - 2];
xmlParserPrintFileInfo(input);
if (ctxt != NULL) {
input = ctxt->input;
if ((input->filename == NULL) && (ctxt->inputNr > 1))
input = ctxt->inputTab[ctxt->inputNr - 2];
xmlParserPrintFileInfo(input);
}
fprintf(stderr, "validity error: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
xmlParserPrintFileContext(input);
if (ctxt != NULL) {
xmlParserPrintFileContext(input);
}
}
/**
......@@ -194,20 +205,24 @@ void
xmlParserValidityWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input;
xmlParserInputPtr input = NULL;
va_list args;