diff --git a/ChangeLog b/ChangeLog index 53a0ad52..9fd20833 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Mon Nov 13 12:39:38 CET 2000 Daniel Veillard + + * parser.[ch] parserInternals.c: applied the conditional + section processing fix from Jonathan P Springer + + * xmlversion.h.in win32/libxml2/libxml2.dsp : Updated MS + project file, fixed iconv default non support + * xpath.c: fixed the problem of evaluating relative expressions + when a node context is provided. + Sun Nov 12 16:31:19 CET 2000 Daniel Veillard * nanoftp.c: fixed gcc 2.95 new warnings diff --git a/include/libxml/parser.h b/include/libxml/parser.h index 3d7eb433..ac398b7c 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -99,7 +99,8 @@ typedef enum { XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG /* the Misc* after the last end tag */ + XML_PARSER_EPILOG, /* the Misc* after the last end tag */ + XML_PARSER_IGNORE /* within an IGNORED section */ } xmlParserInputState; /** diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index 86f88553..71ab184c 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -89,11 +89,13 @@ extern void xmlCheckVersion(int version); /* * Whether iconv support is available */ +#ifndef WIN32 #if @WITH_ICONV@ #define LIBXML_ICONV_ENABLED #else #define LIBXML_ICONV_DISABLED #endif +#endif /* * Whether Debugging module is configured in diff --git a/parser.c b/parser.c index 054f6308..16929b68 100644 --- a/parser.c +++ b/parser.c @@ -661,6 +661,9 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { */ if ((ctxt->external == 0) && (ctxt->inputNr == 1)) return; + break; + case XML_PARSER_IGNORE: + return; } NEXT; @@ -4501,6 +4504,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { } else if ((RAW == 'I') && (NXT(1) == 'G') && (NXT(2) == 'N') && (NXT(3) == 'O') && (NXT(4) == 'R') && (NXT(5) == 'E')) { int state; + int instate; + int depth = 0; SKIP(6); SKIP_BLANKS; @@ -4528,40 +4533,27 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { * But disable SAX event generating DTD building in the meantime */ state = ctxt->disableSAX; + instate = ctxt->instate; ctxt->disableSAX = 1; - while ((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') || - (NXT(2) != '>'))) { - const xmlChar *check = CUR_PTR; - int cons = ctxt->input->consumed; - int tok = ctxt->token; + ctxt->instate = XML_PARSER_IGNORE; - if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { - xmlParseConditionalSections(ctxt); - } else if (IS_BLANK(CUR)) { - NEXT; - } else if (RAW == '%') { - xmlParsePEReference(ctxt); - } else - xmlParseMarkupDecl(ctxt); - - /* - * Pop-up of finished entities. - */ - while ((RAW == 0) && (ctxt->inputNr > 1)) - xmlPopInput(ctxt); - - if ((CUR_PTR == check) && (cons == ctxt->input->consumed) && - (tok == ctxt->token)) { - ctxt->errNo = XML_ERR_EXT_SUBSET_NOT_FINISHED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Content error in the external subset\n"); - ctxt->wellFormed = 0; - ctxt->disableSAX = 1; - break; - } + while (depth >= 0) { + if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { + depth++; + SKIP(3); + continue; + } + if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) { + if (--depth >= 0) SKIP(3); + continue; + } + NEXT; + continue; } + ctxt->disableSAX = state; + ctxt->instate = instate; + if (xmlParserDebugEntities) { if ((ctxt->input != NULL) && (ctxt->input->filename)) xmlGenericError(xmlGenericErrorContext, @@ -7379,6 +7371,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { case XML_PARSER_PI: xmlGenericError(xmlGenericErrorContext, "PP: try PI\n");break; + case XML_PARSER_IGNORE: + xmlGenericError(xmlGenericErrorContext, + "PP: try IGNORE\n");break; } #endif @@ -7590,6 +7585,15 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { #endif } break; + case XML_PARSER_IGNORE: + xmlGenericError(xmlGenericErrorContext, + "PP: internal error, state == IGNORE"); + ctxt->instate = XML_PARSER_DTD; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "PP: entering DTD\n"); +#endif + break; case XML_PARSER_PROLOG: SKIP_BLANKS; if (ctxt->input->buf == NULL) diff --git a/parser.h b/parser.h index 3d7eb433..ac398b7c 100644 --- a/parser.h +++ b/parser.h @@ -99,7 +99,8 @@ typedef enum { XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG /* the Misc* after the last end tag */ + XML_PARSER_EPILOG, /* the Misc* after the last end tag */ + XML_PARSER_IGNORE /* within an IGNORED section */ } xmlParserInputState; /** diff --git a/parserInternals.c b/parserInternals.c index 6ab5c5bd..d9cde918 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -3196,6 +3196,8 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { case XML_PARSER_ATTRIBUTE_VALUE: /* ctxt->token = xmlParseCharRef(ctxt); */ return; + case XML_PARSER_IGNORE: + return; } return; } @@ -3268,6 +3270,8 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { ctxt->wellFormed = 0; ctxt->disableSAX = 1; return; + case XML_PARSER_IGNORE: + return; } /* TODO: this seems not reached anymore .... Verify ... */ diff --git a/win32/libxml2/libxml2.dsp b/win32/libxml2/libxml2.dsp index 52c24fdc..14dbb220 100644 --- a/win32/libxml2/libxml2.dsp +++ b/win32/libxml2/libxml2.dsp @@ -26,7 +26,6 @@ CFG=libxml2 - Win32 Debug # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe -F90=df.exe RSC=rc.exe !IF "$(CFG)" == "libxml2 - Win32 Release" @@ -41,6 +40,7 @@ RSC=rc.exe # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" +F90=df.exe # ADD BASE F90 /include:"Release/" # ADD F90 /include:"Release/" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c @@ -66,6 +66,7 @@ LIB32=link.exe -lib # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" +F90=df.exe # ADD BASE F90 /include:"Debug/" # ADD F90 /include:"Debug/" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c @@ -106,6 +107,10 @@ SOURCE=..\..\error.c # End Source File # Begin Source File +SOURCE=..\..\hash.c +# End Source File +# Begin Source File + SOURCE=..\..\HTMLparser.c # End Source File # Begin Source File diff --git a/xmlversion.h.in b/xmlversion.h.in index 86f88553..71ab184c 100644 --- a/xmlversion.h.in +++ b/xmlversion.h.in @@ -89,11 +89,13 @@ extern void xmlCheckVersion(int version); /* * Whether iconv support is available */ +#ifndef WIN32 #if @WITH_ICONV@ #define LIBXML_ICONV_ENABLED #else #define LIBXML_ICONV_DISABLED #endif +#endif /* * Whether Debugging module is configured in diff --git a/xpath.c b/xpath.c index 6b95b5a5..29917117 100644 --- a/xpath.c +++ b/xpath.c @@ -5520,7 +5520,7 @@ xmlXPathEvalLocationPath(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { xmlXPathParserContextPtr ctxt; - xmlXPathObjectPtr res = NULL, tmp; + xmlXPathObjectPtr res = NULL, tmp, init = NULL; int stack = 0; xmlXPathInit(); @@ -5528,6 +5528,10 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { CHECK_CONTEXT(ctx) ctxt = xmlXPathNewParserContext(str, ctx); + if (ctx->node != NULL) { + init = xmlXPathNewNodeSet(ctx->node); + valuePush(ctxt, init); + } xmlXPathEvalExpr(ctxt); if (ctxt->value == NULL) { @@ -5540,8 +5544,9 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { do { tmp = valuePop(ctxt); if (tmp != NULL) { + if (tmp != init) + stack++; xmlXPathFreeObject(tmp); - stack++; } } while (tmp != NULL); if (stack != 0) {