1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-31 06:50:06 +03:00

Fixed & parsing bug, Daniel.

This commit is contained in:
Daniel Veillard 2000-06-29 09:38:26 +00:00
parent 08746ae6f0
commit 9dad02a49e
2 changed files with 22 additions and 9 deletions

View File

@ -1,4 +1,8 @@
Thu Jun 29 01:27:19 MEST 2000
Thu Jun 29 11:37:38 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.c: fixed &#38; parsing bug
Thu Jun 29 01:27:19 MEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* configure.in: 1.8.8 prerelease
* example/Makefile.am example/gjobread.c tree.h: work on

View File

@ -353,6 +353,7 @@ PUSH_AND_POP(extern, xmlChar*, name)
* COPY(to) copy one char to *to, increment CUR_PTR and to accordingly
*/
#define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
#define CUR (ctxt->token ? ctxt->token : (*ctxt->input->cur))
#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val)
#define NXT(val) ctxt->input->cur[(val)]
@ -3158,8 +3159,9 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
SHRINK;
cur = CUR;
while ((IS_CHAR(cur)) && (cur != '<') &&
(cur != '&')) {
while (((cur != '<') || (ctxt->token == '<')) &&
((cur != '&') || (ctxt->token == '&')) &&
(IS_CHAR(cur))) {
if ((cur == ']') && (NXT(1) == ']') &&
(NXT(2) == '>')) {
if (cdata) break;
@ -6176,17 +6178,24 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
int cons = ctxt->input->consumed;
xmlChar tok = ctxt->token;
/*
* Handle possible processed charrefs.
*/
if (ctxt->token != 0) {
xmlParseCharData(ctxt, 0);
}
/*
* First case : a Processing Instruction.
*/
if ((CUR == '<') && (NXT(1) == '?')) {
else if ((RAW == '<') && (NXT(1) == '?')) {
xmlParsePI(ctxt);
}
/*
* Second case : a CDSection
*/
else if ((CUR == '<') && (NXT(1) == '!') &&
else if ((RAW == '<') && (NXT(1) == '!') &&
(NXT(2) == '[') && (NXT(3) == 'C') &&
(NXT(4) == 'D') && (NXT(5) == 'A') &&
(NXT(6) == 'T') && (NXT(7) == 'A') &&
@ -6197,7 +6206,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
/*
* Third case : a comment
*/
else if ((CUR == '<') && (NXT(1) == '!') &&
else if ((RAW == '<') && (NXT(1) == '!') &&
(NXT(2) == '-') && (NXT(3) == '-')) {
xmlParseComment(ctxt);
ctxt->instate = XML_PARSER_CONTENT;
@ -6206,7 +6215,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
/*
* Fourth case : a sub-element.
*/
else if (CUR == '<') {
else if (RAW == '<') {
xmlParseElement(ctxt);
}
@ -6215,7 +6224,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
* parsing returns it's Name, create the node
*/
else if (CUR == '&') {
else if (RAW == '&') {
xmlParseReference(ctxt);
}
@ -6230,7 +6239,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
/*
* Pop-up of finished entities.
*/
while ((CUR == 0) && (ctxt->inputNr > 1))
while ((RAW == 0) && (ctxt->inputNr > 1))
xmlPopInput(ctxt);
SHRINK;