diff options
author | kwaclaw <kwaclaw> | 2004-05-18 13:50:13 +0000 |
---|---|---|
committer | kwaclaw <kwaclaw> | 2004-05-18 13:50:13 +0000 |
commit | 4370c503b54c1cdb67a9b1eff84693a98af058a7 (patch) | |
tree | 835ce4f61a7e84e6c8b14438a6316d86c3ecdac0 /lib/xmlparse.c | |
parent | a7a478122cd678247c5aa0aeac8dafd266cde02e (diff) | |
download | libexpat-4370c503b54c1cdb67a9b1eff84693a98af058a7.tar.gz |
Added a few more meaningful error codes (and messages).
Diffstat (limited to 'lib/xmlparse.c')
-rw-r--r-- | lib/xmlparse.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/xmlparse.c b/lib/xmlparse.c index 8757846..479026c 100644 --- a/lib/xmlparse.c +++ b/lib/xmlparse.c @@ -1863,6 +1863,11 @@ XML_ErrorString(enum XML_Error code) XML_L("requested feature requires XML_DTD support in Expat"), XML_L("cannot change setting once parsing has begun"), XML_L("unbound prefix"), + XML_L("must not undeclare prefix"), + XML_L("incomplete markup in parameter entity"), + XML_L("XML declaration not well-formed"), + XML_L("text declaration not well-formed"), + XML_L("illegal character(s) in public id"), XML_L("parser suspended"), XML_L("parser not suspended"), XML_L("parsing aborted"), @@ -2916,9 +2921,9 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, BINDING *b; int len; - /* empty string is only valid when there is no prefix per XML NS 1.0 */ + /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */ if (*uri == XML_T('\0') && prefix->name) - return XML_ERROR_SYNTAX; + return XML_ERROR_UNDECLARING_PREFIX; for (len = 0; uri[len]; len++) ; @@ -3242,8 +3247,12 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity, &versionend, &encodingName, &newEncoding, - &standalone)) - return XML_ERROR_SYNTAX; + &standalone)) { + if (isGeneralTextEntity) + return XML_ERROR_TEXT_DECL; + else + return XML_ERROR_XML_DECL; + } if (!isGeneralTextEntity && standalone == 1) { _dtd->standalone = XML_TRUE; #ifdef XML_DTD @@ -3618,7 +3627,7 @@ doProlog(XML_Parser parser, if (isParamEntity || enc != encoding) { if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) == XML_ROLE_ERROR) - return XML_ERROR_SYNTAX; + return XML_ERROR_INCOMPLETE_PE; *nextPtr = s; return XML_ERROR_NONE; } @@ -3684,7 +3693,7 @@ doProlog(XML_Parser parser, dtd->hasParamEntityRefs = XML_TRUE; if (startDoctypeDeclHandler) { if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; + return XML_ERROR_PUBLICID; doctypePubid = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); @@ -3698,7 +3707,7 @@ doProlog(XML_Parser parser, /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; + return XML_ERROR_PUBLICID; alreadyChecked: if (dtd->keepProcessing && declEntity) { XML_Char *tem = poolStoreString(&dtd->pool, @@ -4122,7 +4131,7 @@ doProlog(XML_Parser parser, break; case XML_ROLE_NOTATION_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; + return XML_ERROR_PUBLICID; if (declNotationName) { /* means notationDeclHandler != NULL */ XML_Char *tem = poolStoreString(&tempPool, enc, |