const char *name;
const char *textPtr;
size_t textLen;
+ const char *docTextPtr;
const char *systemId;
const char *publicId;
const char *notation;
static enum WfCheckResult
checkAttributeUniqueness(CONTEXT *context, const ENCODING *enc, int nAtts,
const char **badPtr);
+static enum WfCheckResult
+checkParsedEntities(CONTEXT *context, const char **badPtr);
static
enum WfCheckResult storeEntity(DTD *dtd,
result = checkProlog(&context.dtd, s, end, &next, &enc);
s = next;
if (!result) {
- result = checkContent(0, &context, enc, s, end, &next);
+ result = checkParsedEntities(&context, &next);
s = next;
+ if (!result) {
+ result = checkContent(0, &context, enc, s, end, &next);
+ s = next;
+ }
}
}
else {
/* not reached */
}
+static enum WfCheckResult
+checkParsedEntities(CONTEXT *context, const char **badPtr)
+{
+ HASH_TABLE_ITER iter;
+ hashTableIterInit(&iter, &context->dtd.generalEntities);
+ for (;;) {
+ ENTITY *entity = (ENTITY *)hashTableIterNext(&iter);
+ if (!entity)
+ break;
+ if (entity->textPtr && !entity->wfInContent && !entity->magic) {
+ enum WfCheckResult result;
+ const ENCODING *internalEnc = XmlGetInternalEncoding(XML_UTF8_ENCODING);
+ entity->open = 1;
+ result = checkContent(1, context, internalEnc,
+ entity->textPtr, entity->textPtr + entity->textLen,
+ badPtr);
+ entity->open = 0;
+ if (result && *badPtr) {
+ *badPtr = entity->docTextPtr;
+ return result;
+ }
+ entity->wfInContent = 1;
+ }
+ }
+ return wellFormed;
+}
+
static enum WfCheckResult
checkGeneralTextEntity(CONTEXT *context,
const char *s, const char *end,
}
entityTextPtr += enc->minBytesPerChar;
entityTextEnd -= enc->minBytesPerChar;
+ if (entityNamePtr)
+ entity->docTextPtr = entityTextPtr;
for (;;) {
const char *next;
int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);