mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-12-24 21:33:51 +03:00
parser: Add getters for XML declaration to parser context
Access to struct members will be deprecated.
This commit is contained in:
parent
598ee0d2c6
commit
eca972e682
@ -1406,6 +1406,12 @@ XMLPUBFUN int
|
||||
XMLPUBFUN int
|
||||
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlCtxtGetVersion (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlCtxtGetDeclaredEncoding(xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlCtxtGetStandalone (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc handler,
|
||||
|
28
parser.c
28
parser.c
@ -10404,6 +10404,34 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCtxtGetVersion:
|
||||
* ctxt: parser context
|
||||
*
|
||||
* Returns the version from the XML declaration.
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlCtxtGetVersion(xmlParserCtxtPtr ctxt) {
|
||||
if (ctxt == NULL)
|
||||
return(NULL);
|
||||
|
||||
return(ctxt->version);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCtxtGetStandalone:
|
||||
* ctxt: parser context
|
||||
*
|
||||
* Returns the value from the standalone document declaration.
|
||||
*/
|
||||
int
|
||||
xmlCtxtGetStandalone(xmlParserCtxtPtr ctxt) {
|
||||
if (ctxt == NULL)
|
||||
return(0);
|
||||
|
||||
return(ctxt->standalone);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParseMisc:
|
||||
* @ctxt: an XML parser context
|
||||
|
@ -1520,6 +1520,21 @@ xmlSetDeclaredEncoding(xmlParserCtxtPtr ctxt, xmlChar *encoding) {
|
||||
ctxt->encoding = encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCtxtGetDeclaredEncoding:
|
||||
* ctxt: parser context
|
||||
*
|
||||
* Returns the encoding from the encoding declaration. This can differ
|
||||
* from the actual encoding.
|
||||
*/
|
||||
const xmlChar *
|
||||
xmlCtxtGetDeclaredEncoding(xmlParserCtxtPtr ctxt) {
|
||||
if (ctxt == NULL)
|
||||
return(NULL);
|
||||
|
||||
return(ctxt->encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlGetActualEncoding:
|
||||
* @ctxt: the parser context
|
||||
|
Loading…
Reference in New Issue
Block a user