version 1.23, 1999/08/05 14:38:26
|
version 1.24, 1999/08/05 20:41:29
|
Line 147 internalSubset(void *ctx, const CHAR *na
|
Line 147 internalSubset(void *ctx, const CHAR *na
|
name, ExternalID, SystemID); |
name, ExternalID, SystemID); |
#endif |
#endif |
xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); |
xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); |
if ((ExternalID != NULL) || (SystemID != NULL)) { |
if (((ExternalID != NULL) || (SystemID != NULL)) && |
ctxt->myDoc->extSubset = xmlParseDTD(ExternalID, SystemID); |
(ctxt->validate && ctxt->wellFormed && ctxt->myDoc)) { |
|
/* |
|
* Try to fetch and parse the external subset. |
|
*/ |
|
xmlDtdPtr ret = NULL; |
|
xmlParserCtxtPtr dtdCtxt; |
|
xmlParserInputPtr input = NULL; |
|
xmlCharEncoding enc; |
|
|
|
dtdCtxt = xmlNewParserCtxt(); |
|
if (dtdCtxt == NULL) return; |
|
|
|
/* |
|
* Ask the Entity resolver to load the damn thing |
|
*/ |
|
if ((ctxt->directory != NULL) && (dtdCtxt->directory == NULL)) |
|
dtdCtxt->directory = xmlStrdup(ctxt->directory); |
|
|
|
if ((dtdCtxt->sax != NULL) && (dtdCtxt->sax->resolveEntity != NULL)) |
|
input = dtdCtxt->sax->resolveEntity(dtdCtxt->userData, ExternalID, |
|
SystemID); |
|
if (input == NULL) { |
|
xmlFreeParserCtxt(dtdCtxt); |
|
return; |
|
} |
|
|
|
/* |
|
* plug some encoding conversion routines here. !!! |
|
*/ |
|
xmlPushInput(dtdCtxt, input); |
|
enc = xmlDetectCharEncoding(dtdCtxt->input->cur); |
|
xmlSwitchEncoding(dtdCtxt, enc); |
|
|
|
if (input->filename == NULL) |
|
input->filename = xmlStrdup(SystemID); |
|
input->line = 1; |
|
input->col = 1; |
|
input->base = dtdCtxt->input->cur; |
|
input->cur = dtdCtxt->input->cur; |
|
input->free = NULL; |
|
|
|
/* |
|
* let's parse that entity knowing it's an external subset. |
|
*/ |
|
xmlParseExternalSubset(dtdCtxt, ExternalID, SystemID); |
|
|
|
if (dtdCtxt->myDoc != NULL) { |
|
if (dtdCtxt->wellFormed) { |
|
ret = dtdCtxt->myDoc->intSubset; |
|
dtdCtxt->myDoc->intSubset = NULL; |
|
} else { |
|
ret = NULL; |
|
} |
|
xmlFreeDoc(dtdCtxt->myDoc); |
|
dtdCtxt->myDoc = NULL; |
|
} |
|
xmlFreeParserCtxt(dtdCtxt); |
|
|
|
ctxt->myDoc->extSubset = ret; |
} |
} |
} |
} |
|
|