mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
parser: Add more parser context accessors
This commit is contained in:
@ -339,7 +339,7 @@ struct _xmlParserCtxt {
|
|||||||
/* set line number in element content */
|
/* set line number in element content */
|
||||||
int linenumbers XML_DEPRECATED_MEMBER;
|
int linenumbers XML_DEPRECATED_MEMBER;
|
||||||
/* document's own catalog */
|
/* document's own catalog */
|
||||||
void *catalogs;
|
void *catalogs XML_DEPRECATED_MEMBER;
|
||||||
/* run in recovery mode */
|
/* run in recovery mode */
|
||||||
int recovery XML_DEPRECATED_MEMBER;
|
int recovery XML_DEPRECATED_MEMBER;
|
||||||
/* unused */
|
/* unused */
|
||||||
@ -1334,10 +1334,6 @@ XMLPUBFUN void
|
|||||||
xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
|
xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
|
||||||
XMLPUBFUN xmlExternalEntityLoader
|
XMLPUBFUN xmlExternalEntityLoader
|
||||||
xmlGetExternalEntityLoader(void);
|
xmlGetExternalEntityLoader(void);
|
||||||
XMLPUBFUN void
|
|
||||||
xmlCtxtSetResourceLoader(xmlParserCtxtPtr ctxt,
|
|
||||||
xmlResourceLoader loader,
|
|
||||||
void *vctxt);
|
|
||||||
XMLPUBFUN xmlParserInputPtr
|
XMLPUBFUN xmlParserInputPtr
|
||||||
xmlLoadExternalEntity (const char *URL,
|
xmlLoadExternalEntity (const char *URL,
|
||||||
const char *ID,
|
const char *ID,
|
||||||
@ -1398,14 +1394,29 @@ XMLPUBFUN int
|
|||||||
int size,
|
int size,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
const char *encoding);
|
const char *encoding);
|
||||||
|
XMLPUBFUN int
|
||||||
|
xmlCtxtGetOptions (xmlParserCtxtPtr ctxt);
|
||||||
XMLPUBFUN int
|
XMLPUBFUN int
|
||||||
xmlCtxtSetOptions (xmlParserCtxtPtr ctxt,
|
xmlCtxtSetOptions (xmlParserCtxtPtr ctxt,
|
||||||
int options);
|
int options);
|
||||||
XMLPUBFUN int
|
|
||||||
xmlCtxtGetOptions (xmlParserCtxtPtr ctxt);
|
|
||||||
XMLPUBFUN int
|
XMLPUBFUN int
|
||||||
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
|
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
|
||||||
int options);
|
int options);
|
||||||
|
XMLPUBFUN void *
|
||||||
|
xmlCtxtGetPrivate (xmlParserCtxtPtr ctxt);
|
||||||
|
XMLPUBFUN void
|
||||||
|
xmlCtxtSetPrivate (xmlParserCtxtPtr ctxt,
|
||||||
|
void *priv);
|
||||||
|
XMLPUBFUN void *
|
||||||
|
xmlCtxtGetCatalogs (xmlParserCtxtPtr ctxt);
|
||||||
|
XMLPUBFUN void
|
||||||
|
xmlCtxtSetCatalogs (xmlParserCtxtPtr ctxt,
|
||||||
|
void *catalogs);
|
||||||
|
XMLPUBFUN xmlDictPtr
|
||||||
|
xmlCtxtGetDict (xmlParserCtxtPtr ctxt);
|
||||||
|
XMLPUBFUN void
|
||||||
|
xmlCtxtSetDict (xmlParserCtxtPtr ctxt,
|
||||||
|
xmlDictPtr);
|
||||||
XMLPUBFUN const xmlChar *
|
XMLPUBFUN const xmlChar *
|
||||||
xmlCtxtGetVersion (xmlParserCtxtPtr ctxt);
|
xmlCtxtGetVersion (xmlParserCtxtPtr ctxt);
|
||||||
XMLPUBFUN const xmlChar *
|
XMLPUBFUN const xmlChar *
|
||||||
@ -1416,6 +1427,10 @@ XMLPUBFUN void
|
|||||||
xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
|
xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
|
||||||
xmlStructuredErrorFunc handler,
|
xmlStructuredErrorFunc handler,
|
||||||
void *data);
|
void *data);
|
||||||
|
XMLPUBFUN void
|
||||||
|
xmlCtxtSetResourceLoader(xmlParserCtxtPtr ctxt,
|
||||||
|
xmlResourceLoader loader,
|
||||||
|
void *vctxt);
|
||||||
XMLPUBFUN void
|
XMLPUBFUN void
|
||||||
xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt,
|
xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt,
|
||||||
unsigned maxAmpl);
|
unsigned maxAmpl);
|
||||||
|
@ -2873,6 +2873,98 @@ xmlNewSAXParserCtxt(const xmlSAXHandler *sax, void *userData)
|
|||||||
return(ctxt);
|
return(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtGetPrivate:
|
||||||
|
* ctxt: parser context
|
||||||
|
*
|
||||||
|
* Returns the private application data.
|
||||||
|
*/
|
||||||
|
void *
|
||||||
|
xmlCtxtGetPrivate(xmlParserCtxtPtr ctxt) {
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
|
return(ctxt->_private);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtSetPrivate:
|
||||||
|
* ctxt: parser context
|
||||||
|
* priv: private application data
|
||||||
|
*
|
||||||
|
* Set the private application data.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlCtxtSetPrivate(xmlParserCtxtPtr ctxt, void *priv) {
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ctxt->_private = priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtGetCatalogs:
|
||||||
|
* ctxt: parser context
|
||||||
|
*
|
||||||
|
* Returns the local catalogs.
|
||||||
|
*/
|
||||||
|
void *
|
||||||
|
xmlCtxtGetCatalogs(xmlParserCtxtPtr ctxt) {
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
|
return(ctxt->catalogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtSetCatalogs:
|
||||||
|
* ctxt: parser context
|
||||||
|
* catalogs: catalogs pointer
|
||||||
|
*
|
||||||
|
* Set the local catalogs.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlCtxtSetCatalogs(xmlParserCtxtPtr ctxt, void *catalogs) {
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ctxt->catalogs = catalogs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtGetDict:
|
||||||
|
* ctxt: parser context
|
||||||
|
*
|
||||||
|
* Returns the dictionary.
|
||||||
|
*/
|
||||||
|
xmlDictPtr
|
||||||
|
xmlCtxtGetDict(xmlParserCtxtPtr ctxt) {
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
|
return(ctxt->dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtSetDict:
|
||||||
|
* ctxt: parser context
|
||||||
|
* dict: dictionary
|
||||||
|
*
|
||||||
|
* Set the dictionary. This should only be done immediately after
|
||||||
|
* creating a parser context.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlCtxtSetDict(xmlParserCtxtPtr ctxt, xmlDictPtr dict) {
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ctxt->dict != NULL)
|
||||||
|
xmlDictFree(ctxt->dict);
|
||||||
|
|
||||||
|
xmlDictReference(dict);
|
||||||
|
ctxt->dict = dict;
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Handling of node information *
|
* Handling of node information *
|
||||||
|
@ -2867,7 +2867,8 @@ libxml_addLocalCatalog(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
||||||
|
|
||||||
if (URL != NULL) {
|
if (URL != NULL) {
|
||||||
ctxt->catalogs = xmlCatalogAddLocal(ctxt->catalogs, URL);
|
void *catalogs = xmlCtxtGetCatalogs(ctxt);
|
||||||
|
xmlCtxtSetCatalogs(ctxt, xmlCatalogAddLocal(catalogs, URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
Reference in New Issue
Block a user