Lines Matching refs:DTD
287 } DTD;
388 static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms);
390 static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms);
392 dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms);
394 dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);
436 DTD *dtd);
523 DTD *m_dtd;
700 DTD *dtd)
746 if (dtd)
747 _dtd = dtd;
942 DTD *newDtd = NULL;
943 DTD *oldDtd = _dtd;
1051 /* The DTD instance referenced by _dtd is shared between the document's
1122 /* external parameter entity parsers share the DTD structure
2156 DTD * const dtd = _dtd;
2237 name = poolStoreString(&dtd->pool, enc,
2242 entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
2243 poolDiscard(&dtd->pool);
2248 if (!dtd->hasParamEntityRefs || dtd->standalone) {
2615 DTD * const dtd = _dtd; /* save one level of indirection */
2629 elementType = (ELEMENT_TYPE *)lookup(&dtd->elementTypes, tagNamePtr->str,0);
2631 const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str);
2634 elementType = (ELEMENT_TYPE *)lookup(&dtd->elementTypes, name,
2805 id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, s, 0);
2896 else if (dtd->defaultPrefix.binding) {
2897 binding = dtd->defaultPrefix.binding;
3660 DTD * const dtd = _dtd;
3767 declEntity = (ENTITY *)lookup(&dtd->paramEntities,
3773 dtd->hasParamEntityRefs = XML_TRUE;
3792 if (dtd->keepProcessing && declEntity) {
3793 XML_Char *tem = poolStoreString(&dtd->pool,
3801 poolFinish(&dtd->pool);
3819 XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
3820 dtd->hasParamEntityRefs = XML_TRUE;
3822 ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
3829 dtd->paramEntityRead = XML_FALSE;
3836 if (dtd->paramEntityRead) {
3837 if (!dtd->standalone &&
3842 /* if we didn't read the foreign DTD then this means that there
3843 is no external subset and we must reset dtd->hasParamEntityRefs
3846 dtd->hasParamEntityRefs = hadParamEntityRefs;
3847 /* end of DTD - no need to update dtd->keepProcessing */
3860 last chance to read the foreign DTD
3863 XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
3864 dtd->hasParamEntityRefs = XML_TRUE;
3866 ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
3872 dtd->paramEntityRead = XML_FALSE;
3879 if (dtd->paramEntityRead) {
3880 if (!dtd->standalone &&
3885 /* if we didn't read the foreign DTD then this means that there
3886 is no external subset and we must reset dtd->hasParamEntityRefs
3889 dtd->hasParamEntityRefs = hadParamEntityRefs;
3890 /* end of DTD - no need to update dtd->keepProcessing */
3935 if (dtd->keepProcessing && attlistDeclHandler)
3940 if (dtd->keepProcessing && attlistDeclHandler) {
3960 if (dtd->keepProcessing) {
3987 if (dtd->keepProcessing) {
3993 &dtd->pool);
3996 attVal = poolStart(&dtd->pool);
3997 poolFinish(&dtd->pool);
4024 if (dtd->keepProcessing) {
4029 declEntity->textPtr = poolStart(&dtd->entityValuePool);
4030 declEntity->textLen = (int)(poolLength(&dtd->entityValuePool));
4031 poolFinish(&dtd->entityValuePool);
4044 poolDiscard(&dtd->entityValuePool);
4053 dtd->hasParamEntityRefs = XML_TRUE;
4069 if (!dtd->standalone
4080 declEntity = (ENTITY *)lookup(&dtd->paramEntities,
4090 if (dtd->keepProcessing && declEntity) {
4091 declEntity->systemId = poolStoreString(&dtd->pool, enc,
4097 poolFinish(&dtd->pool);
4103 if (dtd->keepProcessing && declEntity && entityDeclHandler) {
4117 if (dtd->keepProcessing && declEntity) {
4118 declEntity->notation = poolStoreString(&dtd->pool, enc, s, next);
4121 poolFinish(&dtd->pool);
4151 if (dtd->keepProcessing) {
4152 const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);
4155 declEntity = (ENTITY *)lookup(&dtd->generalEntities, name,
4160 poolDiscard(&dtd->pool);
4164 poolFinish(&dtd->pool);
4176 poolDiscard(&dtd->pool);
4183 if (dtd->keepProcessing) {
4184 const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);
4187 declEntity = (ENTITY *)lookup(&dtd->paramEntities,
4192 poolDiscard(&dtd->pool);
4196 poolFinish(&dtd->pool);
4208 poolDiscard(&dtd->pool);
4307 if (dtd->scaffIndex) {
4308 int *temp = (int *)REALLOC(dtd->scaffIndex,
4312 dtd->scaffIndex = temp;
4322 if (dtd->in_eldecl) {
4326 dtd->scaffIndex[dtd->scaffLevel] = myindex;
4327 dtd->scaffLevel++;
4328 dtd->scaffold[myindex].type = XML_CTYPE_SEQ;
4337 if (dtd->in_eldecl && elementDeclHandler)
4343 if (dtd->in_eldecl
4345 && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
4348 dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
4358 dtd->hasParamEntityRefs = XML_TRUE;
4360 dtd->keepProcessing = dtd->standalone;
4364 name = poolStoreString(&dtd->pool, enc,
4369 entity = (ENTITY *)lookup(&dtd->paramEntities, name, 0);
4370 poolDiscard(&dtd->pool);
4376 (dtd->standalone
4378 : !dtd->hasParamEntityRefs)) {
4385 dtd->keepProcessing = dtd->standalone;
4406 dtd->paramEntityRead = XML_FALSE;
4418 if (!dtd->paramEntityRead) {
4419 dtd->keepProcessing = dtd->standalone;
4424 dtd->keepProcessing = dtd->standalone;
4429 if (!dtd->standalone &&
4442 dtd->scaffLevel = 0;
4443 dtd->scaffCount = 0;
4444 dtd->in_eldecl = XML_TRUE;
4451 if (dtd->in_eldecl) {
4467 dtd->in_eldecl = XML_FALSE;
4472 if (dtd->in_eldecl) {
4473 dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
4492 if (dtd->in_eldecl) {
4502 dtd->scaffold[myindex].type = XML_CTYPE_NAME;
4503 dtd->scaffold[myindex].quant = quant;
4508 dtd->scaffold[myindex].name = name;
4511 dtd->contentStringLen += nameLen;
4529 if (dtd->in_eldecl) {
4532 dtd->scaffLevel--;
4533 dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant;
4534 if (dtd->scaffLevel == 0) {
4542 dtd->in_eldecl = XML_FALSE;
4543 dtd->contentStringLen = 0;
4571 if (dtd->keepProcessing && entityDeclHandler)
4579 if (dtd->keepProcessing && attlistDeclHandler)
4820 DTD * const dtd = _dtd; /* save one level of indirection */
4893 entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
4898 if (pool == &dtd->pool) /* are we called from prolog? */
4903 (dtd->standalone
4905 : !dtd->hasParamEntityRefs);
4907 checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone;
4971 DTD * const dtd = _dtd; /* save one level of indirection */
4972 STRING_POOL *pool = &(dtd->entityValuePool);
5002 entity = (ENTITY *)lookup(&dtd->paramEntities, name, 0);
5011 dtd->keepProcessing = dtd->standalone;
5022 dtd->paramEntityRead = XML_FALSE;
5034 if (!dtd->paramEntityRead)
5035 dtd->keepProcessing = dtd->standalone;
5038 dtd->keepProcessing = dtd->standalone;
5280 DTD * const dtd = _dtd; /* save one level of indirection */
5287 if (!poolAppendChar(&dtd->pool, *s))
5290 if (!poolAppendChar(&dtd->pool, XML_T('\0')))
5292 prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&dtd->pool),
5296 if (prefix->name == poolStart(&dtd->pool))
5297 poolFinish(&dtd->pool);
5299 poolDiscard(&dtd->pool);
5311 DTD * const dtd = _dtd; /* save one level of indirection */
5314 if (!poolAppendChar(&dtd->pool, XML_T('\0')))
5316 name = poolStoreString(&dtd->pool, enc, start, end);
5321 id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, name, sizeof(ATTRIBUTE_ID));
5325 poolDiscard(&dtd->pool);
5327 poolFinish(&dtd->pool);
5337 id->prefix = &dtd->defaultPrefix;
5339 id->prefix = (PREFIX *)lookup(&dtd->prefixes, name + 6, sizeof(PREFIX));
5349 if (!poolAppendChar(&dtd->pool, name[j]))
5352 if (!poolAppendChar(&dtd->pool, XML_T('\0')))
5354 id->prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&dtd->pool),
5358 if (id->prefix->name == poolStart(&dtd->pool))
5359 poolFinish(&dtd->pool);
5361 poolDiscard(&dtd->pool);
5375 DTD * const dtd = _dtd; /* save one level of indirection */
5379 if (dtd->defaultPrefix.binding) {
5384 len = dtd->defaultPrefix.binding->uriLen;
5388 if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i]))
5393 hashTableIterInit(&iter, &(dtd->prefixes));
5420 hashTableIterInit(&iter, &(dtd->generalEntities));
5444 DTD * const dtd = _dtd; /* save one level of indirection */
5452 e = (ENTITY *)lookup(&dtd->generalEntities, poolStart(&tempPool), 0);
5463 prefix = &dtd->defaultPrefix;
5467 prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&tempPool),
5472 prefix->name = poolCopyString(&dtd->pool, prefix->name);
5524 static DTD *
5527 DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD));
5558 dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms)
5600 dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms)
5627 /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
5628 The new DTD has already been initialized.
5631 dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
6152 DTD * const dtd = _dtd; /* save one level of indirection */
6156 if (!dtd->scaffIndex) {
6157 dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int));
6158 if (!dtd->scaffIndex)
6160 dtd->scaffIndex[0] = 0;
6163 if (dtd->scaffCount >= dtd->scaffSize) {
6165 if (dtd->scaffold) {
6167 REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));
6170 dtd->scaffSize *= 2;
6177 dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS;
6179 dtd->scaffold = temp;
6181 next = dtd->scaffCount++;
6182 me = &dtd->scaffold[next];
6183 if (dtd->scaffLevel) {
6184 CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]];
6186 dtd->scaffold[parent->lastchild].nextsib = next;
6204 DTD * const dtd = _dtd; /* save one level of indirection */
6205 dest->type = dtd->scaffold[src_node].type;
6206 dest->quant = dtd->scaffold[src_node].quant;
6210 src = dtd->scaffold[src_node].name;
6223 dest->numchildren = dtd->scaffold[src_node].childcnt;
6226 for (i = 0, cn = dtd->scaffold[src_node].firstchild;
6228 i++, cn = dtd->scaffold[cn].nextsib) {
6238 DTD * const dtd = _dtd; /* save one level of indirection */
6242 int allocsize = (dtd->scaffCount * sizeof(XML_Content)
6243 + (dtd->contentStringLen * sizeof(XML_Char)));
6249 str = (XML_Char *) (&ret[dtd->scaffCount]);
6262 DTD * const dtd = _dtd; /* save one level of indirection */
6263 const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end);
6268 ret = (ELEMENT_TYPE *) lookup(&dtd->elementTypes, name, sizeof(ELEMENT_TYPE));
6272 poolDiscard(&dtd->pool);
6274 poolFinish(&dtd->pool);