1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-28 00:21:53 +03:00

- Large resync between W3C and Gnome tree

- configure.in: 2.1.0 prerelease
- example/Makefile.am example/gjobread.c tree.h: work on
  libxml1 libxml2 convergence.
- nanoftp, nanohttp.c: fixed stalled connections probs
- HTMLtree.c SAX.c : support for attribute without values in
  HTML for andersca
- valid.c: Fixed most validation + namespace problems
- HTMLparser.c: start document callback for andersca
- debugXML.c xpath.c: lots of XPath fixups from Picdar Technology
- parser.h, SAX.c: serious speed improvement for large
  CDATA blocks
- encoding.[ch] xmlIO.[ch]: Improved seriously saving to
  different encoding
- config.h.in parser.c xmllint.c: added xmlCheckVersion()
  and the LIBXML_TEST_VERSION macro
Daniel
This commit is contained in:
Daniel Veillard
2000-06-28 23:40:59 +00:00
parent c310d56482
commit be803967db
41 changed files with 2877 additions and 1562 deletions

View File

@ -388,6 +388,7 @@ char *htmlStartClose[] = {
NULL
};
static char** htmlStartCloseIndex[100];
static int htmlStartCloseIndexinitialized = 0;
@ -604,6 +605,54 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *new) {
}
}
/**
* htmlCheckImplied:
* @ctxt: an HTML parser context
* @new: The new tag name
*
* The HTmL DtD allows a tag to exists only implicitely
* called when a new tag has been detected and generates the
* appropriates implicit tags if missing
*/
void
htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *new) {
if (!strcmp(new, "html"))
return;
if (ctxt->nameNr <= 0) {
#ifdef DEBUG
fprintf(stderr,"Implied element html: pushed html\n");
#endif
htmlnamePush(ctxt, xmlStrdup(BAD_CAST"html"));
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL);
}
if ((!strcmp(new, "body")) || (!strcmp(new, "head")))
return;
if (ctxt->nameNr <= 1) {
if ((!strcmp(new, "script")) || (!strcmp(new, "style")) ||
(!strcmp(new, "meta")) || (!strcmp(new, "link")) ||
(!strcmp(new, "title")) || (!strcmp(new, "base"))) {
/*
* dropped OBJECT ... i you put it first BODY will be
* assumed !
*/
#ifdef DEBUG
fprintf(stderr,"Implied element head: pushed head\n");
#endif
htmlnamePush(ctxt, xmlStrdup(BAD_CAST"head"));
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
ctxt->sax->startElement(ctxt->userData, BAD_CAST"head", NULL);
} else {
#ifdef DEBUG
fprintf(stderr,"Implied element body: pushed body\n");
#endif
htmlnamePush(ctxt, xmlStrdup(BAD_CAST"body"));
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
ctxt->sax->startElement(ctxt->userData, BAD_CAST"body", NULL);
}
}
}
/************************************************************************
* *
* The list of HTML predefined entities *
@ -1322,6 +1371,7 @@ htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) {
BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
else
xmlCreateIntSubset(cur, BAD_CAST "HTML", ExternalID, URI);
cur->doc = cur;
cur->name = NULL;
cur->children = NULL;
cur->extSubset = NULL;
@ -2161,11 +2211,12 @@ htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) {
NEXT;
SKIP_BLANKS;
val = htmlParseAttValue(ctxt);
/******
} else {
/* TODO : some attribute must have values, some may not */
* TODO : some attribute must have values, some may not
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->warning(ctxt->userData,
"No value for attribute %s\n", name);
"No value for attribute %s\n", name); */
}
*value = val;
@ -2219,6 +2270,11 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
*/
htmlAutoClose(ctxt, name);
/*
* Check for implied HTML elements.
*/
htmlCheckImplied(ctxt, name);
/*
* Now parse the attributes, it ends up with the ending
*
@ -2759,6 +2815,10 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
ctxt->wellFormed = 0;
}
if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData);
/*
* Parse possible comments before any content
*/