1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-08 17:42:14 +03:00

handling of PIs and <?sgml-declaration in entities. Daniel

* DOCBparser.c: handling of PIs and <?sgml-declaration in entities.
Daniel
This commit is contained in:
Daniel Veillard
2001-06-11 17:31:08 +00:00
parent 8bdd220eb1
commit 84666b3831
2 changed files with 93 additions and 80 deletions

View File

@@ -1,3 +1,7 @@
Mon Jun 11 19:29:40 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* DOCBparser.c: handling of PIs and <?sgml-declaration in entities.
Tue Jun 12 08:46:28 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Tue Jun 12 08:46:28 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* valid.c: fixed bug #56049, forgot one check in the * valid.c: fixed bug #56049, forgot one check in the

View File

@@ -4135,9 +4135,9 @@ docbParseReference(docbParserCtxtPtr ctxt) {
* Parse a content: comment, sub-element, reference or text. * Parse a content: comment, sub-element, reference or text.
* *
*/ */
static void static void
docbParseContent(docbParserCtxtPtr ctxt) { docbParseContent(docbParserCtxtPtr ctxt)
{
xmlChar *currentNode; xmlChar *currentNode;
int depth; int depth;
@@ -4152,7 +4152,8 @@ docbParseContent(docbParserCtxtPtr ctxt) {
*/ */
if ((CUR == '<') && (NXT(1) == '/')) { if ((CUR == '<') && (NXT(1) == '/')) {
docbParseEndTag(ctxt); docbParseEndTag(ctxt);
if (currentNode != NULL) xmlFree(currentNode); if (currentNode != NULL)
xmlFree(currentNode);
return; return;
} }
@@ -4162,7 +4163,8 @@ docbParseContent(docbParserCtxtPtr ctxt) {
*/ */
if ((!xmlStrEqual(currentNode, ctxt->name)) && if ((!xmlStrEqual(currentNode, ctxt->name)) &&
(depth >= ctxt->nameNr)) { (depth >= ctxt->nameNr)) {
if (currentNode != NULL) xmlFree(currentNode); if (currentNode != NULL)
xmlFree(currentNode);
return; return;
} }
@@ -4172,8 +4174,7 @@ docbParseContent(docbParserCtxtPtr ctxt) {
if ((CUR == '<') && (NXT(1) == '!') && if ((CUR == '<') && (NXT(1) == '!') &&
(UPP(2) == 'D') && (UPP(3) == 'O') && (UPP(2) == 'D') && (UPP(3) == 'O') &&
(UPP(4) == 'C') && (UPP(5) == 'T') && (UPP(4) == 'C') && (UPP(5) == 'T') &&
(UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) {
(UPP(8) == 'E')) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, ctxt->sax->error(ctxt->userData,
"Misplaced DOCTYPE declaration\n"); "Misplaced DOCTYPE declaration\n");
@@ -4190,14 +4191,21 @@ docbParseContent(docbParserCtxtPtr ctxt) {
} }
/* /*
* Second case : a sub-element. * Second case : a PI
*/
else if ((RAW == '<') && (NXT(1) == '?')) {
docbParsePI(ctxt);
}
/*
* Third case : a sub-element.
*/ */
else if (CUR == '<') { else if (CUR == '<') {
docbParseElement(ctxt); docbParseElement(ctxt);
} }
/* /*
* Third case : a reference. If if has not been resolved, * Fourth case : a reference. If if has not been resolved,
* parsing returns it's Name, create the node * parsing returns it's Name, create the node
*/ */
else if (CUR == '&') { else if (CUR == '&') {
@@ -4205,7 +4213,7 @@ docbParseContent(docbParserCtxtPtr ctxt) {
} }
/* /*
* Fourth : end of the resource * Fifth : end of the resource
*/ */
else if (CUR == 0) { else if (CUR == 0) {
docbAutoClose(ctxt, NULL); docbAutoClose(ctxt, NULL);
@@ -4232,7 +4240,8 @@ docbParseContent(docbParserCtxtPtr ctxt) {
GROW; GROW;
} }
if (currentNode != NULL) xmlFree(currentNode); if (currentNode != NULL)
xmlFree(currentNode);
} }
/** /**
@@ -4822,7 +4831,7 @@ docbParseMisc(xmlParserCtxtPtr ctxt) {
(NXT(2) == '-') && (NXT(3) == '-')) || (NXT(2) == '-') && (NXT(3) == '-')) ||
IS_BLANK(CUR)) { IS_BLANK(CUR)) {
if ((RAW == '<') && (NXT(1) == '?')) { if ((RAW == '<') && (NXT(1) == '?')) {
docbParsePI(ctxt); /* TODO: SGML PIs differs */ docbParsePI(ctxt);
} else if (IS_BLANK(CUR)) { } else if (IS_BLANK(CUR)) {
NEXT; NEXT;
} else } else