mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
parser: Remove remaining ctxt->instate checks
Now ctxt->instate is only used for push parser states.
This commit is contained in:
105
parser.c
105
parser.c
@@ -125,6 +125,9 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt);
|
|||||||
static void
|
static void
|
||||||
xmlParseElementEnd(xmlParserCtxtPtr ctxt);
|
xmlParseElementEnd(xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
|
static xmlEntityPtr
|
||||||
|
xmlParseEntityRefInternal(xmlParserCtxtPtr ctxt, int inAttr);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Arbitrary limits set in the parser. See XML_PARSE_HUGE *
|
* Arbitrary limits set in the parser. See XML_PARSE_HUGE *
|
||||||
@@ -3771,7 +3774,6 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
|
|||||||
* The content of the entity definition is copied in a buffer.
|
* The content of the entity definition is copied in a buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ctxt->instate = XML_PARSER_ENTITY_VALUE;
|
|
||||||
input = ctxt->input;
|
input = ctxt->input;
|
||||||
GROW;
|
GROW;
|
||||||
NEXT;
|
NEXT;
|
||||||
@@ -3906,12 +3908,10 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
|||||||
xmlEntityPtr ent;
|
xmlEntityPtr ent;
|
||||||
|
|
||||||
if (NXT(0) == '"') {
|
if (NXT(0) == '"') {
|
||||||
ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
|
|
||||||
limit = '"';
|
limit = '"';
|
||||||
NEXT;
|
NEXT;
|
||||||
} else if (NXT(0) == '\'') {
|
} else if (NXT(0) == '\'') {
|
||||||
limit = '\'';
|
limit = '\'';
|
||||||
ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
|
|
||||||
NEXT;
|
NEXT;
|
||||||
} else {
|
} else {
|
||||||
xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL);
|
||||||
@@ -3964,7 +3964,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
|||||||
len += xmlCopyChar(0, &buf[len], val);
|
len += xmlCopyChar(0, &buf[len], val);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ent = xmlParseEntityRef(ctxt);
|
ent = xmlParseEntityRefInternal(ctxt, /* isAttr */ 1);
|
||||||
if ((ent != NULL) &&
|
if ((ent != NULL) &&
|
||||||
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
||||||
if (len + 10 > buf_size) {
|
if (len + 10 > buf_size) {
|
||||||
@@ -4199,7 +4199,6 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
|
|||||||
XML_MAX_TEXT_LENGTH :
|
XML_MAX_TEXT_LENGTH :
|
||||||
XML_MAX_NAME_LENGTH;
|
XML_MAX_NAME_LENGTH;
|
||||||
xmlChar stop;
|
xmlChar stop;
|
||||||
int state = ctxt->instate;
|
|
||||||
|
|
||||||
if (RAW == '"') {
|
if (RAW == '"') {
|
||||||
NEXT;
|
NEXT;
|
||||||
@@ -4217,7 +4216,6 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlErrMemory(ctxt);
|
xmlErrMemory(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
ctxt->instate = XML_PARSER_SYSTEM_LITERAL;
|
|
||||||
cur = CUR_CHAR(l);
|
cur = CUR_CHAR(l);
|
||||||
while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */
|
while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */
|
||||||
if (len + 5 >= size) {
|
if (len + 5 >= size) {
|
||||||
@@ -4236,14 +4234,12 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
|
|||||||
if (len > maxLength) {
|
if (len > maxLength) {
|
||||||
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral");
|
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral");
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
ctxt->instate = (xmlParserInputState) state;
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
NEXTL(l);
|
NEXTL(l);
|
||||||
cur = CUR_CHAR(l);
|
cur = CUR_CHAR(l);
|
||||||
}
|
}
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
ctxt->instate = (xmlParserInputState) state;
|
|
||||||
if (!IS_CHAR(cur)) {
|
if (!IS_CHAR(cur)) {
|
||||||
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL);
|
||||||
} else {
|
} else {
|
||||||
@@ -4275,7 +4271,6 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
|
|||||||
XML_MAX_NAME_LENGTH;
|
XML_MAX_NAME_LENGTH;
|
||||||
xmlChar cur;
|
xmlChar cur;
|
||||||
xmlChar stop;
|
xmlChar stop;
|
||||||
xmlParserInputState oldstate = ctxt->instate;
|
|
||||||
|
|
||||||
if (RAW == '"') {
|
if (RAW == '"') {
|
||||||
NEXT;
|
NEXT;
|
||||||
@@ -4292,7 +4287,6 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlErrMemory(ctxt);
|
xmlErrMemory(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
ctxt->instate = XML_PARSER_PUBLIC_LITERAL;
|
|
||||||
cur = CUR;
|
cur = CUR;
|
||||||
while ((IS_PUBIDCHAR_CH(cur)) && (cur != stop) &&
|
while ((IS_PUBIDCHAR_CH(cur)) && (cur != stop) &&
|
||||||
(PARSER_STOPPED(ctxt) == 0)) { /* checked */
|
(PARSER_STOPPED(ctxt) == 0)) { /* checked */
|
||||||
@@ -4323,7 +4317,6 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
|
|||||||
} else {
|
} else {
|
||||||
NEXTL(1);
|
NEXTL(1);
|
||||||
}
|
}
|
||||||
ctxt->instate = oldstate;
|
|
||||||
return(buf);
|
return(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4568,9 +4561,6 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int partial) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nbchar = 0;
|
nbchar = 0;
|
||||||
/* something really bad happened in the SAX callback */
|
|
||||||
if (ctxt->instate != XML_PARSER_CONTENT)
|
|
||||||
return;
|
|
||||||
SHRINK;
|
SHRINK;
|
||||||
}
|
}
|
||||||
cur = CUR_CHAR(l);
|
cur = CUR_CHAR(l);
|
||||||
@@ -4850,7 +4840,6 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
|
|||||||
size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
|
size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
|
||||||
XML_MAX_HUGE_LENGTH :
|
XML_MAX_HUGE_LENGTH :
|
||||||
XML_MAX_TEXT_LENGTH;
|
XML_MAX_TEXT_LENGTH;
|
||||||
xmlParserInputState state;
|
|
||||||
const xmlChar *in;
|
const xmlChar *in;
|
||||||
size_t nbchar = 0;
|
size_t nbchar = 0;
|
||||||
int ccol;
|
int ccol;
|
||||||
@@ -4864,8 +4853,6 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
|
|||||||
SKIP(2);
|
SKIP(2);
|
||||||
if ((RAW != '-') || (NXT(1) != '-'))
|
if ((RAW != '-') || (NXT(1) != '-'))
|
||||||
return;
|
return;
|
||||||
state = ctxt->instate;
|
|
||||||
ctxt->instate = XML_PARSER_COMMENT;
|
|
||||||
inputid = ctxt->input->id;
|
inputid = ctxt->input->id;
|
||||||
SKIP(2);
|
SKIP(2);
|
||||||
GROW;
|
GROW;
|
||||||
@@ -4971,7 +4958,6 @@ get_more:
|
|||||||
}
|
}
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
ctxt->instate = state;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
@@ -4991,7 +4977,6 @@ get_more:
|
|||||||
}
|
}
|
||||||
} while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09) || (*in == 0x0a));
|
} while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09) || (*in == 0x0a));
|
||||||
xmlParseCommentComplex(ctxt, buf, len, size);
|
xmlParseCommentComplex(ctxt, buf, len, size);
|
||||||
ctxt->instate = state;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5129,12 +5114,9 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
XML_MAX_TEXT_LENGTH;
|
XML_MAX_TEXT_LENGTH;
|
||||||
int cur, l;
|
int cur, l;
|
||||||
const xmlChar *target;
|
const xmlChar *target;
|
||||||
xmlParserInputState state;
|
|
||||||
|
|
||||||
if ((RAW == '<') && (NXT(1) == '?')) {
|
if ((RAW == '<') && (NXT(1) == '?')) {
|
||||||
int inputid = ctxt->input->id;
|
int inputid = ctxt->input->id;
|
||||||
state = ctxt->instate;
|
|
||||||
ctxt->instate = XML_PARSER_PI;
|
|
||||||
/*
|
/*
|
||||||
* this is a Processing Instruction.
|
* this is a Processing Instruction.
|
||||||
*/
|
*/
|
||||||
@@ -5161,7 +5143,6 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
(ctxt->sax->processingInstruction != NULL))
|
(ctxt->sax->processingInstruction != NULL))
|
||||||
ctxt->sax->processingInstruction(ctxt->userData,
|
ctxt->sax->processingInstruction(ctxt->userData,
|
||||||
target, NULL);
|
target, NULL);
|
||||||
ctxt->instate = state;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf = (xmlChar *) xmlMallocAtomic(size);
|
buf = (xmlChar *) xmlMallocAtomic(size);
|
||||||
@@ -5193,7 +5174,6 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
|
xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
|
||||||
"PI %s too big found", target);
|
"PI %s too big found", target);
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
ctxt->instate = state;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NEXTL(l);
|
NEXTL(l);
|
||||||
@@ -5212,8 +5192,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
SKIP(2);
|
SKIP(2);
|
||||||
|
|
||||||
#ifdef LIBXML_CATALOG_ENABLED
|
#ifdef LIBXML_CATALOG_ENABLED
|
||||||
if (((state == XML_PARSER_MISC) ||
|
if ((ctxt->inSubset == 0) &&
|
||||||
(state == XML_PARSER_START)) &&
|
|
||||||
(xmlStrEqual(target, XML_CATALOG_PI))) {
|
(xmlStrEqual(target, XML_CATALOG_PI))) {
|
||||||
xmlCatalogAllow allow = xmlCatalogGetDefaults();
|
xmlCatalogAllow allow = xmlCatalogGetDefaults();
|
||||||
if ((allow == XML_CATA_ALLOW_DOCUMENT) ||
|
if ((allow == XML_CATA_ALLOW_DOCUMENT) ||
|
||||||
@@ -5235,7 +5214,6 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
} else {
|
} else {
|
||||||
xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
|
||||||
}
|
}
|
||||||
ctxt->instate = state;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5387,7 +5365,6 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
"Space required after the entity name\n");
|
"Space required after the entity name\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt->instate = XML_PARSER_ENTITY_DECL;
|
|
||||||
/*
|
/*
|
||||||
* handle the various case of definitions...
|
* handle the various case of definitions...
|
||||||
*/
|
*/
|
||||||
@@ -5648,7 +5625,6 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret = xmlParseAttValue(ctxt);
|
ret = xmlParseAttValue(ctxt);
|
||||||
ctxt->instate = XML_PARSER_DTD;
|
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
xmlFatalErrMsg(ctxt, (xmlParserErrors)ctxt->errNo,
|
xmlFatalErrMsg(ctxt, (xmlParserErrors)ctxt->errNo,
|
||||||
"Attribute default value declaration error\n");
|
"Attribute default value declaration error\n");
|
||||||
@@ -6843,8 +6819,6 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlParsePI(ctxt);
|
xmlParsePI(ctxt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt->instate = XML_PARSER_DTD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6972,7 +6946,6 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
|
|||||||
xmlErrMemory(ctxt);
|
xmlErrMemory(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt->instate = XML_PARSER_DTD;
|
|
||||||
ctxt->inSubset = 2;
|
ctxt->inSubset = 2;
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
while ((PARSER_STOPPED(ctxt) == 0) && (RAW != 0)) {
|
while ((PARSER_STOPPED(ctxt) == 0) && (RAW != 0)) {
|
||||||
@@ -7048,7 +7021,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
|||||||
/*
|
/*
|
||||||
* We are seeing an entity reference
|
* We are seeing an entity reference
|
||||||
*/
|
*/
|
||||||
ent = xmlParseEntityRef(ctxt);
|
ent = xmlParseEntityRefInternal(ctxt, /* isAttr */ 0);
|
||||||
if (ent == NULL) return;
|
if (ent == NULL) return;
|
||||||
if (!ctxt->wellFormed)
|
if (!ctxt->wellFormed)
|
||||||
return;
|
return;
|
||||||
@@ -7421,37 +7394,18 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlParseEntityRef:
|
* xmlParseEntityRefInternal:
|
||||||
* @ctxt: an XML parser context
|
* @ctxt: an XML parser context
|
||||||
|
* @inAttr: whether we are in an attribute value
|
||||||
*
|
*
|
||||||
* DEPRECATED: Internal function, don't use.
|
* Parse an entity reference. Always consumes '&'.
|
||||||
*
|
|
||||||
* Parse an entitiy reference. Always consumes '&'.
|
|
||||||
*
|
*
|
||||||
* [68] EntityRef ::= '&' Name ';'
|
* [68] EntityRef ::= '&' Name ';'
|
||||||
*
|
*
|
||||||
* [ WFC: Entity Declared ]
|
|
||||||
* In a document without any DTD, a document with only an internal DTD
|
|
||||||
* subset which contains no parameter entity references, or a document
|
|
||||||
* with "standalone='yes'", the Name given in the entity reference
|
|
||||||
* must match that in an entity declaration, except that well-formed
|
|
||||||
* documents need not declare any of the following entities: amp, lt,
|
|
||||||
* gt, apos, quot. The declaration of a parameter entity must precede
|
|
||||||
* any reference to it. Similarly, the declaration of a general entity
|
|
||||||
* must precede any reference to it which appears in a default value in an
|
|
||||||
* attribute-list declaration. Note that if entities are declared in the
|
|
||||||
* external subset or in external parameter entities, a non-validating
|
|
||||||
* processor is not obligated to read and process their declarations;
|
|
||||||
* for such documents, the rule that an entity must be declared is a
|
|
||||||
* well-formedness constraint only if standalone='yes'.
|
|
||||||
*
|
|
||||||
* [ WFC: Parsed Entity ]
|
|
||||||
* An entity reference must not contain the name of an unparsed entity
|
|
||||||
*
|
|
||||||
* Returns the xmlEntityPtr if found, or NULL otherwise.
|
* Returns the xmlEntityPtr if found, or NULL otherwise.
|
||||||
*/
|
*/
|
||||||
xmlEntityPtr
|
static xmlEntityPtr
|
||||||
xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
xmlParseEntityRefInternal(xmlParserCtxtPtr ctxt, int inAttr) {
|
||||||
const xmlChar *name;
|
const xmlChar *name;
|
||||||
xmlEntityPtr ent = NULL;
|
xmlEntityPtr ent = NULL;
|
||||||
|
|
||||||
@@ -7551,8 +7505,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
* Attribute values cannot contain direct or indirect
|
* Attribute values cannot contain direct or indirect
|
||||||
* entity references to external entities.
|
* entity references to external entities.
|
||||||
*/
|
*/
|
||||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
else if ((inAttr) && (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
|
||||||
(ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
|
|
||||||
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL,
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL,
|
||||||
"Attribute references external entity '%s'\n", name);
|
"Attribute references external entity '%s'\n", name);
|
||||||
}
|
}
|
||||||
@@ -7562,8 +7515,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
* indirectly in an attribute value (other than "<") must
|
* indirectly in an attribute value (other than "<") must
|
||||||
* not contain a <.
|
* not contain a <.
|
||||||
*/
|
*/
|
||||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
else if ((inAttr) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
|
||||||
(ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
|
|
||||||
if ((ent->flags & XML_ENT_CHECKED_LT) == 0) {
|
if ((ent->flags & XML_ENT_CHECKED_LT) == 0) {
|
||||||
if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
|
if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
|
||||||
ent->flags |= XML_ENT_CONTAINS_LT;
|
ent->flags |= XML_ENT_CONTAINS_LT;
|
||||||
@@ -7600,6 +7552,19 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
return(ent);
|
return(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlParseEntityRef:
|
||||||
|
* @ctxt: an XML parser context
|
||||||
|
*
|
||||||
|
* DEPRECATED: Internal function, don't use.
|
||||||
|
*
|
||||||
|
* Returns the xmlEntityPtr if found, or NULL otherwise.
|
||||||
|
*/
|
||||||
|
xmlEntityPtr
|
||||||
|
xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
||||||
|
return(xmlParseEntityRefInternal(ctxt, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlParseStringEntityRef:
|
* xmlParseStringEntityRef:
|
||||||
* @ctxt: an XML parser context
|
* @ctxt: an XML parser context
|
||||||
@@ -7738,8 +7703,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
|
|||||||
* Attribute values cannot contain direct or indirect
|
* Attribute values cannot contain direct or indirect
|
||||||
* entity references to external entities.
|
* entity references to external entities.
|
||||||
*/
|
*/
|
||||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
|
||||||
(ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
|
|
||||||
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL,
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL,
|
||||||
"Attribute references external entity '%s'\n", name);
|
"Attribute references external entity '%s'\n", name);
|
||||||
}
|
}
|
||||||
@@ -7749,8 +7713,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
|
|||||||
* indirectly in an attribute value (other than "<") must
|
* indirectly in an attribute value (other than "<") must
|
||||||
* not contain a <.
|
* not contain a <.
|
||||||
*/
|
*/
|
||||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
else if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) {
|
||||||
(ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
|
|
||||||
if ((ent->flags & XML_ENT_CHECKED_LT) == 0) {
|
if ((ent->flags & XML_ENT_CHECKED_LT) == 0) {
|
||||||
if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
|
if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
|
||||||
ent->flags |= XML_ENT_CONTAINS_LT;
|
ent->flags |= XML_ENT_CONTAINS_LT;
|
||||||
@@ -8284,7 +8247,6 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
|
|||||||
* Is there any DTD definition ?
|
* Is there any DTD definition ?
|
||||||
*/
|
*/
|
||||||
if (RAW == '[') {
|
if (RAW == '[') {
|
||||||
ctxt->instate = XML_PARSER_DTD;
|
|
||||||
NEXT;
|
NEXT;
|
||||||
/*
|
/*
|
||||||
* Parse the succession of Markup declarations and
|
* Parse the succession of Markup declarations and
|
||||||
@@ -8391,7 +8353,6 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
|
|||||||
NEXT;
|
NEXT;
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
val = xmlParseAttValue(ctxt);
|
val = xmlParseAttValue(ctxt);
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
} else {
|
} else {
|
||||||
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||||
"Specification mandates value for attribute %s\n", name);
|
"Specification mandates value for attribute %s\n", name);
|
||||||
@@ -8876,7 +8837,6 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
|
|||||||
xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* try to handle in this routine the most common case where no
|
* try to handle in this routine the most common case where no
|
||||||
@@ -9088,7 +9048,6 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
} else {
|
} else {
|
||||||
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||||
"Specification mandates value for attribute %s\n",
|
"Specification mandates value for attribute %s\n",
|
||||||
@@ -9885,7 +9844,6 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
return;
|
return;
|
||||||
SKIP(6);
|
SKIP(6);
|
||||||
|
|
||||||
ctxt->instate = XML_PARSER_CDATA_SECTION;
|
|
||||||
r = CUR_CHAR(rl);
|
r = CUR_CHAR(rl);
|
||||||
if (!IS_CHAR(r)) {
|
if (!IS_CHAR(r)) {
|
||||||
xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
|
||||||
@@ -9949,7 +9907,6 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10851,7 +10808,6 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
|||||||
ctxt->inSubset = 1;
|
ctxt->inSubset = 1;
|
||||||
xmlParseDocTypeDecl(ctxt);
|
xmlParseDocTypeDecl(ctxt);
|
||||||
if (RAW == '[') {
|
if (RAW == '[') {
|
||||||
ctxt->instate = XML_PARSER_DTD;
|
|
||||||
xmlParseInternalSubset(ctxt);
|
xmlParseInternalSubset(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10867,7 +10823,6 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
|||||||
|
|
||||||
xmlCleanSpecialAttr(ctxt);
|
xmlCleanSpecialAttr(ctxt);
|
||||||
|
|
||||||
ctxt->instate = XML_PARSER_PROLOG;
|
|
||||||
xmlParseMisc(ctxt);
|
xmlParseMisc(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10879,9 +10834,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlFatalErrMsg(ctxt, XML_ERR_DOCUMENT_EMPTY,
|
xmlFatalErrMsg(ctxt, XML_ERR_DOCUMENT_EMPTY,
|
||||||
"Start tag expected, '<' not found\n");
|
"Start tag expected, '<' not found\n");
|
||||||
} else {
|
} else {
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
xmlParseElement(ctxt);
|
xmlParseElement(ctxt);
|
||||||
ctxt->instate = XML_PARSER_EPILOG;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Misc part at the end
|
* The Misc part at the end
|
||||||
@@ -10971,7 +10924,6 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
|
|||||||
/*
|
/*
|
||||||
* Doing validity checking on chunk doesn't make sense
|
* Doing validity checking on chunk doesn't make sense
|
||||||
*/
|
*/
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
ctxt->validate = 0;
|
ctxt->validate = 0;
|
||||||
ctxt->loadsubset = 0;
|
ctxt->loadsubset = 0;
|
||||||
ctxt->depth = 0;
|
ctxt->depth = 0;
|
||||||
@@ -12734,7 +12686,6 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen,
|
|||||||
ctxt->myDoc = doc;
|
ctxt->myDoc = doc;
|
||||||
/* parsing in context, i.e. as within existing content */
|
/* parsing in context, i.e. as within existing content */
|
||||||
ctxt->input_id = 2;
|
ctxt->input_id = 2;
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
|
|
||||||
fake = xmlNewDocComment(node->doc, NULL);
|
fake = xmlNewDocComment(node->doc, NULL);
|
||||||
if (fake == NULL) {
|
if (fake == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user