libxml2

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
parser.h File Reference

Validating XML 1.0 parser. More...

## Data Structures
struct | _xmlParserInput
| Parser input. More...
struct | _xmlParserCtxt
| Parser context. More...
struct | _xmlSAXLocator
| A SAX Locator. More...
struct | _xmlSAXHandler
| Callbacks for SAX parser. More...
struct | _xmlSAXHandlerV1
| SAX handler, version 1. More...

## Macros
#define | XML_DEFAULT_VERSION "1.0"
| The default version of XML used: 1.0.
#define | XML_SAX2_MAGIC 0xDEEDBEAF
| Special constant required for SAX2 handlers.
#define | xmlDoValidityCheckingDefaultValue (*__xmlDoValidityCheckingDefaultValue())
| Thread-local setting to enable validation.
#define | xmlGetWarningsDefaultValue (*__xmlGetWarningsDefaultValue())
| Thread-local setting to disable warnings.
#define | xmlKeepBlanksDefaultValue (*__xmlKeepBlanksDefaultValue())
| Thread-local setting to ignore some whitespace.
#define | xmlLineNumbersDefaultValue (*__xmlLineNumbersDefaultValue())
| Thread-local setting to store line numbers.
#define | xmlLoadExtDtdDefaultValue (*__xmlLoadExtDtdDefaultValue())
| Thread-local setting to enable loading of external DTDs.
#define | xmlPedanticParserDefaultValue (*__xmlPedanticParserDefaultValue())
| Thread-local setting to enable pedantic warnings.
#define | xmlSubstituteEntitiesDefaultValue (*__xmlSubstituteEntitiesDefaultValue())
| Thread-local setting to enable entity substitution.
#define | xmlIndentTreeOutput (*__xmlIndentTreeOutput())
| Thread-local setting to disable indenting when formatting output.
#define | xmlTreeIndentString (*__xmlTreeIndentString())
| Thread-local setting to change the indent string.
#define | xmlSaveNoEmptyTags (*__xmlSaveNoEmptyTags())
| Thread-local setting to disable empty tags when serializing.

