mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
doc: Misc fixes
This commit is contained in:
25
HTMLparser.c
25
HTMLparser.c
@@ -2218,15 +2218,15 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new HTML document without a DTD node if `URI` and `ExternalID`
|
||||
* Creates a new HTML document without a DTD node if `URI` and `publicId`
|
||||
* are NULL
|
||||
*
|
||||
* @param URI URI for the dtd, or NULL
|
||||
* @param ExternalID the external ID of the DTD, or NULL
|
||||
* @param URI system ID (URI) of the DTD (optional)
|
||||
* @param publicId public ID of the DTD (optional)
|
||||
* @returns a new document, do not initialize the DTD if not provided
|
||||
*/
|
||||
xmlDoc *
|
||||
htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) {
|
||||
htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *publicId) {
|
||||
xmlDocPtr cur;
|
||||
|
||||
/*
|
||||
@@ -2253,11 +2253,11 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) {
|
||||
cur->_private = NULL;
|
||||
cur->charset = XML_CHAR_ENCODING_UTF8;
|
||||
cur->properties = XML_DOC_HTML | XML_DOC_USERBUILT;
|
||||
if ((ExternalID != NULL) ||
|
||||
if ((publicId != NULL) ||
|
||||
(URI != NULL)) {
|
||||
xmlDtdPtr intSubset;
|
||||
|
||||
intSubset = xmlCreateIntSubset(cur, BAD_CAST "html", ExternalID, URI);
|
||||
intSubset = xmlCreateIntSubset(cur, BAD_CAST "html", publicId, URI);
|
||||
if (intSubset == NULL) {
|
||||
xmlFree(cur);
|
||||
return(NULL);
|
||||
@@ -2271,18 +2271,18 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) {
|
||||
/**
|
||||
* Creates a new HTML document
|
||||
*
|
||||
* @param URI URI for the dtd, or NULL
|
||||
* @param ExternalID the external ID of the DTD, or NULL
|
||||
* @param URI system ID (URI) of the DTD (optional)
|
||||
* @param publicId public ID of the DTD (optional)
|
||||
* @returns a new document
|
||||
*/
|
||||
xmlDoc *
|
||||
htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) {
|
||||
if ((URI == NULL) && (ExternalID == NULL))
|
||||
htmlNewDoc(const xmlChar *URI, const xmlChar *publicId) {
|
||||
if ((URI == NULL) && (publicId == NULL))
|
||||
return(htmlNewDocNoDtD(
|
||||
BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd",
|
||||
BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN"));
|
||||
|
||||
return(htmlNewDocNoDtD(URI, ExternalID));
|
||||
return(htmlNewDocNoDtD(URI, publicId));
|
||||
}
|
||||
|
||||
|
||||
@@ -5115,6 +5115,9 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
||||
*
|
||||
* If the document isn't well-formed, `ctxt->myDoc` is set to NULL.
|
||||
*
|
||||
* Since 2.14.0, xmlCtxtGetDocument() can be used to retrieve the
|
||||
* result document.
|
||||
*
|
||||
* @param ctxt an HTML parser context
|
||||
* @param chunk chunk of memory
|
||||
* @param size size of chunk in bytes
|
||||
|
28
SAX2.c
28
SAX2.c
@@ -211,12 +211,12 @@ xmlSAX2HasExternalSubset(void *ctx)
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name the root element name
|
||||
* @param ExternalID the external ID
|
||||
* @param SystemID the SYSTEM ID (e.g. filename or URL)
|
||||
* @param publicId public identifier of the DTD (optional)
|
||||
* @param systemId system identifier (URL) of the DTD
|
||||
*/
|
||||
void
|
||||
xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID)
|
||||
const xmlChar *publicId, const xmlChar *systemId)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlDtdPtr dtd;
|
||||
@@ -233,7 +233,7 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
|
||||
ctxt->myDoc->intSubset = NULL;
|
||||
}
|
||||
ctxt->myDoc->intSubset =
|
||||
xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID);
|
||||
xmlCreateIntSubset(ctxt->myDoc, name, publicId, systemId);
|
||||
if (ctxt->myDoc->intSubset == NULL)
|
||||
xmlSAX2ErrMemory(ctxt);
|
||||
}
|
||||
@@ -243,16 +243,16 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name the root element name
|
||||
* @param ExternalID the external ID
|
||||
* @param SystemID the SYSTEM ID (e.g. filename or URL)
|
||||
* @param publicId public identifier of the DTD (optional)
|
||||
* @param systemId system identifier (URL) of the DTD
|
||||
*/
|
||||
void
|
||||
xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID)
|
||||
const xmlChar *publicId, const xmlChar *systemId)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
if (ctx == NULL) return;
|
||||
if ((SystemID != NULL) &&
|
||||
if ((systemId != NULL) &&
|
||||
((ctxt->options & XML_PARSE_NO_XXE) == 0) &&
|
||||
(((ctxt->validate) || (ctxt->loadsubset)) &&
|
||||
(ctxt->wellFormed && ctxt->myDoc))) {
|
||||
@@ -277,13 +277,13 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
* Ask the Entity resolver to load the damn thing
|
||||
*/
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
|
||||
input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
|
||||
SystemID);
|
||||
input = ctxt->sax->resolveEntity(ctxt->userData, publicId,
|
||||
systemId);
|
||||
if (input == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID) == NULL) {
|
||||
if (xmlNewDtd(ctxt->myDoc, name, publicId, systemId) == NULL) {
|
||||
xmlSAX2ErrMemory(ctxt);
|
||||
xmlFreeInputStream(input);
|
||||
return;
|
||||
@@ -311,7 +311,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
goto error;
|
||||
|
||||
if (input->filename == NULL)
|
||||
input->filename = (char *) xmlCanonicPath(SystemID);
|
||||
input->filename = (char *) xmlCanonicPath(systemId);
|
||||
input->line = 1;
|
||||
input->col = 1;
|
||||
input->base = ctxt->input->cur;
|
||||
@@ -321,7 +321,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
/*
|
||||
* let's parse that entity knowing it's an external subset.
|
||||
*/
|
||||
xmlParseExternalSubset(ctxt, ExternalID, SystemID);
|
||||
xmlParseExternalSubset(ctxt, publicId, systemId);
|
||||
|
||||
/*
|
||||
* Free up the external entities
|
||||
@@ -367,7 +367,7 @@ error:
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param publicId The public ID of the entity
|
||||
* @param systemId The system ID of the entity
|
||||
* @param systemId The system ID (URL) of the entity
|
||||
* @returns a parser input.
|
||||
*/
|
||||
xmlParserInput *
|
||||
|
44
entities.c
44
entities.c
@@ -115,7 +115,7 @@ xmlFreeEntity(xmlEntity *entity)
|
||||
*/
|
||||
static xmlEntityPtr
|
||||
xmlCreateEntity(xmlDocPtr doc, const xmlChar *name, int type,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID,
|
||||
const xmlChar *publicId, const xmlChar *systemId,
|
||||
const xmlChar *content) {
|
||||
xmlEntityPtr ret;
|
||||
|
||||
@@ -136,13 +136,13 @@ xmlCreateEntity(xmlDocPtr doc, const xmlChar *name, int type,
|
||||
ret->name = xmlDictLookup(doc->dict, name, -1);
|
||||
if (ret->name == NULL)
|
||||
goto error;
|
||||
if (ExternalID != NULL) {
|
||||
ret->ExternalID = xmlStrdup(ExternalID);
|
||||
if (publicId != NULL) {
|
||||
ret->ExternalID = xmlStrdup(publicId);
|
||||
if (ret->ExternalID == NULL)
|
||||
goto error;
|
||||
}
|
||||
if (SystemID != NULL) {
|
||||
ret->SystemID = xmlStrdup(SystemID);
|
||||
if (systemId != NULL) {
|
||||
ret->SystemID = xmlStrdup(systemId);
|
||||
if (ret->SystemID == NULL)
|
||||
goto error;
|
||||
}
|
||||
@@ -175,15 +175,15 @@ error:
|
||||
* @param extSubset add to the external or internal subset
|
||||
* @param name the entity name
|
||||
* @param type an xmlEntityType value
|
||||
* @param ExternalID the entity external ID (optional)
|
||||
* @param SystemID the entity system ID (optional)
|
||||
* @param publicId the publid identifier (optional)
|
||||
* @param systemId the system identifier (URL) (optional)
|
||||
* @param content the entity content
|
||||
* @param out pointer to resulting entity (optional)
|
||||
* @returns an xmlParserErrors error code.
|
||||
*/
|
||||
int
|
||||
xmlAddEntity(xmlDoc *doc, int extSubset, const xmlChar *name, int type,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID,
|
||||
const xmlChar *publicId, const xmlChar *systemId,
|
||||
const xmlChar *content, xmlEntity **out) {
|
||||
xmlDtdPtr dtd;
|
||||
xmlDictPtr dict = NULL;
|
||||
@@ -261,7 +261,7 @@ xmlAddEntity(xmlDoc *doc, int extSubset, const xmlChar *name, int type,
|
||||
default:
|
||||
return(XML_ERR_ARGUMENT);
|
||||
}
|
||||
ret = xmlCreateEntity(dtd->doc, name, type, ExternalID, SystemID, content);
|
||||
ret = xmlCreateEntity(dtd->doc, name, type, publicId, systemId, content);
|
||||
if (ret == NULL)
|
||||
return(XML_ERR_NO_MEMORY);
|
||||
|
||||
@@ -337,18 +337,18 @@ xmlGetPredefinedEntity(const xmlChar *name) {
|
||||
* @param doc the document
|
||||
* @param name the entity name
|
||||
* @param type an xmlEntityType value
|
||||
* @param ExternalID the entity external ID (optional)
|
||||
* @param SystemID the entity system ID (optional)
|
||||
* @param publicId the publid identifier (optional)
|
||||
* @param systemId the system identifier (URL) (optional)
|
||||
* @param content the entity content
|
||||
* @returns a pointer to the entity or NULL in case of error
|
||||
*/
|
||||
xmlEntity *
|
||||
xmlAddDtdEntity(xmlDoc *doc, const xmlChar *name, int type,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID,
|
||||
const xmlChar *publicId, const xmlChar *systemId,
|
||||
const xmlChar *content) {
|
||||
xmlEntityPtr ret;
|
||||
|
||||
xmlAddEntity(doc, 1, name, type, ExternalID, SystemID, content, &ret);
|
||||
xmlAddEntity(doc, 1, name, type, publicId, systemId, content, &ret);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@@ -360,18 +360,18 @@ xmlAddDtdEntity(xmlDoc *doc, const xmlChar *name, int type,
|
||||
* @param doc the document
|
||||
* @param name the entity name
|
||||
* @param type an xmlEntityType value
|
||||
* @param ExternalID the entity external ID (optional)
|
||||
* @param SystemID the entity system ID (optional)
|
||||
* @param publicId the publid identifier (optional)
|
||||
* @param systemId the system identifier (URL) (optional)
|
||||
* @param content the entity content
|
||||
* @returns a pointer to the entity or NULL in case of error
|
||||
*/
|
||||
xmlEntity *
|
||||
xmlAddDocEntity(xmlDoc *doc, const xmlChar *name, int type,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID,
|
||||
const xmlChar *publicId, const xmlChar *systemId,
|
||||
const xmlChar *content) {
|
||||
xmlEntityPtr ret;
|
||||
|
||||
xmlAddEntity(doc, 0, name, type, ExternalID, SystemID, content, &ret);
|
||||
xmlAddEntity(doc, 0, name, type, publicId, systemId, content, &ret);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@@ -386,21 +386,21 @@ xmlAddDocEntity(xmlDoc *doc, const xmlChar *name, int type,
|
||||
* @param doc the document (optional)
|
||||
* @param name the entity name
|
||||
* @param type an xmlEntityType value
|
||||
* @param ExternalID the entity external ID (optional)
|
||||
* @param SystemID the entity system ID (optional)
|
||||
* @param publicId the publid identifier (optional)
|
||||
* @param systemId the system identifier (URL) (optional)
|
||||
* @param content the entity content
|
||||
* @returns a pointer to the entity or NULL in case of error
|
||||
*/
|
||||
xmlEntity *
|
||||
xmlNewEntity(xmlDoc *doc, const xmlChar *name, int type,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID,
|
||||
const xmlChar *publicId, const xmlChar *systemId,
|
||||
const xmlChar *content) {
|
||||
if ((doc != NULL) && (doc->intSubset != NULL)) {
|
||||
return(xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content));
|
||||
return(xmlAddDocEntity(doc, name, type, publicId, systemId, content));
|
||||
}
|
||||
if (name == NULL)
|
||||
return(NULL);
|
||||
return(xmlCreateEntity(doc, name, type, ExternalID, SystemID, content));
|
||||
return(xmlCreateEntity(doc, name, type, publicId, systemId, content));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -44,13 +44,13 @@ XMLPUBFUN int
|
||||
XMLPUBFUN void
|
||||
xmlSAX2InternalSubset (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2ExternalSubset (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN xmlEntity *
|
||||
xmlSAX2GetEntity (void *ctx,
|
||||
const xmlChar *name);
|
||||
|
@@ -95,8 +95,8 @@ XMLPUBFUN xmlEntity *
|
||||
xmlNewEntity (xmlDoc *doc,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *content);
|
||||
XMLPUBFUN void
|
||||
xmlFreeEntity (xmlEntity *entity);
|
||||
@@ -105,23 +105,23 @@ XMLPUBFUN int
|
||||
int extSubset,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *content,
|
||||
xmlEntity **out);
|
||||
XMLPUBFUN xmlEntity *
|
||||
xmlAddDocEntity (xmlDoc *doc,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *content);
|
||||
XMLPUBFUN xmlEntity *
|
||||
xmlAddDtdEntity (xmlDoc *doc,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *content);
|
||||
XMLPUBFUN xmlEntity *
|
||||
xmlGetPredefinedEntity (const xmlChar *name);
|
||||
|
@@ -246,6 +246,7 @@ struct _xmlParserCtxt {
|
||||
/**
|
||||
* user data for SAX interface, defaults to the context itself
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
void *userData;
|
||||
/**
|
||||
* @deprecated Use xmlCtxtGetDocument()
|
||||
@@ -296,6 +297,7 @@ struct _xmlParserCtxt {
|
||||
/**
|
||||
* Current input stream
|
||||
*/
|
||||
/* TODO: Add accessors, see issue #762 */
|
||||
xmlParserInput *input;
|
||||
/* Number of current input streams */
|
||||
int inputNr;
|
||||
@@ -306,8 +308,18 @@ struct _xmlParserCtxt {
|
||||
|
||||
/* Node analysis stack only used for DOM building */
|
||||
|
||||
/* Current parsed Node */
|
||||
xmlNode *node XML_DEPRECATED_MEMBER;
|
||||
/**
|
||||
* The current element.
|
||||
*
|
||||
* This is only valid and useful if the default SAX callbacks
|
||||
* which build a document tree are intercepted. This mode of
|
||||
* operation is fragile and discouraged.
|
||||
*
|
||||
* Contains the current element whose content is being parsed,
|
||||
* or NULL if the parser is in top-level or DTD content.
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
xmlNode *node;
|
||||
/* Depth of the parsing stack */
|
||||
int nodeNr XML_DEPRECATED_MEMBER;
|
||||
/* Max depth of the parsing stack */
|
||||
@@ -358,7 +370,11 @@ struct _xmlParserCtxt {
|
||||
/* unused */
|
||||
int token XML_DEPRECATED_MEMBER;
|
||||
|
||||
/* unused internally, still used downstream */
|
||||
/**
|
||||
* The main document URI, if available, with its last
|
||||
* component stripped.
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
char *directory;
|
||||
|
||||
/* Node name stack */
|
||||
@@ -388,13 +404,39 @@ struct _xmlParserCtxt {
|
||||
* SAX callbacks are disabled
|
||||
*/
|
||||
int disableSAX XML_DEPRECATED_MEMBER;
|
||||
/* Parsing is in int 1/ext 2 subset */
|
||||
/**
|
||||
* Set if DTD content is parsed.
|
||||
*
|
||||
* - 0: not in DTD
|
||||
* - 1: in internal DTD subset
|
||||
* - 2: in external DTD subset
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
int inSubset;
|
||||
/* name of subset */
|
||||
/**
|
||||
* @deprecated Use the `name` argument of the
|
||||
* `internalSubset` SAX callback.
|
||||
*
|
||||
* Name of the internal subset (root element type).
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
const xmlChar *intSubName;
|
||||
/* URI of external subset */
|
||||
/**
|
||||
* @deprecated Use the `systemId` argument of the
|
||||
* `internalSubset` SAX callback.
|
||||
*
|
||||
* System identifier (URI) of external the subset.
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
xmlChar *extSubURI;
|
||||
/* SYSTEM ID of external subset */
|
||||
/**
|
||||
* @deprecated Use the `publicId` argument of the
|
||||
* `internalSubset` SAX callback.
|
||||
*
|
||||
* This member is MISNAMED. It contains the *public* identifier
|
||||
* of the external subset.
|
||||
*/
|
||||
/* TODO: Add accessor */
|
||||
xmlChar *extSubSystem;
|
||||
|
||||
/* xml:space values */
|
||||
@@ -431,10 +473,18 @@ struct _xmlParserCtxt {
|
||||
void *_private;
|
||||
/**
|
||||
* @deprecated Use xmlParserOption XML_PARSE_DTDLOAD or
|
||||
* XML_PARSE_DTD_ATTR
|
||||
* XML_PARSE_DTDATTR
|
||||
*
|
||||
* should the external subset be loaded
|
||||
* Control loading of the external subset. Other options like
|
||||
* `validate` can override this value.
|
||||
*
|
||||
* - 0: Don't load external subset.
|
||||
* - XML_DETECT_IDS: Load external subset and store IDs.
|
||||
* - XML_COMPLETE_ATTRS: Load external subset, store IDs and
|
||||
* process default attributes.
|
||||
* - XML_SKIP_IDS: Load external subset and ignore IDs.
|
||||
*/
|
||||
/* TODO: See issue #873 */
|
||||
int loadsubset;
|
||||
/* unused */
|
||||
int linenumbers XML_DEPRECATED_MEMBER;
|
||||
@@ -505,16 +555,17 @@ struct _xmlParserCtxt {
|
||||
*/
|
||||
int options;
|
||||
|
||||
/*
|
||||
* Those fields are needed only for streaming parsing so far
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated Use inverted xmlParserOption XML_PARSE_NODICT
|
||||
*
|
||||
* Use dictionary names for the tree
|
||||
*/
|
||||
int dictNames XML_DEPRECATED_MEMBER;
|
||||
|
||||
/*
|
||||
* Those fields are needed only for streaming parsing so far
|
||||
*/
|
||||
|
||||
/* number of freed element nodes */
|
||||
int freeElemsNr XML_DEPRECATED_MEMBER;
|
||||
/* List of freed element nodes */
|
||||
@@ -589,47 +640,45 @@ struct _xmlSAXLocator {
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback:
|
||||
* The entity loader, to control the loading of external entities,
|
||||
* the application can either:
|
||||
* - override this resolveEntity() callback in the SAX block
|
||||
* - or better use the xmlSetExternalEntityLoader() function to
|
||||
* set up it's own entity resolution routine
|
||||
* SAX callback to resolve external entities.
|
||||
*
|
||||
* This is only used to load DTDs. The preferred way to install
|
||||
* custom resolvers is xmlCtxtSetResourceLoader().
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param publicId The public ID of the entity
|
||||
* @param systemId The system ID of the entity
|
||||
* @param publicId The public identifier of the entity
|
||||
* @param systemId The system identifier of the entity (URL)
|
||||
* @returns the xmlParserInput if inlined or NULL for DOM behaviour.
|
||||
*/
|
||||
typedef xmlParserInput *(*resolveEntitySAXFunc) (void *ctx,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
/**
|
||||
* Callback on internal subset declaration.
|
||||
* SAX callback for the internal subset.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name the root element name
|
||||
* @param ExternalID the external ID
|
||||
* @param SystemID the SYSTEM ID (e.g. filename or URL)
|
||||
* @param publicId the public identifier
|
||||
* @param systemId the system identifier (e.g. filename or URL)
|
||||
*/
|
||||
typedef void (*internalSubsetSAXFunc) (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
/**
|
||||
* Callback on external subset declaration.
|
||||
* SAX callback for the external subset.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name the root element name
|
||||
* @param ExternalID the external ID
|
||||
* @param SystemID the SYSTEM ID (e.g. filename or URL)
|
||||
* @param publicId the public identifier
|
||||
* @param systemId the system identifier (e.g. filename or URL)
|
||||
*/
|
||||
typedef void (*externalSubsetSAXFunc) (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
/**
|
||||
* Get an entity by name.
|
||||
* SAX callback to look up a general entity by name.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The entity name
|
||||
@@ -638,7 +687,7 @@ typedef void (*externalSubsetSAXFunc) (void *ctx,
|
||||
typedef xmlEntity *(*getEntitySAXFunc) (void *ctx,
|
||||
const xmlChar *name);
|
||||
/**
|
||||
* Get a parameter entity by name.
|
||||
* SAX callback to look up a parameter entity by name.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The entity name
|
||||
@@ -647,7 +696,7 @@ typedef xmlEntity *(*getEntitySAXFunc) (void *ctx,
|
||||
typedef xmlEntity *(*getParameterEntitySAXFunc) (void *ctx,
|
||||
const xmlChar *name);
|
||||
/**
|
||||
* An entity definition has been parsed.
|
||||
* SAX callback for entity declarations.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name the entity name
|
||||
@@ -663,19 +712,19 @@ typedef void (*entityDeclSAXFunc) (void *ctx,
|
||||
const xmlChar *systemId,
|
||||
xmlChar *content);
|
||||
/**
|
||||
* What to do when a notation declaration has been parsed.
|
||||
* SAX callback for notation declarations.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The name of the notation
|
||||
* @param publicId The public ID of the entity
|
||||
* @param systemId The system ID of the entity
|
||||
* @param publicId The public ID of the notation
|
||||
* @param systemId The system ID of the notation
|
||||
*/
|
||||
typedef void (*notationDeclSAXFunc)(void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
/**
|
||||
* An attribute definition has been parsed.
|
||||
* SAX callback for attribute declarations.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param elem the name of the element
|
||||
@@ -693,7 +742,7 @@ typedef void (*attributeDeclSAXFunc)(void *ctx,
|
||||
const xmlChar *defaultValue,
|
||||
xmlEnumeration *tree);
|
||||
/**
|
||||
* An element definition has been parsed.
|
||||
* SAX callback for element declarations.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name the element name
|
||||
@@ -705,7 +754,7 @@ typedef void (*elementDeclSAXFunc)(void *ctx,
|
||||
int type,
|
||||
xmlElementContent *content);
|
||||
/**
|
||||
* What to do when an unparsed entity declaration is parsed.
|
||||
* SAX callback for unparsed entity declarations.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The name of the entity
|
||||
@@ -719,8 +768,11 @@ typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *notationName);
|
||||
/**
|
||||
* Receive the document locator at startup, actually xmlDefaultSAXLocator.
|
||||
* Everything is available on the context, so this is useless in our case.
|
||||
* This callback receives the "document locator" at startup,
|
||||
* which is always the global xmlDefaultSAXLocator.
|
||||
*
|
||||
* Everything is available on the context, so this is useless in
|
||||
* our case.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param loc A SAX Locator
|
||||
@@ -728,19 +780,19 @@ typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
|
||||
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
|
||||
xmlSAXLocator *loc);
|
||||
/**
|
||||
* Called when the document start being processed.
|
||||
* SAX callback for start of document.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
*/
|
||||
typedef void (*startDocumentSAXFunc) (void *ctx);
|
||||
/**
|
||||
* Called when the document end has been detected.
|
||||
* SAX callback for end of document.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
*/
|
||||
typedef void (*endDocumentSAXFunc) (void *ctx);
|
||||
/**
|
||||
* Called when an opening tag has been processed.
|
||||
* SAX callback for start tags.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The element name, including namespace prefix
|
||||
@@ -750,7 +802,7 @@ typedef void (*startElementSAXFunc) (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar **atts);
|
||||
/**
|
||||
* Called when the end of an element has been detected.
|
||||
* SAX callback for end tags.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The element name
|
||||
@@ -758,10 +810,9 @@ typedef void (*startElementSAXFunc) (void *ctx,
|
||||
typedef void (*endElementSAXFunc) (void *ctx,
|
||||
const xmlChar *name);
|
||||
/**
|
||||
* Handle an attribute that has been read by the parser.
|
||||
* The default handling is to convert the attribute into an
|
||||
* DOM subtree and past it in a new xmlAttr element added to
|
||||
* the element.
|
||||
* Callback for attributes.
|
||||
*
|
||||
* @deprecated This typedef is unused.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The attribute name, including namespace prefix
|
||||
@@ -771,7 +822,7 @@ typedef void (*attributeSAXFunc) (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
/**
|
||||
* Called when an entity reference is detected.
|
||||
* SAX callback for entity references.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param name The entity name
|
||||
@@ -779,7 +830,7 @@ typedef void (*attributeSAXFunc) (void *ctx,
|
||||
typedef void (*referenceSAXFunc) (void *ctx,
|
||||
const xmlChar *name);
|
||||
/**
|
||||
* Receiving some chars from the parser.
|
||||
* SAX callback for character data.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param ch a xmlChar string
|
||||
@@ -789,8 +840,7 @@ typedef void (*charactersSAXFunc) (void *ctx,
|
||||
const xmlChar *ch,
|
||||
int len);
|
||||
/**
|
||||
* Receiving some ignorable whitespaces from the parser.
|
||||
* UNUSED: by default the DOM building will use characters.
|
||||
* SAX callback for "ignorable" whitespace.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param ch a xmlChar string
|
||||
@@ -800,7 +850,7 @@ typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
|
||||
const xmlChar *ch,
|
||||
int len);
|
||||
/**
|
||||
* A processing instruction has been parsed.
|
||||
* SAX callback for processing instructions.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param target the target name
|
||||
@@ -810,7 +860,7 @@ typedef void (*processingInstructionSAXFunc) (void *ctx,
|
||||
const xmlChar *target,
|
||||
const xmlChar *data);
|
||||
/**
|
||||
* A comment has been parsed.
|
||||
* SAX callback for comments.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param value the comment content
|
||||
@@ -818,7 +868,7 @@ typedef void (*processingInstructionSAXFunc) (void *ctx,
|
||||
typedef void (*commentSAXFunc) (void *ctx,
|
||||
const xmlChar *value);
|
||||
/**
|
||||
* Called when a pcdata block has been parsed.
|
||||
* SAX callback for CDATA sections.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @param value The pcdata content
|
||||
@@ -829,7 +879,7 @@ typedef void (*cdataBlockSAXFunc) (
|
||||
const xmlChar *value,
|
||||
int len);
|
||||
/**
|
||||
* Display and format a warning messages, callback.
|
||||
* SAX callback for warning messages.
|
||||
*
|
||||
* @param ctx an XML parser context
|
||||
* @param msg the message to display/transmit
|
||||
@@ -838,7 +888,7 @@ typedef void (*cdataBlockSAXFunc) (
|
||||
typedef void (*warningSAXFunc) (void *ctx,
|
||||
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
/**
|
||||
* Display and format an error messages, callback.
|
||||
* SAX callback for error messages.
|
||||
*
|
||||
* @param ctx an XML parser context
|
||||
* @param msg the message to display/transmit
|
||||
@@ -847,10 +897,7 @@ typedef void (*warningSAXFunc) (void *ctx,
|
||||
typedef void (*errorSAXFunc) (void *ctx,
|
||||
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
/**
|
||||
* Display and format fatal error messages, callback.
|
||||
* Note: so far fatalError() SAX callbacks are not used, error()
|
||||
* get all the callbacks for errors.
|
||||
*
|
||||
* SAX callback for fatal error messages.
|
||||
*
|
||||
* @param ctx an XML parser context
|
||||
* @param msg the message to display/transmit
|
||||
@@ -859,14 +906,14 @@ typedef void (*errorSAXFunc) (void *ctx,
|
||||
typedef void (*fatalErrorSAXFunc) (void *ctx,
|
||||
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
/**
|
||||
* Is this document tagged standalone?
|
||||
* SAX callback to get standalone status.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @returns 1 if true
|
||||
*/
|
||||
typedef int (*isStandaloneSAXFunc) (void *ctx);
|
||||
/**
|
||||
* Does this document has an internal subset.
|
||||
* SAX callback to get internal subset status.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @returns 1 if true
|
||||
@@ -874,7 +921,7 @@ typedef int (*isStandaloneSAXFunc) (void *ctx);
|
||||
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
|
||||
|
||||
/**
|
||||
* Does this document has an external subset?
|
||||
* SAX callback to get external subset status.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
* @returns 1 if true
|
||||
@@ -887,12 +934,13 @@ typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
|
||||
* *
|
||||
************************************************************************/
|
||||
/**
|
||||
* Special constant found in SAX2 blocks initialized fields
|
||||
* Special constant required for SAX2 handlers.
|
||||
*/
|
||||
#define XML_SAX2_MAGIC 0xDEEDBEAF
|
||||
|
||||
/**
|
||||
* SAX2 callback when an element start has been detected by the parser.
|
||||
* SAX2 callback for start tags.
|
||||
*
|
||||
* It provides the namespace information for the element, as well as
|
||||
* the new namespace declarations on the element.
|
||||
*
|
||||
@@ -920,7 +968,8 @@ typedef void (*startElementNsSAX2Func) (void *ctx,
|
||||
const xmlChar **attributes);
|
||||
|
||||
/**
|
||||
* SAX2 callback when an element end has been detected by the parser.
|
||||
* SAX2 callback for end tags.
|
||||
*
|
||||
* It provides the namespace information for the element.
|
||||
*
|
||||
* @param ctx the user data (XML parser context)
|
||||
@@ -942,38 +991,89 @@ typedef void (*endElementNsSAX2Func) (void *ctx,
|
||||
* ignored.
|
||||
*/
|
||||
struct _xmlSAXHandler {
|
||||
/** DTD */
|
||||
/**
|
||||
* Called after the start of the document type declaration
|
||||
* was parsed.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
internalSubsetSAXFunc internalSubset;
|
||||
/** unused */
|
||||
/**
|
||||
* Standalone status. Not invoked by the parser. Not supposed
|
||||
* to be changed by applications.
|
||||
*/
|
||||
isStandaloneSAXFunc isStandalone;
|
||||
/** DTD */
|
||||
/**
|
||||
* Internal subset availability. Not invoked by the parser.
|
||||
* Not supposed to be changed by applications.
|
||||
*/
|
||||
hasInternalSubsetSAXFunc hasInternalSubset;
|
||||
/** DTD */
|
||||
/**
|
||||
* External subset availability. Not invoked by the parser.
|
||||
* Not supposed to be changed by applications.
|
||||
*/
|
||||
hasExternalSubsetSAXFunc hasExternalSubset;
|
||||
/** DTD */
|
||||
/**
|
||||
* Only called when loading external DTDs. Not called to load
|
||||
* external entities.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
resolveEntitySAXFunc resolveEntity;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called when looking up general entities.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
getEntitySAXFunc getEntity;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called after an entity declaration was parsed.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
entityDeclSAXFunc entityDecl;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called after a notation declaration was parsed.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
notationDeclSAXFunc notationDecl;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called after an attribute declaration was parsed.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
attributeDeclSAXFunc attributeDecl;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called after an element declaration was parsed.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
elementDeclSAXFunc elementDecl;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called after an unparsed entity declaration was parsed.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
||||
/** useless */
|
||||
/**
|
||||
* This callback receives the "document locator" at startup,
|
||||
* which is always the global xmlDefaultSAXLocator.
|
||||
*
|
||||
* Everything is available on the context, so this is useless in
|
||||
* our case.
|
||||
*/
|
||||
setDocumentLocatorSAXFunc setDocumentLocator;
|
||||
/**
|
||||
* Called at the start of a document
|
||||
* Called after the XML declaration was parsed.
|
||||
*
|
||||
* Use xmlCtxtGetVersion(), xmlCtxtGetDeclaredEncoding() and
|
||||
* xmlCtxtGetStandalone() to get data from the XML declaration.
|
||||
*/
|
||||
startDocumentSAXFunc startDocument;
|
||||
/** End of document */
|
||||
/**
|
||||
* Called at the end of the document.
|
||||
*/
|
||||
endDocumentSAXFunc endDocument;
|
||||
/**
|
||||
* Legacy start tag handler
|
||||
@@ -991,34 +1091,61 @@ struct _xmlSAXHandler {
|
||||
* together with custom SAX callbacks.
|
||||
*/
|
||||
startElementSAXFunc startElement;
|
||||
/** See _xmlSAXHandler.startElement */
|
||||
/**
|
||||
* See _xmlSAXHandler.startElement
|
||||
*/
|
||||
endElementSAXFunc endElement;
|
||||
/** Entity reference */
|
||||
/**
|
||||
* Called after an entity reference was parsed.
|
||||
*/
|
||||
referenceSAXFunc reference;
|
||||
/** Text */
|
||||
/**
|
||||
* Called after a character data was parsed.
|
||||
*/
|
||||
charactersSAXFunc characters;
|
||||
/**
|
||||
* Ignorable whitespace
|
||||
* Called after "ignorable" whitespace was parsed.
|
||||
*
|
||||
* `ignorableWhitespace` should always be set to the same value
|
||||
* as `characters`. Otherwise, the parser will try to detect
|
||||
* whitespace which is unreliable.
|
||||
*/
|
||||
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
||||
/** Processing instruction */
|
||||
/**
|
||||
* Called after a processing instruction was parsed.
|
||||
*/
|
||||
processingInstructionSAXFunc processingInstruction;
|
||||
/** Comment */
|
||||
/**
|
||||
* Called after a comment was parsed.
|
||||
*/
|
||||
commentSAXFunc comment;
|
||||
/** Warning message */
|
||||
/**
|
||||
* Callback for warning messages.
|
||||
*/
|
||||
warningSAXFunc warning;
|
||||
/** Error message */
|
||||
/**
|
||||
* Callback for error messages.
|
||||
*/
|
||||
errorSAXFunc error;
|
||||
/** Unused, all errors go to `error`. */
|
||||
/**
|
||||
* Unused, all errors go to `error`.
|
||||
*/
|
||||
fatalErrorSAXFunc fatalError;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called when looking up parameter entities.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
getParameterEntitySAXFunc getParameterEntity;
|
||||
/**
|
||||
* Called after a CDATA section was parsed.
|
||||
*/
|
||||
cdataBlockSAXFunc cdataBlock;
|
||||
/** DTD */
|
||||
/**
|
||||
* Called to parse the external subset.
|
||||
*
|
||||
* Should typically not be modified.
|
||||
*/
|
||||
externalSubsetSAXFunc externalSubset;
|
||||
/**
|
||||
* Legacy magic value
|
||||
@@ -1027,11 +1154,17 @@ struct _xmlSAXHandler {
|
||||
* enable the modern SAX2 interface.
|
||||
*/
|
||||
unsigned int initialized;
|
||||
/** Application data */
|
||||
/**
|
||||
* Application data
|
||||
*/
|
||||
void *_private;
|
||||
/** Start tag */
|
||||
/**
|
||||
* Called after a start tag was parsed.
|
||||
*/
|
||||
startElementNsSAX2Func startElementNs;
|
||||
/** End tag */
|
||||
/**
|
||||
* Called after an end tag was parsed.
|
||||
*/
|
||||
endElementNsSAX2Func endElementNs;
|
||||
/**
|
||||
* Structured error handler.
|
||||
@@ -1045,7 +1178,9 @@ struct _xmlSAXHandler {
|
||||
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
|
||||
typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
|
||||
/**
|
||||
* SAX Version 1
|
||||
* SAX handler, version 1.
|
||||
*
|
||||
* @deprecated Use version 2 handlers.
|
||||
*/
|
||||
struct _xmlSAXHandlerV1 {
|
||||
internalSubsetSAXFunc internalSubset;
|
||||
@@ -1080,7 +1215,7 @@ struct _xmlSAXHandlerV1 {
|
||||
|
||||
|
||||
/**
|
||||
* External entity loaders types.
|
||||
* External entity loader.
|
||||
*
|
||||
* @param URL The System ID of the resource requested
|
||||
* @param ID The Public ID of the resource requested
|
||||
@@ -1367,8 +1502,8 @@ XMLPUBFUN xmlDoc *
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlCtxtParseDtd (xmlParserCtxt *ctxt,
|
||||
xmlParserInput *input,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN int
|
||||
xmlCtxtValidateDocument (xmlParserCtxt *ctxt,
|
||||
xmlDoc *doc);
|
||||
@@ -1379,11 +1514,11 @@ XMLPUBFUN int
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlSAXParseDTD (xmlSAXHandler *sax,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlParseDTD (const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
xmlParseDTD (const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlIOParseDTD (xmlSAXHandler *sax,
|
||||
xmlParserInputBuffer *input,
|
||||
|
@@ -358,7 +358,7 @@ XMLPUBFUN void
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseExternalID (xmlParserCtxt *ctxt,
|
||||
xmlChar **publicID,
|
||||
xmlChar **publicId,
|
||||
int strict);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
@@ -479,8 +479,8 @@ XMLPUBFUN void
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseExternalSubset (xmlParserCtxt *ctxt,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
|
||||
/** @cond ignore */
|
||||
#define XML_SUBSTITUTE_NONE 0
|
||||
|
@@ -791,13 +791,13 @@ XMLPUBFUN const xmlChar *
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlCreateIntSubset (xmlDoc *doc,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlNewDtd (xmlDoc *doc,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN xmlDtd *
|
||||
xmlGetIntSubset (const xmlDoc *doc);
|
||||
XMLPUBFUN void
|
||||
|
@@ -112,8 +112,8 @@ XMLPUBFUN xmlNotation *
|
||||
xmlAddNotationDecl (xmlValidCtxt *ctxt,
|
||||
xmlDtd *dtd,
|
||||
const xmlChar *name,
|
||||
const xmlChar *PublicID,
|
||||
const xmlChar *SystemID);
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlNotationTable *
|
||||
xmlCopyNotationTable (xmlNotationTable *table);
|
||||
|
61
parser.c
61
parser.c
@@ -4913,7 +4913,7 @@ xmlParseCharData(xmlParserCtxt *ctxt, ATTRIBUTE_UNUSED int cdata) {
|
||||
* [83] PublicID ::= 'PUBLIC' S PubidLiteral
|
||||
*
|
||||
* @param ctxt an XML parser context
|
||||
* @param publicID a xmlChar** receiving PubidLiteral
|
||||
* @param publicId a xmlChar** receiving PubidLiteral
|
||||
* @param strict indicate whether we should restrict parsing to only
|
||||
* production [75], see NOTE below
|
||||
* @returns the function returns SystemLiteral and in the second
|
||||
@@ -4922,10 +4922,10 @@ xmlParseCharData(xmlParserCtxt *ctxt, ATTRIBUTE_UNUSED int cdata) {
|
||||
*/
|
||||
|
||||
xmlChar *
|
||||
xmlParseExternalID(xmlParserCtxt *ctxt, xmlChar **publicID, int strict) {
|
||||
xmlParseExternalID(xmlParserCtxt *ctxt, xmlChar **publicId, int strict) {
|
||||
xmlChar *URI = NULL;
|
||||
|
||||
*publicID = NULL;
|
||||
*publicId = NULL;
|
||||
if (CMP6(CUR_PTR, 'S', 'Y', 'S', 'T', 'E', 'M')) {
|
||||
SKIP(6);
|
||||
if (SKIP_BLANKS == 0) {
|
||||
@@ -4942,8 +4942,8 @@ xmlParseExternalID(xmlParserCtxt *ctxt, xmlChar **publicID, int strict) {
|
||||
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
|
||||
"Space required after 'PUBLIC'\n");
|
||||
}
|
||||
*publicID = xmlParsePubidLiteral(ctxt);
|
||||
if (*publicID == NULL) {
|
||||
*publicId = xmlParsePubidLiteral(ctxt);
|
||||
if (*publicId == NULL) {
|
||||
xmlFatalErr(ctxt, XML_ERR_PUBID_REQUIRED, NULL);
|
||||
}
|
||||
if (strict) {
|
||||
@@ -7104,12 +7104,12 @@ xmlParseTextDecl(xmlParserCtxt *ctxt) {
|
||||
* [31] extSubsetDecl ::= (markupdecl | conditionalSect |
|
||||
* PEReference | S) *
|
||||
* @param ctxt an XML parser context
|
||||
* @param ExternalID the external identifier
|
||||
* @param SystemID the system identifier (or URL)
|
||||
* @param publicId the public identifier
|
||||
* @param systemId the system identifier (URL)
|
||||
*/
|
||||
void
|
||||
xmlParseExternalSubset(xmlParserCtxt *ctxt, const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID) {
|
||||
xmlParseExternalSubset(xmlParserCtxt *ctxt, const xmlChar *publicId,
|
||||
const xmlChar *systemId) {
|
||||
int oldInputNr;
|
||||
|
||||
xmlCtxtInitializeLate(ctxt);
|
||||
@@ -7128,7 +7128,7 @@ xmlParseExternalSubset(xmlParserCtxt *ctxt, const xmlChar *ExternalID,
|
||||
ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
||||
}
|
||||
if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL) &&
|
||||
(xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID) == NULL)) {
|
||||
(xmlCreateIntSubset(ctxt->myDoc, NULL, publicId, systemId) == NULL)) {
|
||||
xmlErrMemory(ctxt);
|
||||
}
|
||||
|
||||
@@ -7996,7 +7996,7 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
|
||||
void
|
||||
xmlParseDocTypeDecl(xmlParserCtxt *ctxt) {
|
||||
const xmlChar *name = NULL;
|
||||
xmlChar *ExternalID = NULL;
|
||||
xmlChar *publicId = NULL;
|
||||
xmlChar *URI = NULL;
|
||||
|
||||
/*
|
||||
@@ -8022,15 +8022,15 @@ xmlParseDocTypeDecl(xmlParserCtxt *ctxt) {
|
||||
SKIP_BLANKS;
|
||||
|
||||
/*
|
||||
* Check for SystemID and ExternalID
|
||||
* Check for public and system identifier (URI)
|
||||
*/
|
||||
URI = xmlParseExternalID(ctxt, &ExternalID, 1);
|
||||
URI = xmlParseExternalID(ctxt, &publicId, 1);
|
||||
|
||||
if ((URI != NULL) || (ExternalID != NULL)) {
|
||||
if ((URI != NULL) || (publicId != NULL)) {
|
||||
ctxt->hasExternalSubset = 1;
|
||||
}
|
||||
ctxt->extSubURI = URI;
|
||||
ctxt->extSubSystem = ExternalID;
|
||||
ctxt->extSubSystem = publicId;
|
||||
|
||||
SKIP_BLANKS;
|
||||
|
||||
@@ -8039,7 +8039,7 @@ xmlParseDocTypeDecl(xmlParserCtxt *ctxt) {
|
||||
*/
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI);
|
||||
ctxt->sax->internalSubset(ctxt->userData, name, publicId, URI);
|
||||
|
||||
if ((RAW != '[') && (RAW != '>')) {
|
||||
xmlFatalErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, NULL);
|
||||
@@ -11262,6 +11262,9 @@ done:
|
||||
* ctxt->myDoc. So ctxt->myDoc should be set to NULL after extracting
|
||||
* the document.
|
||||
*
|
||||
* Since 2.14.0, xmlCtxtGetDocument() can be used to retrieve the
|
||||
* result document.
|
||||
*
|
||||
* @param ctxt an XML parser context
|
||||
* @param chunk chunk of memory
|
||||
* @param size size of chunk in bytes
|
||||
@@ -11615,20 +11618,20 @@ xmlIOParseDTD(xmlSAXHandler *sax, xmlParserInputBuffer *input,
|
||||
* @deprecated Use xmlCtxtParseDtd().
|
||||
*
|
||||
* @param sax the SAX handler block
|
||||
* @param ExternalID a NAME* containing the External ID of the DTD
|
||||
* @param SystemID a NAME* containing the URL to the DTD
|
||||
* @param publicId public identifier of the DTD (optional)
|
||||
* @param systemId system identifier (URL) of the DTD
|
||||
* @returns the resulting xmlDtd or NULL in case of error.
|
||||
*/
|
||||
|
||||
xmlDtd *
|
||||
xmlSAXParseDTD(xmlSAXHandler *sax, const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID) {
|
||||
xmlSAXParseDTD(xmlSAXHandler *sax, const xmlChar *publicId,
|
||||
const xmlChar *systemId) {
|
||||
xmlDtdPtr ret = NULL;
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlParserInputPtr input = NULL;
|
||||
xmlChar* systemIdCanonic;
|
||||
|
||||
if ((ExternalID == NULL) && (SystemID == NULL)) return(NULL);
|
||||
if ((publicId == NULL) && (systemId == NULL)) return(NULL);
|
||||
|
||||
ctxt = xmlNewSAXParserCtxt(sax, NULL);
|
||||
if (ctxt == NULL) {
|
||||
@@ -11639,8 +11642,8 @@ xmlSAXParseDTD(xmlSAXHandler *sax, const xmlChar *ExternalID,
|
||||
/*
|
||||
* Canonicalise the system ID
|
||||
*/
|
||||
systemIdCanonic = xmlCanonicPath(SystemID);
|
||||
if ((SystemID != NULL) && (systemIdCanonic == NULL)) {
|
||||
systemIdCanonic = xmlCanonicPath(systemId);
|
||||
if ((systemId != NULL) && (systemIdCanonic == NULL)) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
@@ -11650,7 +11653,7 @@ xmlSAXParseDTD(xmlSAXHandler *sax, const xmlChar *ExternalID,
|
||||
*/
|
||||
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
|
||||
input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
|
||||
input = ctxt->sax->resolveEntity(ctxt->userData, publicId,
|
||||
systemIdCanonic);
|
||||
if (input == NULL) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
@@ -11664,7 +11667,7 @@ xmlSAXParseDTD(xmlSAXHandler *sax, const xmlChar *ExternalID,
|
||||
else
|
||||
xmlFree(systemIdCanonic);
|
||||
|
||||
ret = xmlCtxtParseDtd(ctxt, input, ExternalID, SystemID);
|
||||
ret = xmlCtxtParseDtd(ctxt, input, publicId, systemId);
|
||||
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(ret);
|
||||
@@ -11674,14 +11677,14 @@ xmlSAXParseDTD(xmlSAXHandler *sax, const xmlChar *ExternalID,
|
||||
/**
|
||||
* Load and parse an external subset.
|
||||
*
|
||||
* @param ExternalID a NAME* containing the External ID of the DTD
|
||||
* @param SystemID a NAME* containing the URL to the DTD
|
||||
* @param publicId public identifier of the DTD (optional)
|
||||
* @param systemId system identifier (URL) of the DTD
|
||||
* @returns the resulting xmlDtd or NULL in case of error.
|
||||
*/
|
||||
|
||||
xmlDtd *
|
||||
xmlParseDTD(const xmlChar *ExternalID, const xmlChar *SystemID) {
|
||||
return(xmlSAXParseDTD(NULL, ExternalID, SystemID));
|
||||
xmlParseDTD(const xmlChar *publicId, const xmlChar *systemId) {
|
||||
return(xmlSAXParseDTD(NULL, publicId, systemId));
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
|
32
tree.c
32
tree.c
@@ -780,14 +780,14 @@ xmlFreeNsList(xmlNs *cur) {
|
||||
*
|
||||
* @param doc the document pointer (optional)
|
||||
* @param name the DTD name (optional)
|
||||
* @param ExternalID the external ID (optional)
|
||||
* @param SystemID the system ID (optional)
|
||||
* @param publicId public identifier of the DTD (optional)
|
||||
* @param systemId system identifier (URL) of the DTD (optional)
|
||||
* @returns a pointer to the new DTD object or NULL if arguments are
|
||||
* invalid or a memory allocation failed.
|
||||
*/
|
||||
xmlDtd *
|
||||
xmlNewDtd(xmlDoc *doc, const xmlChar *name,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID) {
|
||||
xmlNewDtd(xmlDoc *doc, const xmlChar *name, const xmlChar *publicId,
|
||||
const xmlChar *systemId) {
|
||||
xmlDtdPtr cur;
|
||||
|
||||
if ((doc != NULL) && (doc->extSubset != NULL)) {
|
||||
@@ -808,13 +808,13 @@ xmlNewDtd(xmlDoc *doc, const xmlChar *name,
|
||||
if (cur->name == NULL)
|
||||
goto error;
|
||||
}
|
||||
if (ExternalID != NULL) {
|
||||
cur->ExternalID = xmlStrdup(ExternalID);
|
||||
if (publicId != NULL) {
|
||||
cur->ExternalID = xmlStrdup(publicId);
|
||||
if (cur->ExternalID == NULL)
|
||||
goto error;
|
||||
}
|
||||
if (SystemID != NULL) {
|
||||
cur->SystemID = xmlStrdup(SystemID);
|
||||
if (systemId != NULL) {
|
||||
cur->SystemID = xmlStrdup(systemId);
|
||||
if (cur->SystemID == NULL)
|
||||
goto error;
|
||||
}
|
||||
@@ -862,14 +862,14 @@ xmlGetIntSubset(const xmlDoc *doc) {
|
||||
*
|
||||
* @param doc the document pointer (optional)
|
||||
* @param name the DTD name (optional)
|
||||
* @param ExternalID the external (PUBLIC) ID (optional)
|
||||
* @param SystemID the system ID (optional)
|
||||
* @param publicId public identifier of the DTD (optional)
|
||||
* @param systemId system identifier (URL) of the DTD (optional)
|
||||
* @returns a pointer to the new or existing DTD object or NULL if
|
||||
* arguments are invalid or a memory allocation failed.
|
||||
*/
|
||||
xmlDtd *
|
||||
xmlCreateIntSubset(xmlDoc *doc, const xmlChar *name,
|
||||
const xmlChar *ExternalID, const xmlChar *SystemID) {
|
||||
xmlCreateIntSubset(xmlDoc *doc, const xmlChar *name, const xmlChar *publicId,
|
||||
const xmlChar *systemId) {
|
||||
xmlDtdPtr cur;
|
||||
|
||||
if (doc != NULL) {
|
||||
@@ -892,13 +892,13 @@ xmlCreateIntSubset(xmlDoc *doc, const xmlChar *name,
|
||||
if (cur->name == NULL)
|
||||
goto error;
|
||||
}
|
||||
if (ExternalID != NULL) {
|
||||
cur->ExternalID = xmlStrdup(ExternalID);
|
||||
if (publicId != NULL) {
|
||||
cur->ExternalID = xmlStrdup(publicId);
|
||||
if (cur->ExternalID == NULL)
|
||||
goto error;
|
||||
}
|
||||
if (SystemID != NULL) {
|
||||
cur->SystemID = xmlStrdup(SystemID);
|
||||
if (systemId != NULL) {
|
||||
cur->SystemID = xmlStrdup(systemId);
|
||||
if (cur->SystemID == NULL)
|
||||
goto error;
|
||||
}
|
||||
|
19
valid.c
19
valid.c
@@ -2022,14 +2022,13 @@ xmlFreeNotation(xmlNotationPtr nota) {
|
||||
* @param dtd pointer to the DTD
|
||||
* @param ctxt the validation context
|
||||
* @param name the entity name
|
||||
* @param PublicID the public identifier or NULL
|
||||
* @param SystemID the system identifier or NULL
|
||||
* @param publicId the public identifier or NULL
|
||||
* @param systemId the system identifier or NULL
|
||||
* @returns the notation or NULL on error.
|
||||
*/
|
||||
xmlNotation *
|
||||
xmlAddNotationDecl(xmlValidCtxt *ctxt, xmlDtd *dtd,
|
||||
const xmlChar *name,
|
||||
const xmlChar *PublicID, const xmlChar *SystemID) {
|
||||
xmlAddNotationDecl(xmlValidCtxt *ctxt, xmlDtd *dtd, const xmlChar *name,
|
||||
const xmlChar *publicId, const xmlChar *systemId) {
|
||||
xmlNotationPtr ret = NULL;
|
||||
xmlNotationTablePtr table;
|
||||
int res;
|
||||
@@ -2040,7 +2039,7 @@ xmlAddNotationDecl(xmlValidCtxt *ctxt, xmlDtd *dtd,
|
||||
if (name == NULL) {
|
||||
return(NULL);
|
||||
}
|
||||
if ((PublicID == NULL) && (SystemID == NULL)) {
|
||||
if ((publicId == NULL) && (systemId == NULL)) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@@ -2069,13 +2068,13 @@ xmlAddNotationDecl(xmlValidCtxt *ctxt, xmlDtd *dtd,
|
||||
ret->name = xmlStrdup(name);
|
||||
if (ret->name == NULL)
|
||||
goto mem_error;
|
||||
if (SystemID != NULL) {
|
||||
ret->SystemID = xmlStrdup(SystemID);
|
||||
if (systemId != NULL) {
|
||||
ret->SystemID = xmlStrdup(systemId);
|
||||
if (ret->SystemID == NULL)
|
||||
goto mem_error;
|
||||
}
|
||||
if (PublicID != NULL) {
|
||||
ret->PublicID = xmlStrdup(PublicID);
|
||||
if (publicId != NULL) {
|
||||
ret->PublicID = xmlStrdup(publicId);
|
||||
if (ret->PublicID == NULL)
|
||||
goto mem_error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user