From c1f78343b6b1e566147d90f43d13fe514fb2f214 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sat, 10 Nov 2001 11:43:05 +0000 Subject: [PATCH] fix comment in scripts element parsing. updated the results. Daniel * HTMLparser.c: fix comment in scripts element parsing. * result/HTML/doc3*: updated the results. Daniel --- ChangeLog | 9 ++++++ HTMLparser.c | 35 ++++++++++++++++++++- result/HTML/doc3.htm | 6 ++-- result/HTML/doc3.htm.err | 12 ------- result/HTML/doc3.htm.sax | 67 ++++++++++++++++++++++++++++++++-------- 5 files changed, 100 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 153a9ae2..dc68cf0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Nov 10 12:33:38 CET 2001 Daniel Veillard + + * HTMLparser.c: fix comment in scripts element parsing. + * result/HTML/doc3*: updated the results. + +Sat Nov 10 11:18:18 CET 2001 Daniel Veillard + + * uri.c: another URI bug fix #63336, using Joel Young patch. + Sat Nov 10 11:07:26 CET 2001 Daniel Veillard * debugXML.c include/libxml/debugXML.h: add xmlGetNodePath() diff --git a/HTMLparser.c b/HTMLparser.c index af941a0e..8ff74e47 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -53,6 +53,7 @@ static int htmlOmittedDefaultValue = 1; xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, xmlChar end, xmlChar end2, xmlChar end3); +static void htmlParseComment(htmlParserCtxtPtr ctxt); /************************************************************************ * * @@ -2299,7 +2300,21 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { SHRINK; cur = CUR; while (IS_CHAR(cur)) { - if ((cur == '<') && (NXT(1) == '/')) { + if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') && + (NXT(3) == '-')) { + if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { + if (ctxt->sax->cdataBlock!= NULL) { + /* + * Insert as CDATA, which is the same as HTML_PRESERVE_NODE + */ + ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } + } + nbchar = 0; + htmlParseComment(ctxt); + cur = CUR; + continue; + } else if ((cur == '<') && (NXT(1) == '/')) { /* * One should break here, the specification is clear: * Authors should therefore escape "input; if (in == NULL) return(-1); @@ -3859,6 +3875,23 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, if (third) len -= 2; else if (next) len --; for (;base < len;base++) { + if (!incomment && (base + 4 < len)) { + if ((buf[base] == '<') && (buf[base + 1] == '!') && + (buf[base + 2] == '-') && (buf[base + 3] == '-')) { + incomment = 1; + } + /* do not increment base, some people use */ + } + if (incomment) { + if (base + 3 < len) + return(-1); + if ((buf[base] == '-') && (buf[base + 1] == '-') && + (buf[base + 2] == '>')) { + incomment = 0; + base += 2; + } + continue; + } if (buf[base] == first) { if (third != 0) { if ((buf[base + 1] != next) || diff --git a/result/HTML/doc3.htm b/result/HTML/doc3.htm index cdc4dc15..f5c674fe 100644 --- a/result/HTML/doc3.htm +++ b/result/HTML/doc3.htm @@ -354,7 +354,7 @@ eval("page" + id + " = window.open(URL, '" + id + "', 'toolbars=0, scrollbars=0, document.write("SRC=http://www.goto.com/d/ssn/dynconsole/?t"); document.write("ype=html&size=100x90&url=http://www.goto.co"); document.write("m/d/search/ssn/&target=_blank&Partner=SSN80"); - document.write("42DF8478957377>"); + document.write("42DF8478957377>"); } else if ((parseInt(navigator.appVersion) > 3) && (navigator.appName == "Netscape")) { document.write("

diff --git a/result/HTML/doc3.htm.err b/result/HTML/doc3.htm.err index 949fefbf..30688eb1 100644 --- a/result/HTML/doc3.htm.err +++ b/result/HTML/doc3.htm.err @@ -40,18 +40,6 @@ om/ad_static.asp?pid=2097&sid=1881&asid=7708">

' -SAX.error: Unexpected end tag : sc -SAX.cdata("); - document.write("RI, 361) -SAX.error: Unexpected end tag : a -SAX.cdata("); + , 9) +SAX.comment( + if ((parseInt(navigator.appVersion) >= 3) + && (navigator.appName != "Netscape")) { + document.write(""); + } else if ((parseInt(navigator.appVersion) > 3) + && (navigator.appName == "Netscape")) { + document.write("