## Typedefs
typedef xmlParserErrors(* | xmlResourceLoader) (void *ctxt, const char *url, const char *publicId, xmlResourceType type, xmlParserInputFlags flags, xmlParserInput **out)
| Callback for custom resource loaders.
typedef xmlParserInput *(* | resolveEntitySAXFunc) (void *ctx, const xmlChar *publicId, const xmlChar *systemId)
| SAX callback to resolve external entities.
typedef void(* | internalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
| SAX callback for the internal subset.
typedef void(* | externalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
| SAX callback for the external subset.
typedef xmlEntity *(* | getEntitySAXFunc) (void *ctx, const xmlChar *name)
| SAX callback to look up a general entity by name.
typedef xmlEntity *(* | getParameterEntitySAXFunc) (void *ctx, const xmlChar *name)
| SAX callback to look up a parameter entity by name.
typedef void(* | entityDeclSAXFunc) (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
| SAX callback for entity declarations.
typedef void(* | notationDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
| SAX callback for notation declarations.
typedef void(* | attributeDeclSAXFunc) (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumeration *tree)
| SAX callback for attribute declarations.
typedef void(* | elementDeclSAXFunc) (void *ctx, const xmlChar *name, int type, xmlElementContent *content)
| SAX callback for element declarations.
typedef void(* | unparsedEntityDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
| SAX callback for unparsed entity declarations.
typedef void(* | setDocumentLocatorSAXFunc) (void *ctx, xmlSAXLocator *loc)
| This callback receives the "document locator" at startup, which is always the global xmlDefaultSAXLocator.
typedef void(* | startDocumentSAXFunc) (void *ctx)
| SAX callback for start of document.
typedef void(* | endDocumentSAXFunc) (void *ctx)
| SAX callback for end of document.
typedef void(* | startElementSAXFunc) (void *ctx, const xmlChar *name, const xmlChar **atts)
| SAX callback for start tags.
typedef void(* | endElementSAXFunc) (void *ctx, const xmlChar *name)
| SAX callback for end tags.
typedef void(* | attributeSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *value)
| Callback for attributes.
typedef void(* | referenceSAXFunc) (void *ctx, const xmlChar *name)
| SAX callback for entity references.
typedef void(* | charactersSAXFunc) (void *ctx, const xmlChar *ch, int len)
| SAX callback for character data.
typedef void(* | ignorableWhitespaceSAXFunc) (void *ctx, const xmlChar *ch, int len)
| SAX callback for "ignorable" whitespace.
typedef void(* | processingInstructionSAXFunc) (void *ctx, const xmlChar *target, const xmlChar *data)
| SAX callback for processing instructions.
typedef void(* | commentSAXFunc) (void *ctx, const xmlChar *value)
| SAX callback for comments.
typedef void(* | cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len)
| SAX callback for CDATA sections.
typedef void(* | warningSAXFunc) (void *ctx, const char *msg,...)
| SAX callback for warning messages.
typedef void(* | errorSAXFunc) (void *ctx, const char *msg,...)
| SAX callback for error messages.
typedef void(* | fatalErrorSAXFunc) (void *ctx, const char *msg,...)
| SAX callback for fatal error messages.
typedef int(* | isStandaloneSAXFunc) (void *ctx)
| SAX callback to get standalone status.
typedef int(* | hasInternalSubsetSAXFunc) (void *ctx)
| SAX callback to get internal subset status.
typedef int(* | hasExternalSubsetSAXFunc) (void *ctx)
| SAX callback to get external subset status.
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)
| SAX2 callback for start tags.
typedef void(* | endElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
| SAX2 callback for end tags.
typedef struct _xmlSAXHandlerV1 | xmlSAXHandlerV1
| SAX handler, version 1.
typedef xmlParserInput *(* | xmlExternalEntityLoader) (const char *URL, const char *publicId, xmlParserCtxt *context)
| Callback for external entity loader.

## Enumerations
enum | xmlParserStatus
| Status after parsing a document. More...
enum | xmlResourceType
| Resource type for resource loaders. More...
enum | xmlParserInputFlags
| Flags for parser input. More...
enum | xmlParserOption
| This is the set of XML parser options that can be passed to xmlReadDoc, xmlCtxtSetOptions and other functions. More...
enum | xmlFeature
| Used to examine the existence of features that can be enabled or disabled at compile-time. More...

## Functions
void | xmlInitParser (void)
| Initialization function for the XML parser.
void | xmlCleanupParser (void)
| Free global memory allocations.
void | xmlInitGlobals (void)
void | xmlCleanupGlobals (void)
int | xmlParserInputRead (xmlParserInput *in, int len)
int | xmlParserInputGrow (xmlParserInput *in, int len)
| This function increase the input for the parser.
xmlDoc * | xmlParseDoc (const xmlChar *cur)
| Parse an XML in-memory document and build a tree.
xmlDoc * | xmlParseFile (const char *filename)
| Parse an XML file and build a tree.
xmlDoc * | xmlParseMemory (const char *buffer, int size)
| Parse an XML in-memory block and build a tree.
int | xmlSubstituteEntitiesDefault (int val)
| Set and return the previous value for default entity support.
int | xmlKeepBlanksDefault (int val)
| Set and return the previous value for default blanks text nodes support.
void | xmlStopParser (xmlParserCtxt *ctxt)
| Blocks further parser processing.
int | xmlPedanticParserDefault (int val)
| Set and return the previous value for enabling pedantic warnings.
int | xmlLineNumbersDefault (int val)
| Has no effect.
int | xmlThrDefSubstituteEntitiesDefaultValue (int v)
| Set per-thread default value.
int | xmlThrDefKeepBlanksDefaultValue (int v)
| Set per-thread default value.
int | xmlThrDefPedanticParserDefaultValue (int v)
| Set per-thread default value.
int | xmlThrDefLineNumbersDefaultValue (int v)
| Set per-thread default value.
int | xmlThrDefDoValidityCheckingDefaultValue (int v)
| Set per-thread default value.
int | xmlThrDefGetWarningsDefaultValue (int v)
| Set per-thread default value.
int | xmlThrDefLoadExtDtdDefaultValue (int v)
| Set per-thread default value.
xmlDoc * | xmlRecoverDoc (const xmlChar *cur)
| Parse an XML in-memory document and build a tree.
xmlDoc * | xmlRecoverMemory (const char *buffer, int size)
| Parse an XML in-memory block and build a tree.
xmlDoc * | xmlRecoverFile (const char *filename)
| Parse an XML file and build a tree.
int | xmlParseDocument (xmlParserCtxt *ctxt)
| Parse an XML document and invoke the SAX handlers.
int | xmlParseExtParsedEnt (xmlParserCtxt *ctxt)
| Parse a general parsed entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt.
int | xmlSAXUserParseFile (xmlSAXHandler *sax, void *user_data, const char *filename)
| Parse an XML file and call the given SAX handler routines.
int | xmlSAXUserParseMemory (xmlSAXHandler *sax, void *user_data, const char *buffer, int size)
| Parse an XML in-memory buffer and call the given SAX handler routines.
xmlDoc * | xmlSAXParseDoc (xmlSAXHandler *sax, const xmlChar *cur, int recovery)
| Parse an XML in-memory document and build a tree.
xmlDoc * | xmlSAXParseMemory (xmlSAXHandler *sax, const char *buffer, int size, int recovery)
| Parse an XML in-memory block and use the given SAX function block to handle the parsing callback.
xmlDoc * | xmlSAXParseMemoryWithData (xmlSAXHandler *sax, const char *buffer, int size, int recovery, void *data)
| Parse an XML in-memory block and use the given SAX function block to handle the parsing callback.
xmlDoc * | xmlSAXParseFile (xmlSAXHandler *sax, const char *filename, int recovery)
| Parse an XML file and build a tree.
xmlDoc * | xmlSAXParseFileWithData (xmlSAXHandler *sax, const char *filename, int recovery, void *data)
| Parse an XML file and build a tree.
xmlDoc * | xmlSAXParseEntity (xmlSAXHandler *sax, const char *filename)
| Parse an XML external entity out of context and build a tree.
xmlDoc * | xmlParseEntity (const char *filename)
| Parse an XML external entity out of context and build a tree.
xmlDtd * | xmlCtxtParseDtd (xmlParserCtxt *ctxt, xmlParserInput *input, const xmlChar *publicId, const xmlChar *systemId)
| Parse a DTD.
int | xmlCtxtValidateDocument (xmlParserCtxt *ctxt, xmlDoc *doc)
| Validate a document.
int | xmlCtxtValidateDtd (xmlParserCtxt *ctxt, xmlDoc *doc, xmlDtd *dtd)
| Validate a document against a DTD.
xmlDtd * | xmlSAXParseDTD (xmlSAXHandler *sax, const xmlChar *publicId, const xmlChar *systemId)
| Load and parse an external subset.
xmlDtd * | xmlParseDTD (const xmlChar *publicId, const xmlChar *systemId)
| Load and parse an external subset.
xmlDtd * | xmlIOParseDTD (xmlSAXHandler *sax, xmlParserInputBuffer *input, xmlCharEncoding enc)
| Load and parse a DTD.
int | xmlParseBalancedChunkMemory (xmlDoc *doc, xmlSAXHandler *sax, void *user_data, int depth, const xmlChar *string, xmlNode **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:
xmlParserErrors | xmlParseInNodeContext (xmlNode *node, const char *data, int datalen, int options, xmlNode **lst)
| Parse a well-balanced chunk of an XML document within the context (DTD, namespaces, etc ...) of the given node.
int | xmlParseBalancedChunkMemoryRecover (xmlDoc *doc, xmlSAXHandler *sax, void *user_data, int depth, const xmlChar *string, xmlNode **lst, int recover)
| Parse a well-balanced chunk of an XML document.
int | xmlParseExternalEntity (xmlDoc *doc, xmlSAXHandler *sax, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNode **lst)
| Parse an external general entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt.
int | xmlParseCtxtExternalEntity (xmlParserCtxt *ctx, const xmlChar *URL, const xmlChar *ID, xmlNode **lst)
| 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.
xmlParserCtxt * | xmlNewParserCtxt (void)
| Allocate and initialize a new parser context.
xmlParserCtxt * | xmlNewSAXParserCtxt (const xmlSAXHandler *sax, void *userData)
| Allocate and initialize a new SAX parser context.
int | xmlInitParserCtxt (xmlParserCtxt *ctxt)
| Initialize a parser context.
void | xmlClearParserCtxt (xmlParserCtxt *ctxt)
| Same as xmlCtxtReset.
void | xmlFreeParserCtxt (xmlParserCtxt *ctxt)
| Free all the memory used by a parser context.
void | xmlSetupParserForBuffer (xmlParserCtxt *ctxt, const xmlChar *buffer, const char *filename)
| Setup the parser context to parse a new buffer; Clears any prior contents from the parser context.
xmlParserCtxt * | xmlCreateDocParserCtxt (const xmlChar *cur)
| Creates a parser context for an XML in-memory document.
xmlParserCtxt * | xmlCreatePushParserCtxt (xmlSAXHandler *sax, void *user_data, const char *chunk, int size, const char *filename)
| Create a parser context for using the XML parser in push mode.
int | xmlParseChunk (xmlParserCtxt *ctxt, const char *chunk, int size, int terminate)
| Parse a chunk of memory in push parser mode.
xmlParserCtxt * | xmlCreateIOParserCtxt (xmlSAXHandler *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.
xmlParserInput * | xmlNewIOInputStream (xmlParserCtxt *ctxt, xmlParserInputBuffer *input, xmlCharEncoding enc)
| Create a new input stream structure encapsulating the `input` into a stream suitable for the parser.
const xmlParserNodeInfo * | xmlParserFindNodeInfo (xmlParserCtxt *ctxt, xmlNode *node)
| Find the parser node info struct for a given node.
void | xmlInitNodeInfoSeq (xmlParserNodeInfoSeq *seq)
| Initialize (set to initial state) node info sequence.
void | xmlClearNodeInfoSeq (xmlParserNodeInfoSeq *seq)
| Clear (release memory and reinitialize) node info sequence.
unsigned long | xmlParserFindNodeInfoIndex (xmlParserNodeInfoSeq *seq, xmlNode *node)
| Find the index that the info record for the given node is or should be at in a sorted sequence.
void | xmlParserAddNodeInfo (xmlParserCtxt *ctxt, xmlParserNodeInfo *info)
| Insert node info record into the sorted sequence.
void | xmlSetExternalEntityLoader (xmlExternalEntityLoader f)
| Changes the default external entity resolver function for the application.
xmlExternalEntityLoader | xmlGetExternalEntityLoader (void)
| Get the default external entity resolver function for the application.
xmlParserInput * | xmlLoadExternalEntity (const char *URL, const char *ID, xmlParserCtxt *ctxt)
| `URL` is a filename or URL.
long | xmlByteConsumed (xmlParserCtxt *ctxt)
| This function provides the current index of the parser relative to the start of the current entity.
void | xmlCtxtReset (xmlParserCtxt *ctxt)
| Reset a parser context.
int | xmlCtxtResetPush (xmlParserCtxt *ctxt, const char *chunk, int size, const char *filename, const char *encoding)
| Reset a push parser context.
int | xmlCtxtGetOptions (xmlParserCtxt *ctxt)
| Get the current options of the parser context.
int | xmlCtxtSetOptions (xmlParserCtxt *ctxt, int options)
| Applies the options to the parser context.
int | xmlCtxtUseOptions (xmlParserCtxt *ctxt, int options)
| Applies the options to the parser context.
void * | xmlCtxtGetPrivate (xmlParserCtxt *ctxt)
void | xmlCtxtSetPrivate (xmlParserCtxt *ctxt, void *priv)
| Set the private application data.
void * | xmlCtxtGetCatalogs (xmlParserCtxt *ctxt)
void | xmlCtxtSetCatalogs (xmlParserCtxt *ctxt, void *catalogs)
| Set the local catalogs.
xmlDict * | xmlCtxtGetDict (xmlParserCtxt *ctxt)
void | xmlCtxtSetDict (xmlParserCtxt *ctxt, xmlDict *)
| Set the dictionary.
xmlSAXHandler * | xmlCtxtGetSaxHandler (xmlParserCtxt *ctxt)
int | xmlCtxtSetSaxHandler (xmlParserCtxt *ctxt, const xmlSAXHandler *sax)
| Set the SAX handler struct to a copy of `sax`.
xmlDoc * | xmlCtxtGetDocument (xmlParserCtxt *ctxt)
int | xmlCtxtIsHtml (xmlParserCtxt *ctxt)
int | xmlCtxtIsStopped (xmlParserCtxt *ctxt)
| Check whether the parser is stopped.
int | xmlCtxtIsInSubset (xmlParserCtxt *ctxt)
| Check whether a DTD subset is being parsed.
xmlValidCtxt * | xmlCtxtGetValidCtxt (xmlParserCtxt *ctxt)
const xmlChar * | xmlCtxtGetVersion (xmlParserCtxt *ctxt)
const xmlChar * | xmlCtxtGetDeclaredEncoding (xmlParserCtxt *ctxt)
int | xmlCtxtGetStandalone (xmlParserCtxt *ctxt)
xmlParserStatus | xmlCtxtGetStatus (xmlParserCtxt *ctxt)
| Get well-formedness and validation status after parsing.
void * | xmlCtxtGetUserData (xmlParserCtxt *ctxt)
| Return user data.
xmlNode * | xmlCtxtGetNode (xmlParserCtxt *ctxt)
| Return the current node being parsed.
int | xmlCtxtGetDocTypeDecl (xmlParserCtxt *ctxt, const xmlChar **name, const xmlChar **systemId, const xmlChar **publicId)
| Return data from the doctype declaration.
int | xmlCtxtGetInputPosition (xmlParserCtxt *ctxt, int inputIndex, const char **filname, int *line, int *col, unsigned long *bytePos)
| Return input position.
int | xmlCtxtGetInputWindow (xmlParserCtxt *ctxt, int inputIndex, const xmlChar **startOut, int *sizeInOut, int *offsetOut)
| Return window into input data.
void | xmlCtxtSetErrorHandler (xmlParserCtxt *ctxt, xmlStructuredErrorFunc handler, void *data)
| Register a callback function that will be called on errors and warnings.
void | xmlCtxtSetResourceLoader (xmlParserCtxt *ctxt, xmlResourceLoader loader, void *vctxt)
| Installs a custom callback to load documents, DTDs or external entities.
void | xmlCtxtSetCharEncConvImpl (xmlParserCtxt *ctxt, xmlCharEncConvImpl impl, void *vctxt)
| Installs a custom implementation to convert between character encodings.
void | xmlCtxtSetMaxAmplification (xmlParserCtxt *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.
xmlDoc * | xmlReadDoc (const xmlChar *cur, const char *URL, const char *encoding, int options)
| Convenience function to parse an XML document from a zero-terminated string.
xmlDoc * | xmlReadFile (const char *URL, const char *encoding, int options)
| Convenience function to parse an XML file from the filesystem or a global, user-defined resource loader.
xmlDoc * | xmlReadMemory (const char *buffer, int size, const char *URL, const char *encoding, int options)
| Parse an XML in-memory document and build a tree.
xmlDoc * | xmlReadFd (int fd, const char *URL, const char *encoding, int options)
| Parse an XML from a file descriptor and build a tree.
xmlDoc * | 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.
xmlDoc * | xmlCtxtParseDocument (xmlParserCtxt *ctxt, xmlParserInput *input)
| Parse an XML document and return the resulting document tree.
xmlNode * | xmlCtxtParseContent (xmlParserCtxt *ctxt, xmlParserInput *input, xmlNode *node, int hasTextDecl)
| Parse a well-balanced chunk of XML matching the 'content' production.
xmlDoc * | xmlCtxtReadDoc (xmlParserCtxt *ctxt, const xmlChar *cur, const char *URL, const char *encoding, int options)
| Parse an XML in-memory document and build a tree.
xmlDoc * | xmlCtxtReadFile (xmlParserCtxt *ctxt, const char *filename, const char *encoding, int options)
| Parse an XML file from the filesystem or a global, user-defined resource loader.
xmlDoc * | xmlCtxtReadMemory (xmlParserCtxt *ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
| Parse an XML in-memory document and build a tree.
xmlDoc * | xmlCtxtReadFd (xmlParserCtxt *ctxt, int fd, const char *URL, const char *encoding, int options)
| Parse an XML document from a file descriptor and build a tree.
xmlDoc * | xmlCtxtReadIO (xmlParserCtxt *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.
xmlParserErrors | xmlNewInputFromUrl (const char *url, xmlParserInputFlags flags, xmlParserInput **out)
| Create a new input stream based on a file or a URL.
xmlParserInput * | xmlNewInputFromMemory (const char *url, const void *mem, size_t size, xmlParserInputFlags flags)
| Creates a new parser input to read from a memory area.
xmlParserInput * | xmlNewInputFromString (const char *url, const char *str, xmlParserInputFlags flags)
| Creates a new parser input to read from a zero-terminated string.
xmlParserInput * | xmlNewInputFromFd (const char *url, int fd, xmlParserInputFlags flags)
| Creates a new parser input to read from a file descriptor.
xmlParserInput * | xmlNewInputFromIO (const char *url, xmlInputReadCallback ioRead, xmlInputCloseCallback ioClose, void *ioCtxt, xmlParserInputFlags flags)
| Creates a new parser input to read from input callbacks and context.
xmlParserErrors | xmlInputSetEncodingHandler (xmlParserInput *input, xmlCharEncodingHandler *handler)
| Use encoding handler to decode input data.
int | xmlHasFeature (xmlFeature feature)
| Examines if the library has been compiled with a given feature.

## Variables
const char *const | xmlParserVersion
| Constant string describing the version of the library used at run-time.

## Detailed Description

Validating XML 1.0 parser.

Interfaces, constants and types related to the XML parser.

Copyright
  See Copyright for the status of this software.

Author
  Daniel Veillard

## Macro Definition Documentation

## ◆ xmlDoValidityCheckingDefaultValue

#define xmlDoValidityCheckingDefaultValue (*__xmlDoValidityCheckingDefaultValue())

Thread-local setting to enable validation.

Defaults to 0.

Deprecated:
  Use the parser option XML_PARSE_DTDVALID.

## ◆ xmlGetWarningsDefaultValue

#define xmlGetWarningsDefaultValue (*__xmlGetWarningsDefaultValue())

Thread-local setting to disable warnings.

Defaults to 1.

Deprecated:
  Use the parser option XML_PARSE_NOWARNING.

## ◆ xmlIndentTreeOutput

#define xmlIndentTreeOutput (*__xmlIndentTreeOutput())

Thread-local setting to disable indenting when formatting output.

Defaults to 1.

Deprecated:
  Use the xmlsave.h API with option XML_SAVE_NO_INDENT.

## ◆ xmlKeepBlanksDefaultValue

#define xmlKeepBlanksDefaultValue (*__xmlKeepBlanksDefaultValue())

Thread-local setting to ignore some whitespace.

Defaults to 1.

Deprecated:
  Use the parser option XML_PARSE_NOBLANKS.

## ◆ xmlLineNumbersDefaultValue

#define xmlLineNumbersDefaultValue (*__xmlLineNumbersDefaultValue())

Thread-local setting to store line numbers.

Defaults to 0, but is always enabled after setting parser options.

Deprecated:
  Shouldn't be needed when using parser options.

## ◆ xmlLoadExtDtdDefaultValue

#define xmlLoadExtDtdDefaultValue (*__xmlLoadExtDtdDefaultValue())

Thread-local setting to enable loading of external DTDs.

Defaults to 0.

Deprecated:
  Use the parser option XML_PARSE_DTDLOAD.

## ◆ xmlPedanticParserDefaultValue

#define xmlPedanticParserDefaultValue (*__xmlPedanticParserDefaultValue())

Thread-local setting to enable pedantic warnings.

Defaults to 0.

Deprecated:
  Use the parser option XML_PARSE_PEDANTIC.

## ◆ xmlSaveNoEmptyTags

#define xmlSaveNoEmptyTags (*__xmlSaveNoEmptyTags())

Thread-local setting to disable empty tags when serializing.

Defaults to 0.

Deprecated:
  Use the xmlsave.h API with option XML_SAVE_NO_EMPTY.

## ◆ xmlSubstituteEntitiesDefaultValue

#define xmlSubstituteEntitiesDefaultValue (*__xmlSubstituteEntitiesDefaultValue())

Thread-local setting to enable entity substitution.

Defaults to 0.

Deprecated:
  Use the parser option XML_PARSE_NOENT.

## ◆ xmlTreeIndentString

#define xmlTreeIndentString (*__xmlTreeIndentString())

Thread-local setting to change the indent string.

Defaults to two spaces.

Deprecated:
  Use the xmlsave.h API and xmlSaveSetIndentString().

## Typedef Documentation

## ◆ attributeDeclSAXFunc

typedef void(* attributeDeclSAXFunc) (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumeration *tree)

SAX callback for attribute declarations.

Parameters

  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

## ◆ attributeSAXFunc

typedef void(* attributeSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *value)

Callback for attributes.

Deprecated:
  This typedef is unused.

Parameters

  ctx | the user data (XML parser context)
  name | The attribute name, including namespace prefix
  value | The attribute value

## ◆ cdataBlockSAXFunc

typedef void(* cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len)

SAX callback for CDATA sections.

Parameters

  ctx | the user data (XML parser context)
  value | The pcdata content
  len | the block length

## ◆ charactersSAXFunc

typedef void(* charactersSAXFunc) (void *ctx, const xmlChar *ch, int len)

SAX callback for character data.

Parameters

  ctx | the user data (XML parser context)
  ch | a xmlChar string
  len | the number of xmlChar

## ◆ commentSAXFunc

typedef void(* commentSAXFunc) (void *ctx, const xmlChar *value)

SAX callback for comments.

Parameters

  ctx | the user data (XML parser context)
  value | the comment content

## ◆ elementDeclSAXFunc

typedef void(* elementDeclSAXFunc) (void *ctx, const xmlChar *name, int type, xmlElementContent *content)

SAX callback for element declarations.

Parameters

  ctx | the user data (XML parser context)
  name | the element name
  type | the element type
  content | the element value tree

## ◆ endDocumentSAXFunc

typedef void(* endDocumentSAXFunc) (void *ctx)

SAX callback for end of document.

Parameters

  ctx | the user data (XML parser context)

## ◆ endElementNsSAX2Func

typedef void(* endElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)

SAX2 callback for end tags.

It provides the namespace information for the element.

Parameters

  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

## ◆ endElementSAXFunc

typedef void(* endElementSAXFunc) (void *ctx, const xmlChar *name)

SAX callback for end tags.

Parameters

  ctx | the user data (XML parser context)
  name | The element name

## ◆ entityDeclSAXFunc

typedef void(* entityDeclSAXFunc) (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)

SAX callback for entity declarations.

Parameters

  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).

## ◆ errorSAXFunc

typedef void(* errorSAXFunc) (void *ctx, const char *msg,...)

SAX callback for error messages.

Parameters

  ctx | an XML parser context
  msg | the message to display/transmit
  ... | extra parameters for the message display

## ◆ externalSubsetSAXFunc

typedef void(* externalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)

SAX callback for the external subset.

Parameters

  ctx | the user data (XML parser context)
  name | the root element name
  publicId | the public identifier
  systemId | the system identifier (e.g. filename or URL)

## ◆ fatalErrorSAXFunc

typedef void(* fatalErrorSAXFunc) (void *ctx, const char *msg,...)

SAX callback for fatal error messages.

Parameters

  ctx | an XML parser context
  msg | the message to display/transmit
  ... | extra parameters for the message display

## ◆ getEntitySAXFunc

typedef xmlEntity *(* getEntitySAXFunc) (void *ctx, const xmlChar *name)

SAX callback to look up a general entity by name.

Parameters

  ctx | the user data (XML parser context)
  name | The entity name

Returns
  the xmlEntity if found.

## ◆ getParameterEntitySAXFunc

typedef xmlEntity *(* getParameterEntitySAXFunc) (void *ctx, const xmlChar *name)

SAX callback to look up a parameter entity by name.

Parameters

  ctx | the user data (XML parser context)
  name | The entity name

Returns
  the xmlEntity if found.

## ◆ hasExternalSubsetSAXFunc

typedef int(* hasExternalSubsetSAXFunc) (void *ctx)

SAX callback to get external subset status.

Parameters

  ctx | the user data (XML parser context)

Returns
  1 if true

## ◆ hasInternalSubsetSAXFunc

typedef int(* hasInternalSubsetSAXFunc) (void *ctx)

SAX callback to get internal subset status.

Parameters

  ctx | the user data (XML parser context)

Returns
  1 if true

## ◆ ignorableWhitespaceSAXFunc

typedef void(* ignorableWhitespaceSAXFunc) (void *ctx, const xmlChar *ch, int len)

SAX callback for "ignorable" whitespace.

Parameters

  ctx | the user data (XML parser context)
  ch | a xmlChar string
  len | the number of xmlChar

## ◆ internalSubsetSAXFunc

typedef void(* internalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)

SAX callback for the internal subset.

Parameters

  ctx | the user data (XML parser context)
  name | the root element name
  publicId | the public identifier
  systemId | the system identifier (e.g. filename or URL)

## ◆ isStandaloneSAXFunc

typedef int(* isStandaloneSAXFunc) (void *ctx)

SAX callback to get standalone status.

Parameters

  ctx | the user data (XML parser context)

Returns
  1 if true

## ◆ notationDeclSAXFunc

typedef void(* notationDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)

SAX callback for notation declarations.

Parameters

  ctx | the user data (XML parser context)
  name | The name of the notation
  publicId | The public ID of the notation
  systemId | The system ID of the notation

## ◆ processingInstructionSAXFunc

typedef void(* processingInstructionSAXFunc) (void *ctx, const xmlChar *target, const xmlChar *data)

SAX callback for processing instructions.

Parameters

  ctx | the user data (XML parser context)
  target | the target name
  data | the PI data's

## ◆ referenceSAXFunc

typedef void(* referenceSAXFunc) (void *ctx, const xmlChar *name)

SAX callback for entity references.

Parameters

  ctx | the user data (XML parser context)
  name | The entity name

## ◆ resolveEntitySAXFunc

typedef xmlParserInput *(* resolveEntitySAXFunc) (void *ctx, const xmlChar *publicId, const xmlChar *systemId)

SAX callback to resolve external entities.

This is only used to load DTDs. The preferred way to install custom resolvers is xmlCtxtSetResourceLoader.

Parameters

  ctx | the user data (XML parser context)
  publicId | The public identifier of the entity
  systemId | The system identifier of the entity (URL)

Returns
  the xmlParserInput if inlined or NULL for DOM behaviour.

## ◆ setDocumentLocatorSAXFunc

typedef void(* setDocumentLocatorSAXFunc) (void *ctx, xmlSAXLocator *loc)

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.

Parameters

  ctx | the user data (XML parser context)
  loc | A SAX Locator

## ◆ startDocumentSAXFunc

typedef void(* startDocumentSAXFunc) (void *ctx)

SAX callback for start of document.

Parameters

  ctx | the user data (XML parser context)

## ◆ startElementNsSAX2Func

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)

SAX2 callback for start tags.

It provides the namespace information for the element, as well as the new namespace declarations on the element.

Parameters

  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.

## ◆ startElementSAXFunc

typedef void(* startElementSAXFunc) (void *ctx, const xmlChar *name, const xmlChar **atts)

SAX callback for start tags.

Parameters

  ctx | the user data (XML parser context)
  name | The element name, including namespace prefix
  atts | An array of name/value attributes pairs, NULL terminated

## ◆ unparsedEntityDeclSAXFunc

typedef void(* unparsedEntityDeclSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)

SAX callback for unparsed entity declarations.

Parameters

  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

## ◆ warningSAXFunc

typedef void(* warningSAXFunc) (void *ctx, const char *msg,...)

SAX callback for warning messages.

Parameters

  ctx | an XML parser context
  msg | the message to display/transmit
  ... | extra parameters for the message display

## ◆ xmlExternalEntityLoader

typedef xmlParserInput *(* xmlExternalEntityLoader) (const char *URL, const char *publicId, xmlParserCtxt *context)

Callback for external entity loader.

The URL is not resolved using XML catalogs before being passed to the callback.

Parameters

  URL | The URL or system ID of the resource requested
  publicId | The public ID of the resource requested (optional)
  context | the XML parser context

Returns
  the entity input parser or NULL on error.

## ◆ xmlResourceLoader

typedef xmlParserErrors(* xmlResourceLoader) (void *ctxt, const char *url, const char *publicId, xmlResourceType type, xmlParserInputFlags flags, xmlParserInput **out)

Callback for custom resource loaders.

`flags` can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK.

The URL is resolved using XML catalogs before being passed to the callback.

On success, `out` should be set to a new parser input object and XML_ERR_OK should be returned.

Parameters

  ctxt | parser context
  url | URL or system ID to load
  publicId | publid ID from DTD (optional)
  type | resource type
  flags | flags
  out | result pointer

Returns
  an xmlParserErrors code.

## ◆ xmlSAXHandlerV1

typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1

SAX handler, version 1.

Deprecated:
  Use version 2 handlers.

## Enumeration Type Documentation

## ◆ xmlFeature

enum xmlFeature

Used to examine the existence of features that can be enabled or disabled at compile-time.

They used to be called XML_FEATURE_xxx but this clashed with Expat

Enumerator
XML_WITH_THREAD | Multithreading support.
XML_WITH_TREE | Deprecated: Always available
XML_WITH_OUTPUT | Serialization support.
XML_WITH_PUSH | Push parser.
XML_WITH_READER | XML Reader.
XML_WITH_PATTERN | Streaming patterns.
XML_WITH_WRITER | XML Writer.
XML_WITH_SAX1 | Legacy SAX1 API.
XML_WITH_FTP | Deprecated: FTP support was removed
XML_WITH_HTTP | Deprecated: HTTP support was removed
XML_WITH_VALID | DTD validation.
XML_WITH_HTML | HTML parser.
XML_WITH_LEGACY | Legacy symbols.
XML_WITH_C14N | Canonical XML.
XML_WITH_CATALOG | XML Catalogs.
XML_WITH_XPATH | XPath.
XML_WITH_XPTR | XPointer.
XML_WITH_XINCLUDE | XInclude.
XML_WITH_ICONV | iconv
XML_WITH_ISO8859X | Built-in ISO-8859-X.
XML_WITH_UNICODE | Deprecated: Removed
XML_WITH_REGEXP | Regular expressions.
XML_WITH_AUTOMATA | Deprecated: Same as XML_WITH_REGEXP
XML_WITH_EXPR | Deprecated: Removed
XML_WITH_SCHEMAS | XML Schemas.
XML_WITH_SCHEMATRON | Schematron.
XML_WITH_MODULES | Loadable modules.
XML_WITH_DEBUG | Debugging API.
XML_WITH_DEBUG_MEM | Deprecated: Removed
XML_WITH_DEBUG_RUN | Deprecated: Removed
XML_WITH_ZLIB | GZIP compression.
XML_WITH_ICU | ICU.
XML_WITH_LZMA | Deprecated: LZMA support was removed
XML_WITH_RELAXNG | RELAXNG, since 2.14.

## ◆ xmlParserInputFlags

enum xmlParserInputFlags

Flags for parser input.

Enumerator
XML_INPUT_BUF_STATIC | The input buffer won't be changed during parsing.
XML_INPUT_BUF_ZERO_TERMINATED | The input buffer is zero-terminated. (Note that the zero byte shouldn't be included in buffer size.)
XML_INPUT_UNZIP | Uncompress gzipped file input.
XML_INPUT_NETWORK | Allow network access. Unused internally.
XML_INPUT_USE_SYS_CATALOG | Allow system catalog to resolve URIs.

## ◆ xmlParserOption

enum xmlParserOption

This is the set of XML parser options that can be passed to xmlReadDoc, xmlCtxtSetOptions and other functions.

Enumerator
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. DTD validation is vulnerable to algorithmic complexity attacks and should never be enabled with untrusted input.
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. Deprecated: This option will be removed in a future version.
XML_PARSE_XINCLUDE | Enable XInclude processing. This option only affects the xmlTextReader and XInclude interfaces.
XML_PARSE_NONET | Disable network access with the built-in HTTP or FTP clients. After the last built-in network client was removed in 2.15, this option has no effect expect for being passed on to custom resource loaders.
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_NOXINCNODE | Don't generate XInclude start/end nodes when expanding inclusions. This option only affects the xmlTextReader and XInclude interfaces.
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. Deprecated: This option will be removed in a future version.
XML_PARSE_NOBASEFIX | Don't fix up XInclude xml:base URIs. This option only affects the xmlTextReader and XInclude interfaces.
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. Deprecated: This option will be removed in a future version.
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_NO_XXE | Disables loading of external DTDs or entities. Since 2.13.0
XML_PARSE_UNZIP | Enable input decompression. Setting this option is discouraged to avoid zip bombs. Since 2.14.0
XML_PARSE_NO_SYS_CATALOG | Disables the global system XML catalog. Since 2.14.0
XML_PARSE_CATALOG_PI | Enable XML catalog processing instructions. Since 2.14.0
XML_PARSE_SKIP_IDS | Force the parser to ignore IDs. Since 2.15.0

## ◆ xmlParserStatus

enum xmlParserStatus

Status after parsing a document.

Enumerator
XML_STATUS_NOT_WELL_FORMED | not well-formed
XML_STATUS_NOT_NS_WELL_FORMED | not namespace-well-formed
XML_STATUS_DTD_VALIDATION_FAILED | DTD validation failed.
XML_STATUS_CATASTROPHIC_ERROR | catastrophic failure like OOM or I/O error

## ◆ xmlResourceType

enum xmlResourceType

Resource type for resource loaders.

Enumerator
XML_RESOURCE_UNKNOWN | unknown
XML_RESOURCE_MAIN_DOCUMENT | main document
XML_RESOURCE_DTD | external DTD
XML_RESOURCE_GENERAL_ENTITY | external general entity
XML_RESOURCE_PARAMETER_ENTITY | external parameter entity
XML_RESOURCE_XINCLUDE | XIncluded document.
XML_RESOURCE_XINCLUDE_TEXT | XIncluded text.

## Function Documentation

## ◆ xmlByteConsumed()

long xmlByteConsumed | ( | xmlParserCtxt * | ctxt | ) |

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.

Deprecated:
  Don't use.

Parameters

  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.

## ◆ xmlCleanupGlobals()

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.

## ◆ xmlCleanupParser()

void xmlCleanupParser | ( | void |  | ) |

Free global memory allocations.

This function is named somewhat misleadingly. It does not clean up parser state but frees global memory allocated by various components of the library.

Since 2.9.11, cleanup is performed automatically on most platforms and there's no need at all for manual cleanup. This includes all compilers and platforms that support GCC-style destructor attributes as well as Windows DLLs.

This function should only be used to avoid false positives from memory leak checkers if automatic cleanup isn't possible, for example with static builds on MSVC.

WARNING: xmlCleanupParser is not thread-safe. If this function is called and any threads that could make calls into libxml2 are still running, memory corruption is likely to occur.

No library calls must be made (from any thread) after calling this function. In general, this function should only be called right before the whole process exits. Calling this function too early will lead to memory corruption.

## ◆ xmlClearNodeInfoSeq()

void xmlClearNodeInfoSeq | ( | xmlParserNodeInfoSeq * | seq | ) |

Clear (release memory and reinitialize) node info sequence.

Deprecated:
  Don't use.

Parameters

  seq | a node info sequence pointer

## ◆ xmlClearParserCtxt()

void xmlClearParserCtxt | ( | xmlParserCtxt * | ctxt | ) |

Same as xmlCtxtReset.

Deprecated:
  Use xmlCtxtReset

Parameters

  ctxt | an XML parser context

## ◆ xmlCreateDocParserCtxt()

xmlParserCtxt * xmlCreateDocParserCtxt | ( | const xmlChar * | str | ) |

Creates a parser context for an XML in-memory document.

Parameters

  str | a pointer to an array of xmlChar

Returns
  the new parser context or NULL

## ◆ xmlCreateIOParserCtxt()

xmlParserCtxt * xmlCreateIOParserCtxt | ( | xmlSAXHandler * | 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.

Parameters

  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

## ◆ xmlCreatePushParserCtxt()

xmlParserCtxt * xmlCreatePushParserCtxt | ( | xmlSAXHandler * | 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.

Parameters

  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.

## ◆ xmlCtxtGetCatalogs()

void * xmlCtxtGetCatalogs | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the local catalogs.

## ◆ xmlCtxtGetDeclaredEncoding()

const xmlChar * xmlCtxtGetDeclaredEncoding | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the encoding from the encoding declaration. This can differ from the actual encoding.

## ◆ xmlCtxtGetDict()

xmlDict * xmlCtxtGetDict | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the dictionary.

## ◆ xmlCtxtGetDocTypeDecl()

int xmlCtxtGetDocTypeDecl | ( | xmlParserCtxt * | ctxt,
|  | const xmlChar ** | name,
|  | const xmlChar ** | systemId,
|  | const xmlChar ** | publicId
| ) |  |

Return data from the doctype declaration.

Should only be used by SAX callbacks.

Since
  2.15.0

Parameters

  ctxt | parser context
  name | name of the root element (output)
  systemId | system ID (URI) of the external subset (output)
  publicId | public ID of the external subset (output)

Returns
  0 on success, -1 if argument is invalid

## ◆ xmlCtxtGetDocument()

xmlDoc * xmlCtxtGetDocument | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  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.

## ◆ xmlCtxtGetInputPosition()

int xmlCtxtGetInputPosition | ( | xmlParserCtxt * | ctxt,
|  | int | inputIndex,
|  | const char ** | filename,
|  | int * | line,
|  | int * | col,
|  | unsigned long * | utf8BytePos
| ) |  |

Return input position.

Should only be used by error handlers or SAX callbacks.

Because of entities, there can be multiple inputs. Non-negative values of `inputIndex` (0, 1, 2, ...) select inputs starting from the outermost input. Negative values (-1, -2, ...) select inputs starting from the innermost input.

The byte position is counted in possibly decoded UTF-8 bytes, so it won't match the position in the raw input data.

Since
  2.15.0

Parameters

  ctxt | parser context
  inputIndex | input index
  filename | filename (output)
  line | line number (output)
  col | column number (output)
  utf8BytePos | byte position (output)

Returns
  0 on success, -1 if arguments are invalid

## ◆ xmlCtxtGetInputWindow()

int xmlCtxtGetInputWindow | ( | xmlParserCtxt * | ctxt,
|  | int | inputIndex,
|  | const xmlChar ** | startOut,
|  | int * | sizeInOut,
|  | int * | offsetOut
| ) |  |

Return window into input data.

Should only be used by error handlers or SAX callbacks. The returned pointer is only valid until the callback returns.

Because of entities, there can be multiple inputs. Non-negative values of `inputIndex` (0, 1, 2, ...) select inputs starting from the outermost input. Negative values (-1, -2, ...) select inputs starting from the innermost input.

Since
  2.15.0

Parameters

  ctxt | parser context
  inputIndex | input index
  startOut | start of window (output)
  sizeInOut | maximum size of window (in) actual size of window (out)
  offsetOut | offset of current position inside window (out)

Returns
  0 on success, -1 if arguments are invalid

## ◆ xmlCtxtGetNode()

xmlNode * xmlCtxtGetNode | ( | xmlParserCtxt * | ctxt | ) |

Return the current node being parsed.

This is only useful if the default SAX callbacks which build a document tree are intercepted. This mode of operation is fragile and discouraged.

Returns the current element node, or the document node if no element was parsed yet.

Since
  2.15.0

Parameters

  ctxt | parser context

Returns
  the current node.

## ◆ xmlCtxtGetOptions()

int xmlCtxtGetOptions | ( | xmlParserCtxt * | ctxt | ) |

Get the current options of the parser context.

Since
  2.14.0

Parameters

  ctxt | an XML parser context

Returns
  the current options set in the parser context, or -1 if ctxt is NULL.

## ◆ xmlCtxtGetPrivate()

void * xmlCtxtGetPrivate | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the private application data.

## ◆ xmlCtxtGetSaxHandler()

xmlSAXHandler * xmlCtxtGetSaxHandler | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the SAX handler struct. This is not a copy and must not be freed. Handlers can be updated.

## ◆ xmlCtxtGetStandalone()

int xmlCtxtGetStandalone | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the value from the standalone document declaration.

## ◆ xmlCtxtGetStatus()

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.

Since
  2.14.0

Parameters

  ctxt | an XML parser context

Returns
  a bitmask of XML_STATUS_* flags ORed together.

## ◆ xmlCtxtGetUserData()

void * xmlCtxtGetUserData | ( | xmlParserCtxt * | ctxt | ) |

Return user data.

Return user data of a custom SAX parser or the parser context itself if unset.

Since
  2.15.0

Parameters

  ctxt | parser context

Returns
  the user data.

## ◆ xmlCtxtGetValidCtxt()

xmlValidCtxt * xmlCtxtGetValidCtxt | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the validation context.

## ◆ xmlCtxtGetVersion()

const xmlChar * xmlCtxtGetVersion | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  the version from the XML declaration.

## ◆ xmlCtxtIsHtml()

int xmlCtxtIsHtml | ( | xmlParserCtxt * | ctxt | ) |

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  1 if this is a HTML parser context, 0 otherwise.

## ◆ xmlCtxtIsInSubset()

int xmlCtxtIsInSubset | ( | xmlParserCtxt * | ctxt | ) |

Check whether a DTD subset is being parsed.

Should only be used by SAX callbacks.

Return values are

- 0: not in DTD
- 1: in internal DTD subset
- 2: in external DTD subset

Since
  2.15.0

Parameters

  ctxt | parser context

Returns
  the subset status

## ◆ xmlCtxtIsStopped()

int xmlCtxtIsStopped | ( | xmlParserCtxt * | ctxt | ) |

Check whether the parser is stopped.

The parser is stopped on fatal (non-wellformedness) errors or on user request with xmlStopParser.

Since
  2.14.0

Parameters

  ctxt | parser context

Returns
  1 if the parser is stopped, 0 otherwise.

## ◆ xmlCtxtParseContent()

xmlNode * xmlCtxtParseContent | ( | xmlParserCtxt * | ctxt,
|  | xmlParserInput * | input,
|  | xmlNode * | 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.

Since
  2.14.0

Parameters

  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.

## ◆ xmlCtxtParseDocument()

xmlDoc * xmlCtxtParseDocument | ( | xmlParserCtxt * | ctxt,
|  | xmlParserInput * | input
| ) |  |

Parse an XML document and return the resulting document tree.

Takes ownership of the input object.

Since
  2.13.0

Parameters

  ctxt | an XML parser context
  input | parser input

Returns
  the resulting document tree or NULL

## ◆ xmlCtxtParseDtd()

xmlDtd * xmlCtxtParseDtd | ( | xmlParserCtxt * | ctxt,
|  | xmlParserInput * | 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.

Since
  2.14.0

Parameters

  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 xmlDtd or NULL in case of error. `input` will be freed by the function in any case.

## ◆ xmlCtxtReadDoc()

xmlDoc * xmlCtxtReadDoc | ( | xmlParserCtxt * | 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.

Parameters

  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

## ◆ xmlCtxtReadFd()

xmlDoc * xmlCtxtReadFd | ( | xmlParserCtxt * | 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.

Parameters

  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

## ◆ xmlCtxtReadFile()

xmlDoc * xmlCtxtReadFile | ( | xmlParserCtxt * | ctxt,
|  | const char * | filename,
|  | const char * | encoding,
|  | int | options
| ) |  |

Parse an XML file from the filesystem or a global, user-defined resource loader.

Parameters

  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

## ◆ xmlCtxtReadIO()

xmlDoc * xmlCtxtReadIO | ( | xmlParserCtxt * | 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.

Parameters

  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

## ◆ xmlCtxtReadMemory()

xmlDoc * xmlCtxtReadMemory | ( | xmlParserCtxt * | 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.

Parameters

  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

## ◆ xmlCtxtReset()

void xmlCtxtReset | ( | xmlParserCtxt * | ctxt | ) |

Reset a parser context.

Parameters

  ctxt | an XML parser context

## ◆ xmlCtxtResetPush()

int xmlCtxtResetPush | ( | xmlParserCtxt * | ctxt,
|  | const char * | chunk,
|  | int | size,
|  | const char * | filename,
|  | const char * | encoding
| ) |  |

Reset a push parser context.

Parameters

  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

## ◆ xmlCtxtSetCatalogs()

void xmlCtxtSetCatalogs | ( | xmlParserCtxt * | ctxt,
|  | void * | catalogs
| ) |  |

Set the local catalogs.

Since
  2.14.0

Parameters

  ctxt | parser context
  catalogs | catalogs pointer

## ◆ xmlCtxtSetCharEncConvImpl()

void xmlCtxtSetCharEncConvImpl | ( | xmlParserCtxt * | 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.

Since
  2.14.0

Parameters

  ctxt | parser context
  impl | callback
  vctxt | user data

## ◆ xmlCtxtSetDict()

void xmlCtxtSetDict | ( | xmlParserCtxt * | ctxt,
|  | xmlDict * | dict
| ) |  |

Set the dictionary.

This should only be done immediately after creating a parser context.

Since
  2.14.0

Parameters

  ctxt | parser context
  dict | dictionary

## ◆ xmlCtxtSetErrorHandler()

void xmlCtxtSetErrorHandler | ( | xmlParserCtxt * | 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.

If you only want to disable parser errors being printed to stderr, use xmlParserOption XML_PARSE_NOERROR.

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

Since
  2.13.0

Parameters

  ctxt | an XML parser context
  handler | error handler
  data | data for error handler

## ◆ xmlCtxtSetMaxAmplification()

void xmlCtxtSetMaxAmplification | ( | xmlParserCtxt * | 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.

Parameters

  ctxt | an XML parser context
  maxAmpl | maximum amplification factor

## ◆ xmlCtxtSetOptions()

int xmlCtxtSetOptions | ( | xmlParserCtxt * | ctxt,
|  | int | options
| ) |  |

Applies the options to the parser context.

Unset options are cleared.

Since
  2.13.0

With older versions, you can use xmlCtxtUseOptions.

Parameters

  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.

## ◆ xmlCtxtSetPrivate()

void xmlCtxtSetPrivate | ( | xmlParserCtxt * | ctxt,
|  | void * | priv
| ) |  |

Set the private application data.

Since
  2.14.0

Parameters

  ctxt | parser context
  priv | private application data

## ◆ xmlCtxtSetResourceLoader()

void xmlCtxtSetResourceLoader | ( | xmlParserCtxt * | ctxt,
|  | xmlResourceLoader | loader,
|  | void * | vctxt
| ) |  |

Installs a custom callback to load documents, DTDs or external entities.

If `vctxt` is NULL, the parser context will be passed.

Since
  2.14.0

Parameters

  ctxt | parser context
  loader | callback
  vctxt | user data (optional)

## ◆ xmlCtxtSetSaxHandler()

int xmlCtxtSetSaxHandler | ( | xmlParserCtxt * | ctxt,
|  | const xmlSAXHandler * | sax
| ) |  |

Set the SAX handler struct to a copy of `sax`.

Since
  2.14.0

Parameters

  ctxt | parser context
  sax | SAX handler

Returns
  0 on success or -1 if arguments are invalid or a memory allocation failed.

## ◆ xmlCtxtUseOptions()

int xmlCtxtUseOptions | ( | xmlParserCtxt * | ctxt,
|  | int | options
| ) |  |

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

  Deprecated:
    Use xmlCtxtSetOptions.

Parameters

  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.

## ◆ xmlCtxtValidateDocument()

int xmlCtxtValidateDocument | ( | xmlParserCtxt * | ctxt,
|  | xmlDoc * | 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.

Since
  2.14.0

Parameters

  ctxt | a parser context
  doc | a document instance

Returns
  1 if valid or 0 otherwise.

## ◆ xmlCtxtValidateDtd()

int xmlCtxtValidateDtd | ( | xmlParserCtxt * | ctxt,
|  | xmlDoc * | doc,
|  | xmlDtd * | dtd
| ) |  |

Validate a document against a DTD.

Like xmlValidateDtd but uses the parser context's error handler.

Since
  2.14.0

Parameters

  ctxt | a parser context
  doc | a document instance
  dtd | a dtd instance

Returns
  1 if valid or 0 otherwise.

## ◆ xmlFreeParserCtxt()

void xmlFreeParserCtxt | ( | xmlParserCtxt * | ctxt | ) |

Free all the memory used by a parser context.

However the parsed document in ctxt->myDoc is not freed.

Parameters

  ctxt | an XML parser context

## ◆ xmlGetExternalEntityLoader()

xmlExternalEntityLoader xmlGetExternalEntityLoader | ( | void |  | ) |

Get the default external entity resolver function for the application.

Deprecated:
  See xmlSetExternalEntityLoader.

Returns
  the xmlExternalEntityLoader function pointer

## ◆ xmlHasFeature()

int xmlHasFeature | ( | xmlFeature | feature | ) |

Examines if the library has been compiled with a given feature.

Parameters

  feature | the feature to be examined

Returns
  zero (0) if the feature does not exist or an unknown feature is requested, non-zero otherwise.

## ◆ xmlInitGlobals()

void xmlInitGlobals | ( | void |  | ) |

Deprecated:
  Alias for xmlInitParser.

## ◆ xmlInitNodeInfoSeq()

void xmlInitNodeInfoSeq | ( | xmlParserNodeInfoSeq * | seq | ) |

Initialize (set to initial state) node info sequence.

Deprecated:
  Don't use.

Parameters

  seq | a node info sequence pointer

## ◆ xmlInitParser()

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.

## ◆ xmlInitParserCtxt()

int xmlInitParserCtxt | ( | xmlParserCtxt * | ctxt | ) |

Initialize a parser context.

Deprecated:
  Internal function which will be made private in a future version.

Parameters

  ctxt | an XML parser context

Returns
  0 in case of success and -1 in case of error

## ◆ xmlInputSetEncodingHandler()

xmlParserErrors xmlInputSetEncodingHandler | ( | xmlParserInput * | input,
|  | xmlCharEncodingHandler * | handler
| ) |  |

Use encoding handler to decode input data.

Closes the handler on error.

Parameters

  input | the input stream
  handler | the encoding handler

Returns
  an xmlParserErrors code.

## ◆ xmlIOParseDTD()

xmlDtd * xmlIOParseDTD | ( | xmlSAXHandler * | sax,
|  | xmlParserInputBuffer * | input,
|  | xmlCharEncoding | enc
| ) |  |

Load and parse a DTD.

Deprecated:
  Use xmlCtxtParseDtd.

Parameters

  sax | the SAX handler block or NULL
  input | an Input Buffer
  enc | the charset encoding if known

Returns
  the resulting xmlDtd or NULL in case of error. `input` will be freed by the function in any case.

## ◆ xmlKeepBlanksDefault()

int xmlKeepBlanksDefault | ( | int | val | ) |

Set and return the previous value for default blanks text nodes support.

Deprecated:
  Use the modern options API with XML_PARSE_NOBLANKS.

Parameters

  val | int 0 or 1

Returns
  the last value for 0 for no substitution, 1 for substitution.

## ◆ xmlLineNumbersDefault()

int xmlLineNumbersDefault | ( | int | val | ) |

Has no effect.

Deprecated:
  Line numbers are always enabled.

Parameters

  val | int 0 or 1

Returns
  1

## ◆ xmlLoadExternalEntity()

xmlParserInput * xmlLoadExternalEntity | ( | const char * | URL,
|  | const char * | publicId,
|  | xmlParserCtxt * | 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.

`publicId` 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 file opened from the filesystem, with automatic detection of compressed files if support is compiled in.

Parameters

  URL | the URL or system ID for the entity to load
  publicId | the public ID for the entity to load (optional)
  ctxt | the context in which the entity is called or NULL

Returns
  the xmlParserInput or NULL

## ◆ xmlNewInputFromFd()

xmlParserInput * xmlNewInputFromFd | ( | const char * | url,
|  | int | fd,
|  | xmlParserInputFlags | flags
| ) |  |

Creates a new parser input to read from a file descriptor.

`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.

Since
  2.14.0

Parameters

  url | base URL (optional)
  fd | file descriptor
  flags | input flags

Returns
  a new parser input or NULL if a memory allocation failed.

## ◆ xmlNewInputFromIO()

xmlParserInput * xmlNewInputFromIO | ( | const char * | url,
|  | xmlInputReadCallback | ioRead,
|  | xmlInputCloseCallback | ioClose,
|  | void * | ioCtxt,
|  | xmlParserInputFlags | flags
| ) |  |

Creates a new parser input to read from input callbacks and context.

`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.

Since
  2.14.0

Parameters

  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.

## ◆ xmlNewInputFromMemory()

xmlParserInput * 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.

Since
  2.14.0

Parameters

  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.

## ◆ xmlNewInputFromString()

xmlParserInput * 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.

Since
  2.14.0

Parameters

  url | base URL (optional)
  str | zero-terminated string
  flags | optimization hints

Returns
  a new parser input or NULL if a memory allocation failed.

## ◆ xmlNewInputFromUrl()

xmlParserErrors xmlNewInputFromUrl | ( | const char * | url,
|  | xmlParserInputFlags | flags,
|  | xmlParserInput ** | 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 file opened from the filesystem, with automatic detection of compressed files if support is compiled in.

Since
  2.14.0

Parameters

  url | the filename to use as entity
  flags | XML_INPUT flags
  out | pointer to new parser input

Returns
  an xmlParserErrors code.

## ◆ xmlNewIOInputStream()

xmlParserInput * xmlNewIOInputStream | ( | xmlParserCtxt * | ctxt,
|  | xmlParserInputBuffer * | buf,
|  | xmlCharEncoding | enc
| ) |  |

Create a new input stream structure encapsulating the `input` into a stream suitable for the parser.

Parameters

  ctxt | an XML parser context
  buf | an input buffer
  enc | the charset encoding if known

Returns
  the new input stream or NULL

## ◆ xmlNewParserCtxt()

xmlParserCtxt * xmlNewParserCtxt | ( | void |  | ) |

Allocate and initialize a new parser context.

Returns
  the xmlParserCtxt or NULL

## ◆ xmlNewSAXParserCtxt()

xmlParserCtxt * 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.

Since
  2.11.0

If you want support older versions, it's best to invoke xmlNewParserCtxt and set ctxt->sax with struct assignment.

Parameters

  sax | SAX handler
  userData | user data

Returns
  the xmlParserCtxt or NULL if memory allocation failed.

## ◆ xmlParseBalancedChunkMemory()

int xmlParseBalancedChunkMemory | ( | xmlDoc * | doc,
|  | xmlSAXHandler * | sax,
|  | void * | user_data,
|  | int | depth,
|  | const xmlChar * | string,
|  | xmlNode ** | 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)*

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Parameters

  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

## ◆ xmlParseBalancedChunkMemoryRecover()

int xmlParseBalancedChunkMemoryRecover | ( | xmlDoc * | doc,
|  | xmlSAXHandler * | sax,
|  | void * | user_data,
|  | int | depth,
|  | const xmlChar * | string,
|  | xmlNode ** | 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)*

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.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Parameters

  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.

## ◆ xmlParseChunk()

int xmlParseChunk | ( | xmlParserCtxt * | 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.

Since 2.14.0, xmlCtxtGetDocument can be used to retrieve the result document.

Parameters

  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).

## ◆ xmlParseCtxtExternalEntity()

int xmlParseCtxtExternalEntity | ( | xmlParserCtxt * | ctxt,
|  | const xmlChar * | URL,
|  | const xmlChar * | ID,
|  | xmlNode ** | 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

Parameters

  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

## ◆ xmlParseDoc()

xmlDoc * xmlParseDoc | ( | const xmlChar * | cur | ) |

Parse an XML in-memory document and build a tree.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlReadDoc.

Parameters

  cur | a pointer to an array of xmlChar

Returns
  the resulting document tree

## ◆ xmlParseDocument()

int xmlParseDocument | ( | xmlParserCtxt * | 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.

Parameters

  ctxt | an XML parser context

Returns
  0, -1 in case of error.

## ◆ xmlParseDTD()

xmlDtd * xmlParseDTD | ( | const xmlChar * | publicId,
|  | const xmlChar * | systemId
| ) |  |

Load and parse an external subset.

Parameters

  publicId | public identifier of the DTD (optional)
  systemId | system identifier (URL) of the DTD

Returns
  the resulting xmlDtd or NULL in case of error.

## ◆ xmlParseEntity()

xmlDoc * 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

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Don't use.

Parameters

  filename | the filename

Returns
  the resulting document tree

## ◆ xmlParseExternalEntity()

int xmlParseExternalEntity | ( | xmlDoc * | doc,
|  | xmlSAXHandler * | sax,
|  | void * | user_data,
|  | int | depth,
|  | const xmlChar * | URL,
|  | const xmlChar * | ID,
|  | xmlNode ** | list
| ) |  |

Parse an external general entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlParseCtxtExternalEntity.

    [78] extParsedEnt ::= TextDecl? content

Parameters

  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

## ◆ xmlParseExtParsedEnt()

int xmlParseExtParsedEnt | ( | xmlParserCtxt * | ctxt | ) |

Parse a general parsed entity An external general parsed entity is well-formed if it matches the production labeled extParsedEnt.

Deprecated:
  Internal function, don't use.

    [78] extParsedEnt ::= TextDecl? content

Parameters

  ctxt | an XML parser context

Returns
  0, -1 in case of error. the parser context is augmented as a result of the parsing.

## ◆ xmlParseFile()

xmlDoc * xmlParseFile | ( | const char * | filename | ) |

Parse an XML file and build a tree.

Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlReadFile.

Parameters

  filename | the filename

Returns
  the resulting document tree if the file was wellformed, NULL otherwise.

## ◆ xmlParseInNodeContext()

xmlParserErrors xmlParseInNodeContext | ( | xmlNode * | node,
|  | const char * | data,
|  | int | datalen,
|  | int | options,
|  | xmlNode ** | 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.

Parameters

  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

## ◆ xmlParseMemory()

xmlDoc * xmlParseMemory | ( | const char * | buffer,
|  | int | size
| ) |  |

Parse an XML in-memory block and build a tree.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlReadMemory.

Parameters

  buffer | an pointer to a char array
  size | the size of the array

Returns
  the resulting document tree

## ◆ xmlParserAddNodeInfo()

void xmlParserAddNodeInfo | ( | xmlParserCtxt * | ctxt,
|  | xmlParserNodeInfo * | info
| ) |  |

Insert node info record into the sorted sequence.

Deprecated:
  Don't use.

Parameters

  ctxt | an XML parser context
  info | a node info sequence pointer

## ◆ xmlParserFindNodeInfo()

const xmlParserNodeInfo * xmlParserFindNodeInfo | ( | xmlParserCtxt * | ctx,
|  | xmlNode * | node
| ) |  |

Find the parser node info struct for a given node.

Deprecated:
  Don't use.

Parameters

  ctx | an XML parser context
  node | an XML node within the tree

Returns
  an xmlParserNodeInfo block pointer or NULL

## ◆ xmlParserFindNodeInfoIndex()

unsigned long xmlParserFindNodeInfoIndex | ( | xmlParserNodeInfoSeq * | seq,
|  | xmlNode * | node
| ) |  |

Find the index that the info record for the given node is or should be at in a sorted sequence.

Deprecated:
  Don't use.

Parameters

  seq | a node info sequence pointer
  node | an XML node pointer

Returns
  a long indicating the position of the record

## ◆ xmlParserInputGrow()

int xmlParserInputGrow | ( | xmlParserInput * | in,
|  | int | len
| ) |  |

This function increase the input for the parser.

It tries to preserve pointers to the input buffer, and keep already read data

Deprecated:
  Don't use.

Parameters

  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

## ◆ xmlParserInputRead()

int xmlParserInputRead | ( | xmlParserInput * | in,
|  | int | len
| ) |  |

Deprecated:
  This function was internal and is deprecated.

Parameters

  in | an XML parser input
  len | an indicative size for the lookahead

Returns
  -1 as this is an error to use it.

## ◆ xmlPedanticParserDefault()

int xmlPedanticParserDefault | ( | int | val | ) |

Set and return the previous value for enabling pedantic warnings.

Deprecated:
  Use the modern options API with XML_PARSE_PEDANTIC.

Parameters

  val | int 0 or 1

Returns
  the last value for 0 for no substitution, 1 for substitution.

## ◆ xmlReadDoc()

xmlDoc * 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.

Parameters

  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

## ◆ xmlReadFd()

xmlDoc * 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.

Parameters

  fd | an open file descriptor
  URL | base URL (optional)
  encoding | the document encoding (optional)
  options | a combination of xmlParserOption

Returns
  the resulting document tree

## ◆ xmlReadFile()

xmlDoc * xmlReadFile | ( | const char * | filename,
|  | const char * | encoding,
|  | int | options
| ) |  |

Convenience function to parse an XML file from the filesystem or a global, user-defined resource loader.

If a "-" filename is passed, the function will read from stdin. This feature is potentially insecure and might be removed from later versions.

See xmlCtxtReadFile for details.

Parameters

  filename | a file or URL
  encoding | the document encoding (optional)
  options | a combination of xmlParserOption

Returns
  the resulting document tree

## ◆ xmlReadIO()

xmlDoc * 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.

Parameters

  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

## ◆ xmlReadMemory()

xmlDoc * 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.

Parameters

  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

## ◆ xmlRecoverDoc()

xmlDoc * xmlRecoverDoc | ( | const xmlChar * | cur | ) |

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

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT | XML_PARSE_RECOVER.

Deprecated:
  Use xmlReadDoc with XML_PARSE_RECOVER.

Parameters

  cur | a pointer to an array of xmlChar

Returns
  the resulting document tree or NULL in case of failure

## ◆ xmlRecoverFile()

xmlDoc * xmlRecoverFile | ( | const char * | filename | ) |

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

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT | XML_PARSE_RECOVER.

Deprecated:
  Use xmlReadFile with XML_PARSE_RECOVER.

Parameters

  filename | the filename

Returns
  the resulting document tree or NULL in case of failure

## ◆ xmlRecoverMemory()

xmlDoc * xmlRecoverMemory | ( | const char * | buffer,
|  | int | size
| ) |  |

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

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT | XML_PARSE_RECOVER.

Deprecated:
  Use xmlReadMemory with XML_PARSE_RECOVER.

Parameters

  buffer | an pointer to a char array
  size | the size of the array

Returns
  the resulting document tree or NULL in case of error

## ◆ xmlSAXParseDoc()

xmlDoc * xmlSAXParseDoc | ( | xmlSAXHandler * | sax,
|  | const xmlChar * | cur,
|  | int | recovery
| ) |  |

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.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadDoc.

Parameters

  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

## ◆ xmlSAXParseDTD()

xmlDtd * xmlSAXParseDTD | ( | xmlSAXHandler * | sax,
|  | const xmlChar * | publicId,
|  | const xmlChar * | systemId
| ) |  |

Load and parse an external subset.

Deprecated:
  Use xmlCtxtParseDtd.

Parameters

  sax | the SAX handler block
  publicId | public identifier of the DTD (optional)
  systemId | system identifier (URL) of the DTD

Returns
  the resulting xmlDtd or NULL in case of error.

## ◆ xmlSAXParseEntity()

xmlDoc * xmlSAXParseEntity | ( | xmlSAXHandler * | sax,
|  | const char * | filename
| ) |  |

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.

Deprecated:
  Don't use.

    [78] extParsedEnt ::= TextDecl? content

This correspond to a "Well Balanced" chunk

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Parameters

  sax | the SAX handler block
  filename | the filename

Returns
  the resulting document tree

## ◆ xmlSAXParseFile()

xmlDoc * xmlSAXParseFile | ( | xmlSAXHandler * | sax,
|  | const char * | filename,
|  | int | recovery
| ) |  |

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.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadFile.

Parameters

  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

## ◆ xmlSAXParseFileWithData()

xmlDoc * xmlSAXParseFileWithData | ( | xmlSAXHandler * | sax,
|  | const char * | filename,
|  | int | recovery,
|  | void * | data
| ) |  |

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.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadFile.

User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml

Parameters

  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

## ◆ xmlSAXParseMemory()

xmlDoc * xmlSAXParseMemory | ( | xmlSAXHandler * | sax,
|  | const char * | buffer,
|  | int | size,
|  | int | recovery
| ) |  |

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.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.

Parameters

  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

## ◆ xmlSAXParseMemoryWithData()

xmlDoc * xmlSAXParseMemoryWithData | ( | xmlSAXHandler * | sax,
|  | const char * | buffer,
|  | int | size,
|  | int | recovery,
|  | void * | data
| ) |  |

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.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.

User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml

Parameters

  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

## ◆ xmlSAXUserParseFile()

int xmlSAXUserParseFile | ( | xmlSAXHandler * | sax,
|  | void * | user_data,
|  | const char * | filename
| ) |  |

Parse an XML file and call the given SAX handler routines.

Automatic support for ZLIB/Compress compressed document is provided

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadFile.

Parameters

  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

## ◆ xmlSAXUserParseMemory()

int xmlSAXUserParseMemory | ( | xmlSAXHandler * | sax,
|  | void * | user_data,
|  | const char * | buffer,
|  | int | size
| ) |  |

Parse an XML in-memory buffer and call the given SAX handler routines.

This function uses deprecated global variables to set parser options which default to XML_PARSE_NODICT.

Deprecated:
  Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.

Parameters

  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

## ◆ xmlSetExternalEntityLoader()

void xmlSetExternalEntityLoader | ( | xmlExternalEntityLoader | f | ) |

Changes the default external entity resolver function for the application.

Deprecated:
  This is a global setting and not thread-safe. Use xmlCtxtSetResourceLoader or similar functions.

Parameters

  f | the new entity resolver function

## ◆ xmlSetupParserForBuffer()

void xmlSetupParserForBuffer | ( | xmlParserCtxt * | ctxt,
|  | const xmlChar * | buffer,
|  | const char * | filename
| ) |  |

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

Deprecated:
  Don't use.

Parameters

  ctxt | an XML parser context
  buffer | a xmlChar * buffer
  filename | a file name

## ◆ xmlStopParser()

void xmlStopParser | ( | xmlParserCtxt * | ctxt | ) |

Blocks further parser processing.

Parameters

  ctxt | an XML parser context

## ◆ xmlSubstituteEntitiesDefault()

int xmlSubstituteEntitiesDefault | ( | int | val | ) |

Set and return the previous value for default entity support.

Deprecated:
  Use the modern options API with XML_PARSE_NOENT.

Parameters

  val | int 0 or 1

Returns
  the last value for 0 for no substitution, 1 for substitution.

## ◆ xmlThrDefDoValidityCheckingDefaultValue()

int xmlThrDefDoValidityCheckingDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Use xmlParserOption XML_PARSE_DTDVALID.

Parameters

  v | new value

Returns
  the old value

## ◆ xmlThrDefGetWarningsDefaultValue()

int xmlThrDefGetWarningsDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Use xmlParserOption XML_PARSE_NOWARNING.

Parameters

  v | new value

Returns
  the old value

## ◆ xmlThrDefKeepBlanksDefaultValue()

int xmlThrDefKeepBlanksDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Whitespace is kept by default. Use xmlParserOption XML_PARSE_NOBLANKS to remove whitespace.

Parameters

  v | new value

Returns
  the old value

## ◆ xmlThrDefLineNumbersDefaultValue()

int xmlThrDefLineNumbersDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Has no effect.

Parameters

  v | unused

Returns
  1

## ◆ xmlThrDefLoadExtDtdDefaultValue()

int xmlThrDefLoadExtDtdDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Use xmlParserOption XML_PARSE_DTDLOAD.

Parameters

  v | new value

Returns
  the old value

## ◆ xmlThrDefPedanticParserDefaultValue()

int xmlThrDefPedanticParserDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Use xmlParserOption XML_PARSE_PEDANTIC.

Parameters

  v | new value

Returns
  the old value

## ◆ xmlThrDefSubstituteEntitiesDefaultValue()

int xmlThrDefSubstituteEntitiesDefaultValue | ( | int | v | ) |

Set per-thread default value.

Deprecated:
  Use xmlParserOption XML_PARSE_NOENT.

Parameters

  v | new value

Returns
  the old value