*** parser.c 2001/04/30 11:46:40 1.135 --- parser.c 2001/05/08 10:38:25 *************** *** 109,114 **** --- 109,118 ---- xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str); + static int + xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlSAXHandlerPtr sax, + void *user_data, int depth, const xmlChar *URL, + const xmlChar *ID, xmlNodePtr *list, void *private); /************************************************************************ * * *************** *** 4992,5000 **** } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { ctxt->depth++; ! ret = xmlParseExternalEntity(ctxt->myDoc, ctxt->sax, NULL, ctxt->depth, ! ent->URI, ent->ExternalID, &list); ctxt->depth--; } else { ret = -1; --- 4996,5005 ---- } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { ctxt->depth++; ! ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt->sax, NULL, ctxt->depth, ! ent->URI, ent->ExternalID, &list, ! ctxt->_private); ctxt->depth--; } else { ret = -1; *************** *** 8912,8918 **** } /** ! * xmlParseExternalEntity: * @doc: the document the chunk pertains to * @sax: the SAX handler bloc (possibly NULL) * @user_data: The user data returned on SAX callbacks (possibly NULL) --- 8917,8923 ---- } /** ! * xmlParseExternalEntityPrivate: * @doc: the document the chunk pertains to * @sax: the SAX handler bloc (possibly NULL) * @user_data: The user data returned on SAX callbacks (possibly NULL) *************** *** 8920,8939 **** * @URL: the URL for the entity to load * @ID: the System ID for the entity to load * @list: the return value for the set of parsed nodes * ! * Parse an external general entity ! * An external general parsed entity is well-formed if it matches the ! * production labeled extParsedEnt. * - * [78] extParsedEnt ::= TextDecl? content - * * Returns 0 if the entity is well formed, -1 in case of args problem and * the parser error code otherwise */ ! int ! xmlParseExternalEntity(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, ! int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list) { xmlParserCtxtPtr ctxt; xmlDocPtr newDoc; xmlSAXHandlerPtr oldsax = NULL; --- 8925,8942 ---- * @URL: the URL for the entity to load * @ID: the System ID for the entity to load * @list: the return value for the set of parsed nodes + * @private: extra field for the _private parser context * ! * Private version of xmlParseExternalEntity() * * Returns 0 if the entity is well formed, -1 in case of args problem and * the parser error code otherwise */ ! static int ! xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlSAXHandlerPtr sax, ! void *user_data, int depth, const xmlChar *URL, ! const xmlChar *ID, xmlNodePtr *list, void *private) { xmlParserCtxtPtr ctxt; xmlDocPtr newDoc; xmlSAXHandlerPtr oldsax = NULL; *************** *** 8956,8961 **** --- 8959,8965 ---- ctxt = xmlCreateEntityParserCtxt(URL, ID, NULL); if (ctxt == NULL) return(-1); ctxt->userData = ctxt; + ctxt->_private = private; if (sax != NULL) { oldsax = ctxt->sax; ctxt->sax = sax; *************** *** 9068,9073 **** --- 9072,9104 ---- xmlFreeDoc(newDoc); return(ret); + } + + /** + * xmlParseExternalEntity: + * @doc: the document the chunk pertains to + * @sax: the SAX handler bloc (possibly NULL) + * @user_data: The user data returned on SAX callbacks (possibly NULL) + * @depth: Used for loop detection, use 0 + * @URL: the URL for the entity to load + * @ID: the System ID for the entity to load + * @list: the return value for the set of parsed nodes + * + * Parse an external general entity + * An external general parsed entity is well-formed if it matches the + * production labeled extParsedEnt. + * + * [78] extParsedEnt ::= TextDecl? content + * + * Returns 0 if the entity is well formed, -1 in case of args problem and + * the parser error code otherwise + */ + + int + xmlParseExternalEntity(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, + int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list) { + return(xmlParseExternalEntityPrivate(doc, sax, user_data, depth, URL, + ID, list, NULL)); } /**