![]() |
![]() |
![]() |
![]() |
libxml2 Reference Manual |
---|
parser - the core parser module
Interfaces, constants and types related to the XML parser
Author(s): Daniel Veillard
#define XML_DEFAULT_VERSION; #define XML_SAX2_MAGIC; typedef struct _xmlAttrHashBucket xmlAttrHashBucket; typedef enum xmlFeature; typedef enum xmlParserInputFlags; typedef enum xmlParserInputState; typedef enum xmlParserMode; typedef struct _xmlParserNodeInfo xmlParserNodeInfo; typedef xmlParserNodeInfo * xmlParserNodeInfoPtr; typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; typedef xmlParserNodeInfoSeq * xmlParserNodeInfoSeqPtr; typedef struct _xmlParserNsData xmlParserNsData; typedef enum xmlParserOption; typedef enum xmlParserStatus; typedef enum xmlResourceType; typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; typedef xmlSAXHandlerV1 * xmlSAXHandlerV1Ptr; typedef struct _xmlStartTag xmlStartTag; typedef void attributeDeclSAXFunc (void * ctx,
const xmlChar * elem,
const xmlChar * fullname,
int type,
int def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree); typedef void attributeSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * value); typedef void cdataBlockSAXFunc (void * ctx,
const xmlChar * value,
int len); typedef void charactersSAXFunc (void * ctx,
const xmlChar * ch,
int len); typedef void commentSAXFunc (void * ctx,
const xmlChar * value); typedef void elementDeclSAXFunc (void * ctx,
const xmlChar * name,
int type,
xmlElementContentPtr content); typedef void endDocumentSAXFunc (void * ctx); typedef void endElementNsSAX2Func (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI); typedef void endElementSAXFunc (void * ctx,
const xmlChar * name); typedef void entityDeclSAXFunc (void * ctx,
const xmlChar * name,
int type,
const xmlChar * publicId,
const xmlChar * systemId,
xmlChar * content); typedef void errorSAXFunc (void * ctx,
const char * msg,
... ...); typedef void externalSubsetSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID); typedef void fatalErrorSAXFunc (void * ctx,
const char * msg,
... ...); typedef xmlEntityPtr getEntitySAXFunc (void * ctx,
const xmlChar * name); typedef xmlEntityPtr getParameterEntitySAXFunc (void * ctx,
const xmlChar * name); typedef int hasExternalSubsetSAXFunc (void * ctx); typedef int hasInternalSubsetSAXFunc (void * ctx); typedef void ignorableWhitespaceSAXFunc (void * ctx,
const xmlChar * ch,
int len); typedef void internalSubsetSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID); typedef int isStandaloneSAXFunc (void * ctx); typedef void notationDeclSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId); typedef void processingInstructionSAXFunc (void * ctx,
const xmlChar * target,
const xmlChar * data); typedef void referenceSAXFunc (void * ctx,
const xmlChar * name); typedef xmlParserInputPtr resolveEntitySAXFunc (void * ctx,
const xmlChar * publicId,
const xmlChar * systemId); typedef void setDocumentLocatorSAXFunc (void * ctx,
xmlSAXLocatorPtr loc); typedef void startDocumentSAXFunc (void * ctx); typedef void startElementNsSAX2Func (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI,
int nb_namespaces,
const xmlChar ** namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar ** attributes); typedef void startElementSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar ** atts); typedef void unparsedEntityDeclSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId,
const xmlChar * notationName); typedef void warningSAXFunc (void * ctx,
const char * msg,
... ...); long xmlByteConsumed (xmlParserCtxtPtr ctxt); void xmlCleanupGlobals (void); void xmlCleanupParser (void); void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); void xmlClearParserCtxt (xmlParserCtxtPtr ctxt); xmlParserCtxtPtr xmlCreateDocParserCtxt (const xmlChar * str); xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
void * user_data,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
xmlCharEncoding enc); xmlParserCtxtPtr xmlCreatePushParserCtxt (xmlSAXHandlerPtr sax,
void * user_data,
const char * chunk,
int size,
const char * filename); void * xmlCtxtGetCatalogs (xmlParserCtxtPtr ctxt); const xmlChar * xmlCtxtGetDeclaredEncoding (xmlParserCtxtPtr ctxt); xmlDictPtr xmlCtxtGetDict (xmlParserCtxtPtr ctxt); xmlDocPtr xmlCtxtGetDocument (xmlParserCtxtPtr ctxt); int xmlCtxtGetOptions (xmlParserCtxtPtr ctxt); void * xmlCtxtGetPrivate (xmlParserCtxtPtr ctxt); xmlSAXHandler * xmlCtxtGetSaxHandler (xmlParserCtxtPtr ctxt); int xmlCtxtGetStandalone (xmlParserCtxtPtr ctxt); xmlParserStatus xmlCtxtGetStatus (xmlParserCtxt * ctxt); xmlValidCtxtPtr xmlCtxtGetValidCtxt (xmlParserCtxtPtr ctxt); const xmlChar * xmlCtxtGetVersion (xmlParserCtxtPtr ctxt); int xmlCtxtIsHtml (xmlParserCtxtPtr ctxt); int xmlCtxtIsStopped (xmlParserCtxtPtr ctxt); xmlNodePtr xmlCtxtParseContent (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlNodePtr node,
int hasTextDecl); xmlDocPtr xmlCtxtParseDocument (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input); xmlDtdPtr xmlCtxtParseDtd (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
const xmlChar * publicId,
const xmlChar * systemId); xmlDocPtr xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar * str,
const char * URL,
const char * encoding,
int options); xmlDocPtr xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char * URL,
const char * encoding,
int options); xmlDocPtr xmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char * filename,
const char * encoding,
int options); xmlDocPtr xmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options); xmlDocPtr xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char * buffer,
int size,
const char * URL,
const char * encoding,
int options); void xmlCtxtReset (xmlParserCtxtPtr ctxt); int xmlCtxtResetPush (xmlParserCtxtPtr ctxt,
const char * chunk,
int size,
const char * filename,
const char * encoding); void xmlCtxtSetCatalogs (xmlParserCtxtPtr ctxt,
void * catalogs); void xmlCtxtSetCharEncConvImpl (xmlParserCtxtPtr ctxt,
xmlCharEncConvImpl impl,
void * vctxt); void xmlCtxtSetDict (xmlParserCtxtPtr ctxt,
xmlDictPtr dict); void xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
xmlStructuredErrorFunc handler,
void * data); void xmlCtxtSetMaxAmplification (xmlParserCtxtPtr ctxt,
unsigned maxAmpl); int xmlCtxtSetOptions (xmlParserCtxtPtr ctxt,
int options); void xmlCtxtSetPrivate (xmlParserCtxtPtr ctxt,
void * priv); void xmlCtxtSetResourceLoader (xmlParserCtxtPtr ctxt,
xmlResourceLoader loader,
void * vctxt); int xmlCtxtSetSaxHandler (xmlParserCtxtPtr ctxt,
const xmlSAXHandler * sax); int xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
int options); int xmlCtxtValidateDocument (xmlParserCtxtPtr ctxt,
xmlDocPtr doc); int xmlCtxtValidateDtd (xmlParserCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd); typedef xmlParserInputPtr xmlExternalEntityLoader (const char * URL,
const char * ID,
xmlParserCtxtPtr context); void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); xmlExternalEntityLoader xmlGetExternalEntityLoader (void); int xmlHasFeature (xmlFeature feature); xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
xmlParserInputBufferPtr input,
xmlCharEncoding enc); void xmlInitGlobals (void); void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); void xmlInitParser (void); int xmlInitParserCtxt (xmlParserCtxtPtr ctxt); xmlParserErrors xmlInputSetEncodingHandler (xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler); int xmlKeepBlanksDefault (int val); int xmlLineNumbersDefault (int val); xmlParserInputPtr xmlLoadExternalEntity (const char * URL,
const char * ID,
xmlParserCtxtPtr ctxt); xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
xmlParserInputBufferPtr buf,
xmlCharEncoding enc); xmlParserInputPtr xmlNewInputFromFd (const char * url,
int fd,
xmlParserInputFlags flags); xmlParserInputPtr xmlNewInputFromIO (const char * url,
xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose,
void * ioCtxt,
xmlParserInputFlags flags); xmlParserInputPtr xmlNewInputFromMemory (const char * url,
const void * mem,
size_t size,
xmlParserInputFlags flags); xmlParserInputPtr xmlNewInputFromString (const char * url,
const char * str,
xmlParserInputFlags flags); xmlParserErrors xmlNewInputFromUrl (const char * filename,
xmlParserInputFlags flags,
xmlParserInputPtr * out); xmlParserCtxtPtr xmlNewParserCtxt (void); xmlParserCtxtPtr xmlNewSAXParserCtxt (const xmlSAXHandler * sax,
void * userData); int xmlParseBalancedChunkMemory (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * string,
xmlNodePtr * lst); int xmlParseBalancedChunkMemoryRecover (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * string,
xmlNodePtr * listOut,
int recover); int xmlParseChunk (xmlParserCtxtPtr ctxt,
const char * chunk,
int size,
int terminate); int xmlParseCtxtExternalEntity (xmlParserCtxtPtr ctxt,
const xmlChar * URL,
const xmlChar * ID,
xmlNodePtr * listOut); xmlDtdPtr xmlParseDTD (const xmlChar * ExternalID,
const xmlChar * SystemID); xmlDocPtr xmlParseDoc (const xmlChar * cur); int xmlParseDocument (xmlParserCtxtPtr ctxt); xmlDocPtr xmlParseEntity (const char * filename); int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); int xmlParseExternalEntity (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * URL,
const xmlChar * ID,
xmlNodePtr * list); xmlDocPtr xmlParseFile (const char * filename); xmlParserErrors xmlParseInNodeContext (xmlNodePtr node,
const char * data,
int datalen,
int options,
xmlNodePtr * listOut); xmlDocPtr xmlParseMemory (const char * buffer,
int size); void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
xmlParserNodeInfoPtr info); const xmlParserNodeInfo * xmlParserFindNodeInfo (xmlParserCtxtPtr ctx,
xmlNodePtr node); unsigned long xmlParserFindNodeInfoIndex (xmlParserNodeInfoSeqPtr seq,
xmlNodePtr node); typedef void xmlParserInputDeallocate (xmlChar * str); int xmlParserInputGrow (xmlParserInputPtr in,
int len); int xmlParserInputRead (xmlParserInputPtr in,
int len); int xmlPedanticParserDefault (int val); xmlDocPtr xmlReadDoc (const xmlChar * cur,
const char * URL,
const char * encoding,
int options); xmlDocPtr xmlReadFd (int fd,
const char * URL,
const char * encoding,
int options); xmlDocPtr xmlReadFile (const char * filename,
const char * encoding,
int options); xmlDocPtr xmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options); xmlDocPtr xmlReadMemory (const char * buffer,
int size,
const char * url,
const char * encoding,
int options); xmlDocPtr xmlRecoverDoc (const xmlChar * cur); xmlDocPtr xmlRecoverFile (const char * filename); xmlDocPtr xmlRecoverMemory (const char * buffer,
int size); typedef xmlParserErrors xmlResourceLoader (void * ctxt,
const char * url,
const char * publicId,
xmlResourceType type,
xmlParserInputFlags flags,
xmlParserInputPtr * out); xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
const xmlChar * ExternalID,
const xmlChar * SystemID); xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
const xmlChar * cur,
int recovery); xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char * filename); xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char * filename,
int recovery); xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
const char * filename,
int recovery,
void * data); xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
const char * buffer,
int size,
int recovery); xmlDocPtr xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
const char * buffer,
int size,
int recovery,
void * data); int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
void * user_data,
const char * filename); int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
void * user_data,
const char * buffer,
int size); void xmlSetExternalEntityLoader (xmlExternalEntityLoader f); void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
const xmlChar * buffer,
const char * filename); void xmlStopParser (xmlParserCtxtPtr ctxt); int xmlSubstituteEntitiesDefault (int val); int xmlThrDefDoValidityCheckingDefaultValue (int v); int xmlThrDefGetWarningsDefaultValue (int v); int xmlThrDefKeepBlanksDefaultValue (int v); int xmlThrDefLineNumbersDefaultValue (int v); int xmlThrDefLoadExtDtdDefaultValue (int v); int xmlThrDefPedanticParserDefaultValue (int v); int xmlThrDefSubstituteEntitiesDefaultValue (int v);
#define XML_SAX2_MAGIC;
Special constant found in SAX2 blocks initialized fields
struct _xmlAttrHashBucket { The content of this structure is not made public by the API. } xmlAttrHashBucket;
enum xmlFeature { XML_WITH_THREAD = 1 XML_WITH_TREE = 2 XML_WITH_OUTPUT = 3 XML_WITH_PUSH = 4 XML_WITH_READER = 5 XML_WITH_PATTERN = 6 XML_WITH_WRITER = 7 XML_WITH_SAX1 = 8 XML_WITH_FTP = 9 XML_WITH_HTTP = 10 XML_WITH_VALID = 11 XML_WITH_HTML = 12 XML_WITH_LEGACY = 13 XML_WITH_C14N = 14 XML_WITH_CATALOG = 15 XML_WITH_XPATH = 16 XML_WITH_XPTR = 17 XML_WITH_XINCLUDE = 18 XML_WITH_ICONV = 19 XML_WITH_ISO8859X = 20 XML_WITH_UNICODE = 21 XML_WITH_REGEXP = 22 XML_WITH_AUTOMATA = 23 XML_WITH_EXPR = 24 XML_WITH_SCHEMAS = 25 XML_WITH_SCHEMATRON = 26 XML_WITH_MODULES = 27 XML_WITH_DEBUG = 28 XML_WITH_DEBUG_MEM = 29 XML_WITH_DEBUG_RUN = 30 /* unused */ XML_WITH_ZLIB = 31 XML_WITH_ICU = 32 XML_WITH_LZMA = 33 XML_WITH_RELAXNG = 34 /* since 2.14.0 */ XML_WITH_NONE = 99999 /* just to be sure of allocation size */ };
enum xmlParserInputFlags { XML_INPUT_BUF_STATIC = 2 XML_INPUT_BUF_ZERO_TERMINATED = 4 XML_INPUT_UNZIP = 8 XML_INPUT_NETWORK = 16 };
enum xmlParserInputState { XML_PARSER_EOF = -1 /* nothing is to be parsed */ XML_PARSER_START = 0 /* nothing has been parsed */ XML_PARSER_MISC = 1 /* Misc* before int subset */ XML_PARSER_PI = 2 /* Within a processing instruction */ XML_PARSER_DTD = 3 /* within some DTD content */ XML_PARSER_PROLOG = 4 /* Misc* after internal subset */ XML_PARSER_COMMENT = 5 /* within a comment */ XML_PARSER_START_TAG = 6 /* within a start tag */ XML_PARSER_CONTENT = 7 /* within the content */ XML_PARSER_CDATA_SECTION = 8 /* within a CDATA section */ XML_PARSER_END_TAG = 9 /* within a closing tag */ XML_PARSER_ENTITY_DECL = 10 /* within an entity declaration */ XML_PARSER_ENTITY_VALUE = 11 /* within an entity value in a decl */ XML_PARSER_ATTRIBUTE_VALUE = 12 /* within an attribute value */ XML_PARSER_SYSTEM_LITERAL = 13 /* within a SYSTEM value */ XML_PARSER_EPILOG = 14 /* the Misc* after the last end tag */ XML_PARSER_IGNORE = 15 /* within an IGNORED section */ XML_PARSER_PUBLIC_LITERAL = 16 /* within a PUBLIC value */ XML_PARSER_XML_DECL = 17 /* before XML decl (but after BOM) */ };
enum xmlParserMode { XML_PARSE_UNKNOWN = 0 XML_PARSE_DOM = 1 XML_PARSE_SAX = 2 XML_PARSE_PUSH_DOM = 3 XML_PARSE_PUSH_SAX = 4 XML_PARSE_READER = 5 };
struct _xmlParserNodeInfo { const struct _xmlNode * node unsigned long begin_pos unsigned long begin_line unsigned long end_pos unsigned long end_line } xmlParserNodeInfo;
xmlParserNodeInfo * xmlParserNodeInfoPtr;
struct _xmlParserNodeInfoSeq { unsigned long maximum unsigned long length xmlParserNodeInfo * buffer } xmlParserNodeInfoSeq;
xmlParserNodeInfoSeq * xmlParserNodeInfoSeqPtr;
struct _xmlParserNsData { The content of this structure is not made public by the API. } xmlParserNsData;
enum xmlParserOption { XML_PARSE_RECOVER = 1 /* recover on errors */ XML_PARSE_NOENT = 2 /* substitute entities */ XML_PARSE_DTDLOAD = 4 /* load the external subset */ XML_PARSE_DTDATTR = 8 /* default DTD attributes */ XML_PARSE_DTDVALID = 16 /* validate with the DTD */ XML_PARSE_NOERROR = 32 /* suppress error reports */ XML_PARSE_NOWARNING = 64 /* suppress warning reports */ XML_PARSE_PEDANTIC = 128 /* pedantic error reporting */ XML_PARSE_NOBLANKS = 256 /* remove blank nodes */ XML_PARSE_SAX1 = 512 /* use the SAX1 interface internally */ XML_PARSE_XINCLUDE = 1024 /* Implement XInclude substitution */ XML_PARSE_NONET = 2048 /* Forbid network access */ XML_PARSE_NODICT = 4096 /* Do not reuse the context dictionary */ XML_PARSE_NSCLEAN = 8192 /* remove redundant namespaces declarations */ XML_PARSE_NOCDATA = 16384 /* merge CDATA as text nodes */ XML_PARSE_NOXINCNODE = 32768 /* do not generate XINCLUDE START/END nodes */ XML_PARSE_COMPACT = 65536 /* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ XML_PARSE_OLD10 = 131072 /* parse using XML-1.0 before update 5 */ XML_PARSE_NOBASEFIX = 262144 /* do not fixup XINCLUDE xml:base uris */ XML_PARSE_HUGE = 524288 /* relax any hardcoded limit from the parser */ XML_PARSE_OLDSAX = 1048576 /* parse using SAX2 interface before 2.7.0 */ XML_PARSE_IGNORE_ENC = 2097152 /* ignore internal document encoding hint */ XML_PARSE_BIG_LINES = 4194304 /* Store big lines numbers in text PSVI field since 2.13.0 */ XML_PARSE_NO_XXE = 8388608 /* disable loading of external content since 2.14.0 */ XML_PARSE_UNZIP = 16777216 /* allow compressed content */ XML_PARSE_NO_SYS_CATALOG = 33554432 /* disable global system catalog */ XML_PARSE_CATALOG_PI = 67108864 /* allow catalog PIs */ };
enum xmlParserStatus { XML_STATUS_NOT_WELL_FORMED = 1 XML_STATUS_NOT_NS_WELL_FORMED = 2 XML_STATUS_DTD_VALIDATION_FAILED = 4 XML_STATUS_CATASTROPHIC_ERROR = 8 };
enum xmlResourceType { XML_RESOURCE_UNKNOWN = 0 XML_RESOURCE_MAIN_DOCUMENT = 1 XML_RESOURCE_DTD = 2 XML_RESOURCE_GENERAL_ENTITY = 3 XML_RESOURCE_PARAMETER_ENTITY = 4 XML_RESOURCE_XINCLUDE = 5 XML_RESOURCE_XINCLUDE_TEXT = 6 };
struct _xmlSAXHandlerV1 { internalSubsetSAXFunc internalSubset isStandaloneSAXFunc isStandalone hasInternalSubsetSAXFunc hasInternalSubset hasExternalSubsetSAXFunc hasExternalSubset resolveEntitySAXFunc resolveEntity getEntitySAXFunc getEntity entityDeclSAXFunc entityDecl notationDeclSAXFunc notationDecl attributeDeclSAXFunc attributeDecl elementDeclSAXFunc elementDecl unparsedEntityDeclSAXFunc unparsedEntityDecl setDocumentLocatorSAXFunc setDocumentLocator startDocumentSAXFunc startDocument endDocumentSAXFunc endDocument startElementSAXFunc startElement endElementSAXFunc endElement referenceSAXFunc reference charactersSAXFunc characters ignorableWhitespaceSAXFunc ignorableWhitespace processingInstructionSAXFunc processingInstruction commentSAXFunc comment warningSAXFunc warning errorSAXFunc error fatalErrorSAXFunc fatalError getParameterEntitySAXFunc getParameterEntity cdataBlockSAXFunc cdataBlock externalSubsetSAXFunc externalSubset unsigned int initialized } xmlSAXHandlerV1;
xmlSAXHandlerV1 * xmlSAXHandlerV1Ptr;
struct _xmlStartTag { The content of this structure is not made public by the API. } xmlStartTag;
void attributeDeclSAXFunc (void * ctx,
const xmlChar * elem,
const xmlChar * fullname,
int type,
int def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree)
An attribute definition has been parsed.
ctx: | the user data (XML parser context) |
elem: | the name of the element |
fullname: | the attribute name |
type: | the attribute type |
def: | the type of default value |
defaultValue: | the attribute default value |
tree: | the tree of enumerated value set |
void attributeSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * value)
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.
ctx: | the user data (XML parser context) |
name: | The attribute name, including namespace prefix |
value: | The attribute value |
void cdataBlockSAXFunc (void * ctx,
const xmlChar * value,
int len)
Called when a pcdata block has been parsed.
ctx: | the user data (XML parser context) |
value: | The pcdata content |
len: | the block length |
void charactersSAXFunc (void * ctx,
const xmlChar * ch,
int len)
Receiving some chars from the parser.
void commentSAXFunc (void * ctx,
const xmlChar * value)
A comment has been parsed.
ctx: | the user data (XML parser context) |
value: | the comment content |
void elementDeclSAXFunc (void * ctx,
const xmlChar * name,
int type,
xmlElementContentPtr content)
An element definition has been parsed.
ctx: | the user data (XML parser context) |
name: | the element name |
type: | the element type |
content: | the element value tree |
void endDocumentSAXFunc (void * ctx)
Called when the document end has been detected.
ctx: | the user data (XML parser context) |
void endElementNsSAX2Func (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI)
SAX2 callback when an element end has been detected by the parser. It provides the namespace information for the element.
ctx: | the user data (XML parser context) |
localname: | the local name of the element |
prefix: | the element namespace prefix if available |
URI: | the element namespace name if available |
void endElementSAXFunc (void * ctx,
const xmlChar * name)
Called when the end of an element has been detected.
ctx: | the user data (XML parser context) |
name: | The element name |
void entityDeclSAXFunc (void * ctx,
const xmlChar * name,
int type,
const xmlChar * publicId,
const xmlChar * systemId,
xmlChar * content)
An entity definition has been parsed.
ctx: | the user data (XML parser context) |
name: | the entity name |
type: | the entity type |
publicId: | The public ID of the entity |
systemId: | The system ID of the entity |
content: | the entity value (without processing). |
void errorSAXFunc (void * ctx,
const char * msg,
... ...)
Display and format an error messages, callback.
ctx: | an XML parser context |
msg: | the message to display/transmit |
...: | extra parameters for the message display |
void externalSubsetSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID)
Callback on external subset declaration.
ctx: | the user data (XML parser context) |
name: | the root element name |
ExternalID: | the external ID |
SystemID: | the SYSTEM ID (e.g. filename or URL) |
void fatalErrorSAXFunc (void * ctx,
const char * msg,
... ...)
Display and format fatal error messages, callback. Note: so far fatalError() SAX callbacks are not used, error() get all the callbacks for errors.
ctx: | an XML parser context |
msg: | the message to display/transmit |
...: | extra parameters for the message display |
xmlEntityPtr getEntitySAXFunc (void * ctx,
const xmlChar * name)
Get an entity by name.
ctx: | the user data (XML parser context) |
name: | The entity name |
Returns: | the xmlEntityPtr if found. |
xmlEntityPtr getParameterEntitySAXFunc (void * ctx,
const xmlChar * name)
Get a parameter entity by name.
ctx: | the user data (XML parser context) |
name: | The entity name |
Returns: | the xmlEntityPtr if found. |
int hasExternalSubsetSAXFunc (void * ctx)
Does this document has an external subset?
ctx: | the user data (XML parser context) |
Returns: | 1 if true |
int hasInternalSubsetSAXFunc (void * ctx)
Does this document has an internal subset.
ctx: | the user data (XML parser context) |
Returns: | 1 if true |
void ignorableWhitespaceSAXFunc (void * ctx,
const xmlChar * ch,
int len)
Receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use characters.
void internalSubsetSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * ExternalID,
const xmlChar * SystemID)
Callback on internal subset declaration.
ctx: | the user data (XML parser context) |
name: | the root element name |
ExternalID: | the external ID |
SystemID: | the SYSTEM ID (e.g. filename or URL) |
int isStandaloneSAXFunc (void * ctx)
Is this document tagged standalone?
ctx: | the user data (XML parser context) |
Returns: | 1 if true |
void notationDeclSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId)
What to do when a notation declaration has been parsed.
ctx: | the user data (XML parser context) |
name: | The name of the notation |
publicId: | The public ID of the entity |
systemId: | The system ID of the entity |
void processingInstructionSAXFunc (void * ctx,
const xmlChar * target,
const xmlChar * data)
A processing instruction has been parsed.
ctx: | the user data (XML parser context) |
target: | the target name |
data: | the PI data's |
void referenceSAXFunc (void * ctx,
const xmlChar * name)
Called when an entity reference is detected.
ctx: | the user data (XML parser context) |
name: | The entity name |
xmlParserInputPtr resolveEntitySAXFunc (void * ctx,
const xmlChar * publicId,
const xmlChar * systemId)
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
ctx: | the user data (XML parser context) |
publicId: | The public ID of the entity |
systemId: | The system ID of the entity |
Returns: | the xmlParserInputPtr if inlined or NULL for DOM behaviour. |
void setDocumentLocatorSAXFunc (void * ctx,
xmlSAXLocatorPtr loc)
Receive the document locator at startup, actually xmlDefaultSAXLocator. Everything is available on the context, so this is useless in our case.
ctx: | the user data (XML parser context) |
loc: | A SAX Locator |
void startDocumentSAXFunc (void * ctx)
Called when the document start being processed.
ctx: | the user data (XML parser context) |
void startElementNsSAX2Func (void * ctx,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI,
int nb_namespaces,
const xmlChar ** namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar ** attributes)
SAX2 callback when an element start has been detected by the parser. It provides the namespace information for the element, as well as the new namespace declarations on the element.
ctx: | the user data (XML parser context) |
localname: | the local name of the element |
prefix: | the element namespace prefix if available |
URI: | the element namespace name if available |
nb_namespaces: | number of namespace definitions on that node |
namespaces: | pointer to the array of prefix/URI pairs namespace definitions |
nb_attributes: | the number of attributes on that node |
nb_defaulted: | the number of defaulted attributes. The defaulted ones are at the end of the array |
attributes: | pointer to the array of (localname/prefix/URI/value/end) attribute values. |
void startElementSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar ** atts)
Called when an opening tag has been processed.
ctx: | the user data (XML parser context) |
name: | The element name, including namespace prefix |
atts: | An array of name/value attributes pairs, NULL terminated |
void unparsedEntityDeclSAXFunc (void * ctx,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId,
const xmlChar * notationName)
What to do when an unparsed entity declaration is parsed.
ctx: | the user data (XML parser context) |
name: | The name of the entity |
publicId: | The public ID of the entity |
systemId: | The system ID of the entity |
notationName: | the name of the notation |
void warningSAXFunc (void * ctx,
const char * msg,
... ...)
Display and format a warning messages, callback.
ctx: | an XML parser context |
msg: | the message to display/transmit |
...: | extra parameters for the message display |
xmlParserInputPtr xmlExternalEntityLoader (const char * URL,
const char * ID,
xmlParserCtxtPtr context)
External entity loaders types.
URL: | The System ID of the resource requested |
ID: | The Public ID of the resource requested |
context: | the XML parser context |
Returns: | the entity input parser. |
void xmlParserInputDeallocate (xmlChar * str)
Callback for freeing some parser input allocations.
str: | the string to deallocate |
xmlParserErrors xmlResourceLoader (void * ctxt,
const char * url,
const char * publicId,
xmlResourceType type,
xmlParserInputFlags flags,
xmlParserInputPtr * out)
Callback for custom resource loaders. @flags can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK. On success, @out should be set to a new parser input object and XML_ERR_OK should be returned.
ctxt: | parser context |
url: | URL to load |
publicId: | publid ID from DTD (optional) |
type: | resource type |
flags: | flags |
out: | result pointer |
Returns: | an xmlParserErrors code. |
const char * const xmlParserVersion;
Constant string describing the internal version of the library
long xmlByteConsumed (xmlParserCtxtPtr ctxt)
DEPRECATED: Don't use. This function provides the current index of the parser relative to the start of the current entity. This function is computed in bytes from the beginning starting at zero and finishing at the size in byte of the file if parsing a file. The function is of constant cost if the input is UTF-8 but can be costly if run on non-UTF-8 input.
ctxt: | an XML parser context |
Returns: | the index in bytes from the beginning of the entity or -1 in case the index could not be computed. |
void xmlCleanupGlobals (void)
DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don't have call cleanup functions at all.
void xmlCleanupParser (void)
This function is named somewhat misleadingly. It does not clean up parser state but global memory allocated by the library itself. Since 2.9.11, cleanup is performed automatically if a shared or dynamic libxml2 library is unloaded. This function should only be used to avoid false positives from memory leak checkers in static builds. WARNING: xmlCleanupParser assumes that all other threads that called libxml2 functions have terminated. No library calls must be made after calling this function. In general, THIS FUNCTION SHOULD ONLY BE CALLED RIGHT BEFORE THE WHOLE PROCESS EXITS.
void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq)
DEPRECATED: Don't use. -- Clear (release memory and reinitialize) node info sequence
seq: | a node info sequence pointer |
void xmlClearParserCtxt (xmlParserCtxtPtr ctxt)
Clear (release owned resources) and reinitialize a parser context
ctxt: | an XML parser context |
xmlParserCtxtPtr xmlCreateDocParserCtxt (const xmlChar * str)
Creates a parser context for an XML in-memory document.
str: | a pointer to an array of xmlChar |
Returns: | the new parser context or NULL |
xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
void * user_data,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
xmlCharEncoding enc)
Create a parser context for using the XML parser with an existing I/O stream
sax: | a SAX handler (optional) |
user_data: | user data for SAX callbacks (optional) |
ioread: | an I/O read function |
ioclose: | an I/O close function (optional) |
ioctx: | an I/O handler |
enc: | the charset encoding if known (deprecated) |
Returns: | the new parser context or NULL |
xmlParserCtxtPtr xmlCreatePushParserCtxt (xmlSAXHandlerPtr sax,
void * user_data,
const char * chunk,
int size,
const char * filename)
Create a parser context for using the XML parser in push mode. See xmlParseChunk. Passing an initial chunk is useless and deprecated. The push parser doesn't support recovery mode or the XML_PARSE_NOBLANKS option. @filename is used as base URI to fetch external entities and for error reports.
sax: | a SAX handler (optional) |
user_data: | user data for SAX callbacks (optional) |
chunk: | initial chunk (optional, deprecated) |
size: | size of initial chunk in bytes |
filename: | file name or URI (optional) |
Returns: | the new parser context or NULL if a memory allocation failed. |
void * xmlCtxtGetCatalogs (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the local catalogs. |
const xmlChar * xmlCtxtGetDeclaredEncoding (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the encoding from the encoding declaration. This can differ from the actual encoding. |
xmlDictPtr xmlCtxtGetDict (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the dictionary. |
xmlDocPtr xmlCtxtGetDocument (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the parsed document or NULL if a fatal error occurred when parsing. The document must be freed by the caller. Resets the context's document to NULL. |
int xmlCtxtGetOptions (xmlParserCtxtPtr ctxt)
Get the current options of the parser context. Available since 2.14.0.
ctxt: | an XML parser context |
Returns: | the current options set in the parser context, or -1 if ctxt is NULL. |
void * xmlCtxtGetPrivate (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the private application data. |
xmlSAXHandler * xmlCtxtGetSaxHandler (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the SAX handler struct. This is not a copy and must not be freed. Handlers can be updated. |
int xmlCtxtGetStandalone (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the value from the standalone document declaration. |
xmlParserStatus xmlCtxtGetStatus (xmlParserCtxt * ctxt)
Get well-formedness and validation status after parsing. Also reports catastrophic errors which are not related to parsing like out-of-memory, I/O or other errors. Available since 2.14.0.
ctxt: | an XML parser context |
Returns: | a bitmask of XML_STATUS_* flags ORed together. |
xmlValidCtxtPtr xmlCtxtGetValidCtxt (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the validation context. |
const xmlChar * xmlCtxtGetVersion (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | the version from the XML declaration. |
int xmlCtxtIsHtml (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | 1 if this is a HTML parser context, 0 otherwise. |
int xmlCtxtIsStopped (xmlParserCtxtPtr ctxt)
Available since 2.14.0.
ctxt: | parser context |
Returns: | 1 if the parser is stopped, 0 otherwise. |
xmlNodePtr xmlCtxtParseContent (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlNodePtr node,
int hasTextDecl)
Parse a well-balanced chunk of XML matching the 'content' production. Namespaces in scope of @node and entities of @node's document are recognized. When validating, the DTD of @node's document is used. Always consumes @input even in error case. Available since 2.14.0.
ctxt: | parser context |
input: | parser input |
node: | target node or document |
hasTextDecl: | whether to parse text declaration |
Returns: | a node list or NULL in case of error. |
xmlDocPtr xmlCtxtParseDocument (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input)
Parse an XML document and return the resulting document tree. Takes ownership of the input object. Available since 2.13.0.
ctxt: | an XML parser context |
input: | parser input |
Returns: | the resulting document tree or NULL |
xmlDtdPtr xmlCtxtParseDtd (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
const xmlChar * publicId,
const xmlChar * systemId)
Parse a DTD. Option XML_PARSE_DTDLOAD should be enabled in the parser context to make external entities work. Availabe since 2.14.0.
ctxt: | a parser context |
input: | a parser input |
publicId: | public ID of the DTD (optional) |
systemId: | system ID of the DTD (optional) |
Returns: | the resulting xmlDtdPtr or NULL in case of error. @input will be freed by the function in any case. |
xmlDocPtr xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar * str,
const char * URL,
const char * encoding,
int options)
Parse an XML in-memory document and build a tree. @URL is used as base to resolve external entities and for error reporting. See xmlCtxtUseOptions for details.
ctxt: | an XML parser context |
str: | a pointer to a zero terminated string |
URL: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char * URL,
const char * encoding,
int options)
Parse an XML document from a file descriptor and build a tree. NOTE that the file descriptor will not be closed when the context is freed or reset. @URL is used as base to resolve external entities and for error reporting. See xmlCtxtUseOptions for details.
ctxt: | an XML parser context |
fd: | an open file descriptor |
URL: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char * filename,
const char * encoding,
int options)
Parse an XML file from the filesystem, the network or a user-defined resource loader. This function always enables the XML_PARSE_UNZIP option for backward compatibility. This feature is potentially insecure and might be removed from later versions.
ctxt: | an XML parser context |
filename: | a file or URL |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options)
parse an XML document from I/O functions and source and build a tree. This reuses the existing @ctxt parser context @URL is used as base to resolve external entities and for error reporting. See xmlCtxtUseOptions for details.
ctxt: | an XML parser context |
ioread: | an I/O read function |
ioclose: | an I/O close function |
ioctx: | an I/O handler |
URL: | the base URL to use for the document |
encoding: | the document encoding, or NULL |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char * buffer,
int size,
const char * URL,
const char * encoding,
int options)
Parse an XML in-memory document and build a tree. The input buffer must not contain a terminating null byte. @URL is used as base to resolve external entities and for error reporting. See xmlCtxtUseOptions for details.
ctxt: | an XML parser context |
buffer: | a pointer to a char array |
size: | the size of the array |
URL: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
void xmlCtxtReset (xmlParserCtxtPtr ctxt)
Reset a parser context
ctxt: | an XML parser context |
int xmlCtxtResetPush (xmlParserCtxtPtr ctxt,
const char * chunk,
int size,
const char * filename,
const char * encoding)
Reset a push parser context
ctxt: | an XML parser context |
chunk: | a pointer to an array of chars |
size: | number of chars in the array |
filename: | an optional file name or URI |
encoding: | the document encoding, or NULL |
Returns: | 0 in case of success and 1 in case of error |
void xmlCtxtSetCatalogs (xmlParserCtxtPtr ctxt,
void * catalogs)
Available since 2.14.0. Set the local catalogs.
ctxt: | parser context |
catalogs: | catalogs pointer |
void xmlCtxtSetCharEncConvImpl (xmlParserCtxtPtr ctxt,
xmlCharEncConvImpl impl,
void * vctxt)
Installs a custom implementation to convert between character encodings. This bypasses legacy feature like global encoding handlers or encoding aliases. Available since 2.14.0.
ctxt: | parser context |
impl: | callback |
vctxt: | user data |
void xmlCtxtSetDict (xmlParserCtxtPtr ctxt,
xmlDictPtr dict)
Available since 2.14.0. Set the dictionary. This should only be done immediately after creating a parser context.
ctxt: | parser context |
dict: | dictionary |
void xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
xmlStructuredErrorFunc handler,
void * data)
Register a callback function that will be called on errors and warnings. If handler is NULL, the error handler will be deactivated. This is the recommended way to collect errors from the parser and takes precedence over all other error reporting mechanisms. These are (in order of precedence): - per-context structured handler (xmlCtxtSetErrorHandler) - per-context structured "serror" SAX handler - global structured handler (xmlSetStructuredErrorFunc) - per-context generic "error" and "warning" SAX handlers - global generic handler (xmlSetGenericErrorFunc) - print to stderr Available since 2.13.0.
ctxt: | an XML parser context |
handler: | error handler |
data: | data for error handler |
void xmlCtxtSetMaxAmplification (xmlParserCtxtPtr ctxt,
unsigned maxAmpl)
To protect against exponential entity expansion ("billion laughs"), the size of serialized output is (roughly) limited to the input size multiplied by this factor. The default value is 5. When working with documents making heavy use of entity expansion, it can be necessary to increase the value. For security reasons, this should only be considered when processing trusted input.
ctxt: | an XML parser context |
maxAmpl: | maximum amplification factor |
int xmlCtxtSetOptions (xmlParserCtxtPtr ctxt,
int options)
Applies the options to the parser context. Unset options are cleared. Available since 2.13.0. With older versions, you can use xmlCtxtUseOptions. XML_PARSE_RECOVER Enable "recovery" mode which allows non-wellformed documents. How this mode behaves exactly is unspecified and may change without further notice. Use of this feature is DISCOURAGED. Not supported by the push parser. XML_PARSE_NOENT Despite the confusing name, this option enables substitution of entities. The resulting tree won't contain any entity reference nodes. This option also enables loading of external entities (both general and parameter entities) which is dangerous. If you process untrusted data, it's recommended to set the XML_PARSE_NO_XXE option to disable loading of external entities. XML_PARSE_DTDLOAD Enables loading of an external DTD and the loading and substitution of external parameter entities. Has no effect if XML_PARSE_NO_XXE is set. XML_PARSE_DTDATTR Adds default attributes from the DTD to the result document. Implies XML_PARSE_DTDLOAD, but loading of external content can be disabled with XML_PARSE_NO_XXE. XML_PARSE_DTDVALID This option enables DTD validation which requires to load external DTDs and external entities (both general and parameter entities) unless XML_PARSE_NO_XXE was set. XML_PARSE_NO_XXE Disables loading of external DTDs or entities. Available since 2.13.0. XML_PARSE_NOERROR Disable error and warning reports to the error handlers. Errors are still accessible with xmlCtxtGetLastError. XML_PARSE_NOWARNING Disable warning reports. XML_PARSE_PEDANTIC Enable some pedantic warnings. XML_PARSE_NOBLANKS Remove some whitespace from the result document. Where to remove whitespace depends on DTD element declarations or a broken heuristic with unfixable bugs. Use of this option is DISCOURAGED. Not supported by the push parser. XML_PARSE_SAX1 Always invoke the deprecated SAX1 startElement and endElement handlers. This option is DEPRECATED. XML_PARSE_NONET Disable network access with the builtin HTTP client. XML_PARSE_NODICT Create a document without interned strings, making all strings separate memory allocations. XML_PARSE_NSCLEAN Remove redundant namespace declarations from the result document. XML_PARSE_NOCDATA Output normal text nodes instead of CDATA nodes. XML_PARSE_COMPACT Store small strings directly in the node struct to save memory. XML_PARSE_OLD10 Use old Name productions from before XML 1.0 Fifth Edition. This options is DEPRECATED. XML_PARSE_HUGE Relax some internal limits. Maximum size of text nodes, tags, comments, processing instructions, CDATA sections, entity values normal: 10M huge: 1B Maximum size of names, system literals, pubid literals normal: 50K huge: 10M Maximum nesting depth of elements normal: 256 huge: 2048 Maximum nesting depth of entities normal: 20 huge: 40 XML_PARSE_OLDSAX Enable an unspecified legacy mode for SAX parsers. This option is DEPRECATED. XML_PARSE_IGNORE_ENC Ignore the encoding in the XML declaration. This option is mostly unneeded these days. The only effect is to enforce UTF-8 decoding of ASCII-like data. XML_PARSE_BIG_LINES Enable reporting of line numbers larger than 65535. XML_PARSE_UNZIP Enable input decompression. Setting this option is discouraged to avoid zip bombs. Available since 2.14.0. XML_PARSE_NO_SYS_CATALOG Disables the global system XML catalog. Available since 2.14.0. XML_PARSE_CATALOG_PI Enable XML catalog processing instructions. Available since 2.14.0.
ctxt: | an XML parser context |
options: | a bitmask of xmlParserOption values |
Returns: | 0 in case of success, the set of unknown or unimplemented options in case of error. |
void xmlCtxtSetPrivate (xmlParserCtxtPtr ctxt,
void * priv)
Available since 2.14.0. Set the private application data.
ctxt: | parser context |
priv: | private application data |
void xmlCtxtSetResourceLoader (xmlParserCtxtPtr ctxt,
xmlResourceLoader loader,
void * vctxt)
Installs a custom callback to load documents, DTDs or external entities. Available since 2.14.0.
ctxt: | parser context |
loader: | callback |
vctxt: | user data |
int xmlCtxtSetSaxHandler (xmlParserCtxtPtr ctxt,
const xmlSAXHandler * sax)
Available since 2.14.0. Set the SAX handler struct to a copy of @sax.
ctxt: | parser context |
sax: | SAX handler |
Returns: | 0 on success or -1 if arguments are invalid or a memory allocation failed. |
int xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
int options)
DEPRECATED: Use xmlCtxtSetOptions. Applies the options to the parser context. The following options are never cleared and can only be enabled: XML_PARSE_NOERROR XML_PARSE_NOWARNING XML_PARSE_NONET XML_PARSE_NSCLEAN XML_PARSE_NOCDATA XML_PARSE_COMPACT XML_PARSE_OLD10 XML_PARSE_HUGE XML_PARSE_OLDSAX XML_PARSE_IGNORE_ENC XML_PARSE_BIG_LINES
ctxt: | an XML parser context |
options: | a combination of xmlParserOption |
Returns: | 0 in case of success, the set of unknown or unimplemented options in case of error. |
int xmlCtxtValidateDocument (xmlParserCtxtPtr ctxt,
xmlDocPtr doc)
Validate a document. Like xmlValidateDocument but uses the parser context's error handler. Option XML_PARSE_DTDLOAD should be enabled in the parser context to make external entities work. Availabe since 2.14.0.
ctxt: | a parser context |
doc: | a document instance |
Returns: | 1 if valid or 0 otherwise. |
int xmlCtxtValidateDtd (xmlParserCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd)
Validate a document against a DTD. Like xmlValidateDtd but uses the parser context's error handler. Availabe since 2.14.0.
ctxt: | a parser context |
doc: | a document instance |
dtd: | a dtd instance |
Returns: | 1 if valid or 0 otherwise. |
void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt)
Free all the memory used by a parser context. However the parsed document in ctxt->myDoc is not freed.
ctxt: | an XML parser context |
xmlExternalEntityLoader xmlGetExternalEntityLoader (void)
DEPRECATED: See xmlSetExternalEntityLoader. Get the default external entity resolver function for the application
Returns: | the xmlExternalEntityLoader function pointer |
int xmlHasFeature (xmlFeature feature)
Examines if the library has been compiled with a given feature.
feature: | the feature to be examined |
Returns: | a non-zero value if the feature exist, otherwise zero. Returns zero (0) if the feature does not exist or an unknown unknown feature is requested, non-zero otherwise. |
xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
xmlParserInputBufferPtr input,
xmlCharEncoding enc)
DEPRECATED: Use xmlCtxtParseDtd. Load and parse a DTD
sax: | the SAX handler block or NULL |
input: | an Input Buffer |
enc: | the charset encoding if known |
Returns: | the resulting xmlDtdPtr or NULL in case of error. @input will be freed by the function in any case. |
void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq)
DEPRECATED: Don't use. -- Initialize (set to initial state) node info sequence
seq: | a node info sequence pointer |
void xmlInitParser (void)
Initialization function for the XML parser. For older versions, it's recommended to call this function once from the main thread before using the library in multithreaded programs. Since 2.14.0, there's no distinction between threads. It should be unnecessary to call this function.
int xmlInitParserCtxt (xmlParserCtxtPtr ctxt)
DEPRECATED: Internal function which will be made private in a future version. Initialize a parser context
ctxt: | an XML parser context |
Returns: | 0 in case of success and -1 in case of error |
xmlParserErrors xmlInputSetEncodingHandler (xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler)
Use encoding handler to decode input data. Closes the handler on error.
input: | the input stream |
handler: | the encoding handler |
Returns: | an xmlParserErrors code. |
int xmlKeepBlanksDefault (int val)
DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS. Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the "empty" nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.
val: | int 0 or 1 |
Returns: | the last value for 0 for no substitution, 1 for substitution. |
int xmlLineNumbersDefault (int val)
DEPRECATED: The modern options API always enables line numbers. Set and return the previous value for enabling line numbers in elements contents. This may break on old application and is turned off by default.
val: | int 0 or 1 |
Returns: | the last value for 0 for no substitution, 1 for substitution. |
xmlParserInputPtr xmlLoadExternalEntity (const char * URL,
const char * ID,
xmlParserCtxtPtr ctxt)
@URL is a filename or URL. If if contains the substring "://", it is assumed to be a Legacy Extended IRI. Otherwise, it is treated as a filesystem path. @ID is an optional XML public ID, typically from a doctype declaration. It is used for catalog lookups. If catalog lookup is enabled (default is yes) and URL or ID are found in system or local XML catalogs, URL is replaced with the result. Then the following resource loaders will be called if they were registered (in order of precedence): - the resource loader set with xmlCtxtSetResourceLoader - the global external entity loader set with xmlSetExternalEntityLoader (without catalog resolution, deprecated) - the per-thread xmlParserInputBufferCreateFilenameFunc set with xmlParserInputBufferCreateFilenameDefault (deprecated) - the default loader which will return - the result from a matching global input callback set with xmlRegisterInputCallbacks (deprecated) - a HTTP resource if support is compiled in. - a file opened from the filesystem, with automatic detection of compressed files if support is compiled in.
URL: | the URL for the entity to load |
ID: | the Public ID for the entity to load |
ctxt: | the context in which the entity is called or NULL |
Returns: | the xmlParserInputPtr or NULL |
xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
xmlParserInputBufferPtr buf,
xmlCharEncoding enc)
Create a new input stream structure encapsulating the @input into a stream suitable for the parser.
ctxt: | an XML parser context |
buf: | an input buffer |
enc: | the charset encoding if known |
Returns: | the new input stream or NULL |
xmlParserInputPtr xmlNewInputFromFd (const char * url,
int fd,
xmlParserInputFlags flags)
Creates a new parser input to read from a zero-terminated string. @url is used as base to resolve external entities and for error reporting. @fd is closed after parsing has finished. Supported @flags are XML_INPUT_UNZIP to decompress data automatically. This feature is deprecated and will be removed in a future release. Available since 2.14.0.
url: | base URL (optional) |
fd: | file descriptor |
flags: | input flags |
Returns: | a new parser input or NULL if a memory allocation failed. |
xmlParserInputPtr xmlNewInputFromIO (const char * url,
xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose,
void * ioCtxt,
xmlParserInputFlags flags)
Creates a new parser input to read from input callbacks and cintext. @url is used as base to resolve external entities and for error reporting. @ioRead is called to read new data into a provided buffer. It must return the number of bytes written into the buffer ot a negative xmlParserErrors code on failure. @ioClose is called after parsing has finished. @ioCtxt is an opaque pointer passed to the callbacks. Available since 2.14.0.
url: | base URL (optional) |
ioRead: | read callback |
ioClose: | close callback (optional) |
ioCtxt: | IO context |
flags: | unused, pass 0 |
Returns: | a new parser input or NULL if a memory allocation failed. |
xmlParserInputPtr xmlNewInputFromMemory (const char * url,
const void * mem,
size_t size,
xmlParserInputFlags flags)
Creates a new parser input to read from a memory area. @url is used as base to resolve external entities and for error reporting. If the XML_INPUT_BUF_STATIC flag is set, the memory area must stay unchanged until parsing has finished. This can avoid temporary copies. If the XML_INPUT_BUF_ZERO_TERMINATED flag is set, the memory area must contain a zero byte after the buffer at position @size. This can avoid temporary copies. Available since 2.14.0.
url: | base URL (optional) |
mem: | pointer to char array |
size: | size of array |
flags: | optimization hints |
Returns: | a new parser input or NULL if a memory allocation failed. |
xmlParserInputPtr xmlNewInputFromString (const char * url,
const char * str,
xmlParserInputFlags flags)
Creates a new parser input to read from a zero-terminated string. @url is used as base to resolve external entities and for error reporting. If the XML_INPUT_BUF_STATIC flag is set, the string must stay unchanged until parsing has finished. This can avoid temporary copies. Available since 2.14.0.
url: | base URL (optional) |
str: | zero-terminated string |
flags: | optimization hints |
Returns: | a new parser input or NULL if a memory allocation failed. |
xmlParserErrors xmlNewInputFromUrl (const char * filename,
xmlParserInputFlags flags,
xmlParserInputPtr * out)
Create a new input stream based on a file or a URL. The flag XML_INPUT_UNZIP allows decompression. The flag XML_INPUT_NETWORK allows network access. The following resource loaders will be called if they were registered (in order of precedence): - the per-thread xmlParserInputBufferCreateFilenameFunc set with xmlParserInputBufferCreateFilenameDefault (deprecated) - the default loader which will return - the result from a matching global input callback set with xmlRegisterInputCallbacks (deprecated) - a HTTP resource if support is compiled in. - a file opened from the filesystem, with automatic detection of compressed files if support is compiled in. Available since 2.14.0.
filename: | the filename to use as entity |
flags: | XML_INPUT flags |
out: | pointer to new parser input |
Returns: | an xmlParserErrors code. |
xmlParserCtxtPtr xmlNewParserCtxt (void)
Allocate and initialize a new parser context.
Returns: | the xmlParserCtxtPtr or NULL |
xmlParserCtxtPtr xmlNewSAXParserCtxt (const xmlSAXHandler * sax,
void * userData)
Allocate and initialize a new SAX parser context. If userData is NULL, the parser context will be passed as user data. Available since 2.11.0. If you want support older versions, it's best to invoke xmlNewParserCtxt and set ctxt->sax with struct assignment.
sax: | SAX handler |
userData: | user data |
Returns: | the xmlParserCtxtPtr or NULL if memory allocation failed. |
int xmlParseBalancedChunkMemory (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * string,
xmlNodePtr * lst)
Parse a well-balanced chunk of an XML document called by the parser The allowed sequence for the Well Balanced Chunk is the one defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
doc: | the document the chunk pertains to (must not be NULL) |
sax: | the SAX handler block (possibly NULL) |
user_data: | The user data returned on SAX callbacks (possibly NULL) |
depth: | Used for loop detection, use 0 |
string: | the input string in UTF8 or ISO-Latin (zero terminated) |
lst: | the return value for the set of parsed nodes |
Returns: | 0 if the chunk is well balanced, -1 in case of args problem and the parser error code otherwise |
int xmlParseBalancedChunkMemoryRecover (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * string,
xmlNodePtr * listOut,
int recover)
Parse a well-balanced chunk of an XML document The allowed sequence for the Well Balanced Chunk is the one defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
doc: | the document the chunk pertains to (must not be NULL) |
sax: | the SAX handler block (possibly NULL) |
user_data: | The user data returned on SAX callbacks (possibly NULL) |
depth: | Used for loop detection, use 0 |
string: | the input string in UTF8 or ISO-Latin (zero terminated) |
listOut: | the return value for the set of parsed nodes |
recover: | return nodes even if the data is broken (use 0) |
Returns: | 0 if the chunk is well balanced, or thehe parser error code otherwise. In case recover is set to 1, the nodelist will not be empty even if the parsed chunk is not well balanced, assuming the parsing succeeded to some extent. |
int xmlParseChunk (xmlParserCtxtPtr ctxt,
const char * chunk,
int size,
int terminate)
Parse a chunk of memory in push parser mode. Assumes that the parser context was initialized with xmlCreatePushParserCtxt. The last chunk, which will often be empty, must be marked with the @terminate flag. With the default SAX callbacks, the resulting document will be available in ctxt->myDoc. This pointer will not be freed when calling xmlFreeParserCtxt and must be freed by the caller. If the document isn't well-formed, it will still be returned in ctxt->myDoc. As an exception, xmlCtxtResetPush will free the document in ctxt->myDoc. So ctxt->myDoc should be set to NULL after extracting the document.
ctxt: | an XML parser context |
chunk: | chunk of memory |
size: | size of chunk in bytes |
terminate: | last chunk indicator |
Returns: | an xmlParserErrors code (0 on success). |
int xmlParseCtxtExternalEntity (xmlParserCtxtPtr ctxt,
const xmlChar * URL,
const xmlChar * ID,
xmlNodePtr * listOut)
Parse an external general entity within an existing parsing context An external general parsed entity is well-formed if it matches the production labeled extParsedEnt. [78] extParsedEnt ::= TextDecl? content
ctxt: | the existing parsing context |
URL: | the URL for the entity to load |
ID: | the System ID for the entity to load |
listOut: | the return value for the set of parsed nodes |
Returns: | 0 if the entity is well formed, -1 in case of args problem and the parser error code otherwise |
xmlDtdPtr xmlParseDTD (const xmlChar * ExternalID,
const xmlChar * SystemID)
Load and parse an external subset.
ExternalID: | a NAME* containing the External ID of the DTD |
SystemID: | a NAME* containing the URL to the DTD |
Returns: | the resulting xmlDtdPtr or NULL in case of error. |
xmlDocPtr xmlParseDoc (const xmlChar * cur)
DEPRECATED: Use xmlReadDoc. parse an XML in-memory document and build a tree.
cur: | a pointer to an array of xmlChar |
Returns: | the resulting document tree |
int xmlParseDocument (xmlParserCtxtPtr ctxt)
Parse an XML document and invoke the SAX handlers. This is useful if you're only interested in custom SAX callbacks. If you want a document tree, use xmlCtxtParseDocument.
ctxt: | an XML parser context |
Returns: | 0, -1 in case of error. |
xmlDocPtr xmlParseEntity (const char * filename)
parse an XML external entity out of context and build a tree. [78] extParsedEnt ::= TextDecl? content This correspond to a "Well Balanced" chunk
filename: | the filename |
Returns: | the resulting document tree |
int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt)
DEPRECATED: Internal function, don't use. parse a general parsed entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt. [78] extParsedEnt ::= TextDecl? content
ctxt: | an XML parser context |
Returns: | 0, -1 in case of error. the parser context is augmented as a result of the parsing. |
int xmlParseExternalEntity (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * URL,
const xmlChar * ID,
xmlNodePtr * list)
DEPRECATED: Use xmlParseCtxtExternalEntity. Parse an external general entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt. [78] extParsedEnt ::= TextDecl? content
doc: | the document the chunk pertains to |
sax: | the SAX handler block (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 |
Returns: | 0 if the entity is well formed, -1 in case of args problem and the parser error code otherwise |
xmlDocPtr xmlParseFile (const char * filename)
DEPRECATED: Use xmlReadFile. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.
filename: | the filename |
Returns: | the resulting document tree if the file was wellformed, NULL otherwise. |
xmlParserErrors xmlParseInNodeContext (xmlNodePtr node,
const char * data,
int datalen,
int options,
xmlNodePtr * listOut)
Parse a well-balanced chunk of an XML document within the context (DTD, namespaces, etc ...) of the given node. The allowed sequence for the data is a Well Balanced Chunk defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)* This function assumes the encoding of @node's document which is typically not what you want. A better alternative is xmlCtxtParseContent.
node: | the context node |
data: | the input string |
datalen: | the input string length in bytes |
options: | a combination of xmlParserOption |
listOut: | the return value for the set of parsed nodes |
Returns: | XML_ERR_OK if the chunk is well balanced, and the parser error code otherwise |
xmlDocPtr xmlParseMemory (const char * buffer,
int size)
DEPRECATED: Use xmlReadMemory. parse an XML in-memory block and build a tree.
buffer: | an pointer to a char array |
size: | the size of the array |
Returns: | the resulting document tree |
void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
xmlParserNodeInfoPtr info)
DEPRECATED: Don't use. Insert node info record into the sorted sequence
ctxt: | an XML parser context |
info: | a node info sequence pointer |
const xmlParserNodeInfo * xmlParserFindNodeInfo (xmlParserCtxtPtr ctx,
xmlNodePtr node)
DEPRECATED: Don't use. Find the parser node info struct for a given node
ctx: | an XML parser context |
node: | an XML node within the tree |
Returns: | an xmlParserNodeInfo block pointer or NULL |
unsigned long xmlParserFindNodeInfoIndex (xmlParserNodeInfoSeqPtr seq,
xmlNodePtr node)
DEPRECATED: Don't use. xmlParserFindNodeInfoIndex : Find the index that the info record for the given node is or should be at in a sorted sequence
seq: | a node info sequence pointer |
node: | an XML node pointer |
Returns: | a long indicating the position of the record |
int xmlParserInputGrow (xmlParserInputPtr in,
int len)
DEPRECATED: Don't use. This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data
in: | an XML parser input |
len: | an indicative size for the lookahead |
Returns: | the amount of char read, or -1 in case of error, 0 indicate the end of this entity |
int xmlParserInputRead (xmlParserInputPtr in,
int len)
DEPRECATED: This function was internal and is deprecated.
in: | an XML parser input |
len: | an indicative size for the lookahead |
Returns: | -1 as this is an error to use it. |
int xmlPedanticParserDefault (int val)
DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC. Set and return the previous value for enabling pedantic warnings.
val: | int 0 or 1 |
Returns: | the last value for 0 for no substitution, 1 for substitution. |
xmlDocPtr xmlReadDoc (const xmlChar * cur,
const char * URL,
const char * encoding,
int options)
Convenience function to parse an XML document from a zero-terminated string. See xmlCtxtReadDoc for details.
cur: | a pointer to a zero terminated string |
URL: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlReadFd (int fd,
const char * URL,
const char * encoding,
int options)
Parse an XML from a file descriptor and build a tree. See xmlCtxtReadFd for details. NOTE that the file descriptor will not be closed when the context is freed or reset.
fd: | an open file descriptor |
URL: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlReadFile (const char * filename,
const char * encoding,
int options)
Convenience function to parse an XML file from the filesystem, the network or a global user-define resource loader. This function always enables the XML_PARSE_UNZIP option for backward compatibility. If a "-" filename is passed, it will read from stdin. Both of these features are potentially insecure and might be removed from later versions. See xmlCtxtReadFile for details.
filename: | a file or URL |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options)
Parse an XML document from I/O functions and context and build a tree. See xmlCtxtReadIO for details.
ioread: | an I/O read function |
ioclose: | an I/O close function (optional) |
ioctx: | an I/O handler |
URL: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlReadMemory (const char * buffer,
int size,
const char * url,
const char * encoding,
int options)
Parse an XML in-memory document and build a tree. The input buffer must not contain a terminating null byte. See xmlCtxtReadMemory for details.
buffer: | a pointer to a char array |
size: | the size of the array |
url: | base URL (optional) |
encoding: | the document encoding (optional) |
options: | a combination of xmlParserOption |
Returns: | the resulting document tree |
xmlDocPtr xmlRecoverDoc (const xmlChar * cur)
DEPRECATED: Use xmlReadDoc with XML_PARSE_RECOVER. parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway
cur: | a pointer to an array of xmlChar |
Returns: | the resulting document tree or NULL in case of failure |
xmlDocPtr xmlRecoverFile (const char * filename)
DEPRECATED: Use xmlReadFile with XML_PARSE_RECOVER. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway
filename: | the filename |
Returns: | the resulting document tree or NULL in case of failure |
xmlDocPtr xmlRecoverMemory (const char * buffer,
int size)
DEPRECATED: Use xmlReadMemory with XML_PARSE_RECOVER. parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway
buffer: | an pointer to a char array |
size: | the size of the array |
Returns: | the resulting document tree or NULL in case of error |
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
const xmlChar * ExternalID,
const xmlChar * SystemID)
DEPRECATED: Use xmlCtxtParseDtd. Load and parse an external subset.
sax: | the SAX handler block |
ExternalID: | a NAME* containing the External ID of the DTD |
SystemID: | a NAME* containing the URL to the DTD |
Returns: | the resulting xmlDtdPtr or NULL in case of error. |
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
const xmlChar * cur,
int recovery)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadDoc. parse an XML in-memory document and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.
sax: | the SAX handler block |
cur: | a pointer to an array of xmlChar |
recovery: | work in recovery mode, i.e. tries to read no Well Formed documents |
Returns: | the resulting document tree |
xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char * filename)
DEPRECATED: Don't use. parse an XML external entity out of context and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. [78] extParsedEnt ::= TextDecl? content This correspond to a "Well Balanced" chunk
sax: | the SAX handler block |
filename: | the filename |
Returns: | the resulting document tree |
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char * filename,
int recovery)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.
sax: | the SAX handler block |
filename: | the filename |
recovery: | work in recovery mode, i.e. tries to read no Well Formed documents |
Returns: | the resulting document tree |
xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
const char * filename,
int recovery,
void * data)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml
sax: | the SAX handler block |
filename: | the filename |
recovery: | work in recovery mode, i.e. tries to read no Well Formed documents |
data: | the userdata |
Returns: | the resulting document tree |
xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
const char * buffer,
int size,
int recovery)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory. parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.
sax: | the SAX handler block |
buffer: | an pointer to a char array |
size: | the size of the array |
recovery: | work in recovery mode, i.e. tries to read not Well Formed documents |
Returns: | the resulting document tree |
xmlDocPtr xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
const char * buffer,
int size,
int recovery,
void * data)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory. parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml
sax: | the SAX handler block |
buffer: | an pointer to a char array |
size: | the size of the array |
recovery: | work in recovery mode, i.e. tries to read no Well Formed documents |
data: | the userdata |
Returns: | the resulting document tree |
int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
void * user_data,
const char * filename)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile. parse an XML file and call the given SAX handler routines. Automatic support for ZLIB/Compress compressed document is provided
sax: | a SAX handler |
user_data: | The user data returned on SAX callbacks |
filename: | a file name |
Returns: | 0 in case of success or a error number otherwise |
int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
void * user_data,
const char * buffer,
int size)
DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory. parse an XML in-memory buffer and call the given SAX handler routines.
sax: | a SAX handler |
user_data: | The user data returned on SAX callbacks |
buffer: | an in-memory XML document input |
size: | the length of the XML document in bytes |
Returns: | 0 in case of success or a error number otherwise |
void xmlSetExternalEntityLoader (xmlExternalEntityLoader f)
DEPRECATED: This is a global setting and not thread-safe. Use xmlCtxtSetResourceLoader or similar functions. Changes the default external entity resolver function for the application.
f: | the new entity resolver function |
void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
const xmlChar * buffer,
const char * filename)
DEPRECATED: Don't use. Setup the parser context to parse a new buffer; Clears any prior contents from the parser context. The buffer parameter must not be NULL, but the filename parameter can be
ctxt: | an XML parser context |
buffer: | a xmlChar * buffer |
filename: | a file name |
void xmlStopParser (xmlParserCtxtPtr ctxt)
Blocks further parser processing
ctxt: | an XML parser context |
int xmlSubstituteEntitiesDefault (int val)
DEPRECATED: Use the modern options API with XML_PARSE_NOENT. Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.
val: | int 0 or 1 |
Returns: | the last value for 0 for no substitution, 1 for substitution. |
int xmlThrDefDoValidityCheckingDefaultValue (int v)
v: | |
Returns: |
int xmlThrDefSubstituteEntitiesDefaultValue (int v)
v: | |
Returns: |