From 698686457e0af44ed61ad8ddaf4505da828b6c86 Mon Sep 17 00:00:00 2001 From: James Clark Date: Mon, 1 Jun 1998 04:33:10 +0000 Subject: [PATCH] Add debugging support for unparsed entities --- expat/xmlwf/xmlwf.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c index 2f0866cc..f2621343 100755 --- a/expat/xmlwf/xmlwf.c +++ b/expat/xmlwf/xmlwf.c @@ -171,6 +171,63 @@ static void processingInstruction(void *userData, const XML_Char *target, const puttc(T('>'), fp); } +#ifdef DEBUG_UNPARSED_ENTITIES + +static void unparsedEntityDecl(void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName) +{ + FILE *fp = userData; + XML_Char lit = tcschr(systemId, T('"')) ? '\'' : '"'; + fputts(T("'), fp); +} + +static void notationDecl(void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + FILE *fp = userData; + fputts(T("'), fp); +} + +#endif /* DEBUG_UNPARSED_ENTITIES */ + typedef struct { XML_Parser parser; int *retPtr; @@ -400,6 +457,10 @@ int tmain(int argc, XML_Char **argv) XML_SetCharacterDataHandler(parser, characterData); XML_SetProcessingInstructionHandler(parser, processingInstruction); } +#ifdef DEBUG_UNPARSED_ENTITIES + XML_SetUnparsedEntityDeclHandler(parser, unparsedEntityDecl); + XML_SetNotationDeclHandler(parser, notationDecl); +#endif if (processExternalEntities) { if (!XML_SetBase(parser, argv[i])) { ftprintf(stderr, T("%s: out of memory"), argv[0]); -- 2.40.0