libxml2_parser.h File Reference

XML_DEFAULT_VERSION

XML_DEFAULT_VERSION:

The default version of XML used: 1.0

Typedef xmlParserInputDeallocate

typedef void(*xmlParserInputDeallocate

xmlParserInput:

An xmlParserInput is an input flow for the XML processor. Each entity parsed is associated an xmlParserInput (except the few predefined ones). This is the case both for internal entities
  • in which case the flow is already completely in memory - or external entities - in which case we use the buf structure for progressive reading and I18N conversions to the internal UTF-8 format. xmlParserInputDeallocate: Callback for freeing some parser input allocations.

Typedef xmlParserNodeInfo

typedef struct _xmlParserNodeInfoxmlParserNodeInfo

xmlParserNodeInfo:

The parser can be asked to collect Node informations, i.e. at what place in the file they were detected. NOTE: This is off by default and not very well tested.

Typedef xmlParserNodeInfoPtr

typedef xmlParserNodeInfo *xmlParserNodeInfoPtr

Typedef xmlParserNodeInfoSeq

typedef struct _xmlParserNodeInfoSeqxmlParserNodeInfoSeq

Typedef xmlParserNodeInfoSeqPtr

typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr

XML_DETECT_IDS

XML_DETECT_IDS:

Bit in the loadsubset context field to tell to do ID/REFs lookups. Use it to initialize xmlLoadExtDtdDefaultValue.

XML_COMPLETE_ATTRS

XML_COMPLETE_ATTRS:

Bit in the loadsubset context field to tell to do complete the elements attributes lists with the ones defaulted from the DTDs. Use it to initialize xmlLoadExtDtdDefaultValue.

XML_SKIP_IDS

XML_SKIP_IDS:

Bit in the loadsubset context field to tell to not do ID/REFs registration. Used to initialize xmlLoadExtDtdDefaultValue in some special cases.

Typedef resolveEntitySAXFunc

typedef xmlParserInputPtr(*resolveEntitySAXFunc

xmlSAXHandler:

A SAX handler is bunch of callbacks called by the parser when processing of the input generate data or structure informations. resolveEntitySAXFunc: Callback: The entity loader, to control the loading of external entities, the application can either:

Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.

Typedef internalSubsetSAXFunc

typedef void(*internalSubsetSAXFunc

internalSubsetSAXFunc: Callback on internal subset declaration.

Typedef externalSubsetSAXFunc

typedef void(*externalSubsetSAXFunc

externalSubsetSAXFunc: Callback on external subset declaration.

Typedef getEntitySAXFunc

typedef xmlEntityPtr(*getEntitySAXFunc

getEntitySAXFunc: Get an entity by name.

Returns the xmlEntityPtr if found.

Typedef getParameterEntitySAXFunc

typedef xmlEntityPtr(*getParameterEntitySAXFunc

getParameterEntitySAXFunc: Get a parameter entity by name.

Returns the xmlEntityPtr if found.

Typedef entityDeclSAXFunc

typedef void(*entityDeclSAXFunc

entityDeclSAXFunc: An entity definition has been parsed.

Typedef notationDeclSAXFunc

typedef void(*notationDeclSAXFunc

notationDeclSAXFunc: What to do when a notation declaration has been parsed.

Typedef attributeDeclSAXFunc

typedef void(*attributeDeclSAXFunc

attributeDeclSAXFunc: An attribute definition has been parsed.

Typedef elementDeclSAXFunc

typedef void(*elementDeclSAXFunc

elementDeclSAXFunc: An element definition has been parsed.

Typedef unparsedEntityDeclSAXFunc

typedef void(*unparsedEntityDeclSAXFunc

unparsedEntityDeclSAXFunc: What to do when an unparsed entity declaration is parsed.

Typedef setDocumentLocatorSAXFunc

typedef void(*setDocumentLocatorSAXFunc

setDocumentLocatorSAXFunc: Receive the document locator at startup, actually xmlDefaultSAXLocator. Everything is available on the context, so this is useless in our case.

Typedef startDocumentSAXFunc

typedef void(*startDocumentSAXFunc

startDocumentSAXFunc: Called when the document start being processed.

Typedef endDocumentSAXFunc

typedef void(*endDocumentSAXFunc

endDocumentSAXFunc: Called when the document end has been detected.

Typedef startElementSAXFunc

typedef void(*startElementSAXFunc

startElementSAXFunc: Called when an opening tag has been processed.

Typedef endElementSAXFunc

typedef void(*endElementSAXFunc

endElementSAXFunc: Called when the end of an element has been detected.

Typedef attributeSAXFunc

typedef void(*attributeSAXFunc

attributeSAXFunc: Handle an attribute that has been read by the parser. The default handling is to convert the attribute into an DOM subtree and past it in a new xmlAttr element added to the element.

Typedef referenceSAXFunc

typedef void(*referenceSAXFunc

referenceSAXFunc: Called when an entity reference is detected.

Typedef charactersSAXFunc

typedef void(*charactersSAXFunc

charactersSAXFunc: Receiving some chars from the parser.

Typedef ignorableWhitespaceSAXFunc

typedef void(*ignorableWhitespaceSAXFunc

ignorableWhitespaceSAXFunc: Receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use characters.

Typedef processingInstructionSAXFunc

typedef void(*processingInstructionSAXFunc

processingInstructionSAXFunc: A processing instruction has been parsed.

Typedef commentSAXFunc

typedef void(*commentSAXFunc

commentSAXFunc: A comment has been parsed.

Typedef cdataBlockSAXFunc

typedef void(*cdataBlockSAXFunc

cdataBlockSAXFunc: Called when a pcdata block has been parsed.

Typedef warningSAXFunc

typedef void(*warningSAXFunc

warningSAXFunc: Display and format a warning messages, callback.

Typedef errorSAXFunc

typedef void(*errorSAXFunc

errorSAXFunc: Display and format an error messages, callback.

Typedef fatalErrorSAXFunc

typedef void(*fatalErrorSAXFunc

fatalErrorSAXFunc: Display and format fatal error messages, callback. Note: so far fatalError() SAX callbacks are not used, error() get all the callbacks for errors.

Typedef isStandaloneSAXFunc

typedef int(*isStandaloneSAXFunc

isStandaloneSAXFunc: Is this document tagged standalone?

Returns 1 if true

Typedef hasInternalSubsetSAXFunc

typedef int(*hasInternalSubsetSAXFunc

hasInternalSubsetSAXFunc: Does this document has an internal subset.

Returns 1 if true

Typedef hasExternalSubsetSAXFunc

typedef int(*hasExternalSubsetSAXFunc

hasExternalSubsetSAXFunc: Does this document has an external subset?

Returns 1 if true

XML_SAX2_MAGIC

XML_SAX2_MAGIC:

Special constant found in SAX2 blocks initialized fields

Typedef startElementNsSAX2Func

typedef void(*startElementNsSAX2Func

startElementNsSAX2Func: SAX2 callback when an element start has been detected by the parser. It provides the namespace informations for the element, as well as the new namespace declarations on the element.

Typedef endElementNsSAX2Func

typedef void(*endElementNsSAX2Func

endElementNsSAX2Func: SAX2 callback when an element end has been detected by the parser. It provides the namespace informations for the element.

Typedef startPrefixMappingSAX2Func

typedef void(*startPrefixMappingSAX2Func

startPrefixMappingSAX2Func: SAX2 callback when namespace prefix mapping is done.

Typedef endPrefixMappingSAX2Func

typedef void(*endPrefixMappingSAX2Func

endPrefixMappingSAX2Func: SAX2 callback when namespace prefix mapping is getting out of scope.

Typedef xmlSAXHandlerV1

typedef struct _xmlSAXHandlerV1xmlSAXHandlerV1

Typedef xmlSAXHandlerV1Ptr

typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr

Typedef xmlExternalEntityLoader

typedef xmlParserInputPtr(*xmlExternalEntityLoader

xmlExternalEntityLoader: External entity loaders types.

Returns the entity input parser.

xmlInitParser ( void )

XMLPUBFUN void XMLCALLxmlInitParser(void)

xmlInitParser:

Initialization function for the XML parser. This is not reentrant. Call once before processing in case of use in multithreaded programs.

OOM: possible --> OOM flag is set

xmlCleanupParser ( void )

XMLPUBFUN void XMLCALLxmlCleanupParser(void)

xmlCleanupParser:

Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn't deallocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it.

OOM: never

xmlParserInputRead ( xmlParserInputPtr, int )

XMLPUBFUN int XMLCALLxmlParserInputRead(xmlParserInputPtrin,
intlen
)

xmlParserInputRead: This function refresh the input for the parser. It doesn't try to preserve pointers to the input buffer, and discard already read data

Returns the number of xmlChars read, or -1 in case of error, 0 indicate the end of this entity

Parameters
inan XML parser input
lenan indicative size for the lookahead

xmlParserInputGrow ( xmlParserInputPtr, int )

XMLPUBFUN int XMLCALLxmlParserInputGrow(xmlParserInputPtrin,
intlen
)

xmlParserInputGrow: This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data

Returns the number of xmlChars read, or -1 in case of error, 0 indicate the end of this entity

OOM: possible --> OOM flag is set when returns -1

Parameters
inan XML parser input
lenan indicative size for the lookahead

xmlParseDoc ( xmlChar * )

XMLPUBFUN xmlDocPtr XMLCALLxmlParseDoc(xmlChar *cur)

xmlParseDoc: parse an XML in-memory document and build a tree.

Returns the resulting document tree

Parameters
cura pointer to an array of xmlChar

xmlParseMemory ( const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlParseMemory(const char *buffer,
intsize
)

xmlParseMemory: parse an XML in-memory block and build a tree.

Returns the resulting document tree

Parameters
bufferan pointer to a char array
sizethe size of the array

xmlParseFile ( const char * )

XMLPUBFUN xmlDocPtr XMLCALLxmlParseFile(const char *filename)

xmlParseFile: parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.

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

Parameters
filenamethe filename

xmlSubstituteEntitiesDefault ( int )

XMLPUBFUN int XMLCALLxmlSubstituteEntitiesDefault(intval)

xmlSubstituteEntitiesDefault: Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.

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

Parameters
valint 0 or 1

xmlKeepBlanksDefault ( int )

XMLPUBFUN int XMLCALLxmlKeepBlanksDefault(intval)

xmlKeepBlanksDefault: Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the "empty" nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.

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

Parameters
valint 0 or 1

xmlLineNumbersDefault ( int )

XMLPUBFUN int XMLCALLxmlLineNumbersDefault(intval)

xmlStopParser ( xmlParserCtxtPtr )

XMLPUBFUN void XMLCALLxmlStopParser(xmlParserCtxtPtrctxt)

xmlPedanticParserDefault ( int )

XMLPUBFUN int XMLCALLxmlPedanticParserDefault(intval)

xmlPedanticParserDefault: Set and return the previous value for enabling pedantic warnings.

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

Parameters
valint 0 or 1

xmlRecoverDoc ( xmlChar * )

XMLPUBFUN xmlDocPtr XMLCALLxmlRecoverDoc(xmlChar *cur)

xmlRecoverDoc: parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a tree is built anyway

Returns the resulting document tree

Parameters
cura pointer to an array of xmlChar

xmlRecoverMemory ( const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlRecoverMemory(const char *buffer,
intsize
)

xmlRecoverMemory: parse an XML in-memory block and build a tree. In the case the document is not Well Formed, a tree is built anyway

Returns the resulting document tree

Parameters
bufferan pointer to a char array
sizethe size of the array

xmlRecoverFile ( const char * )

XMLPUBFUN xmlDocPtr XMLCALLxmlRecoverFile(const char *filename)

xmlRecoverFile: 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, a tree is built anyway

Returns the resulting document tree

Parameters
filenamethe filename

xmlParseDocument ( xmlParserCtxtPtr )

XMLPUBFUN int XMLCALLxmlParseDocument(xmlParserCtxtPtrctxt)

xmlParseDocument: parse an XML document (and build a tree if using the standard SAX interface).

[1] document ::= prolog element Misc*

[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?

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

OOM: possible, of course --> check OOM flag [REVIEW NOT FINISHED]

Parameters
ctxtan XML parser context

xmlParseExtParsedEnt ( xmlParserCtxtPtr )

XMLPUBFUN int XMLCALLxmlParseExtParsedEnt(xmlParserCtxtPtrctxt)

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

[78] extParsedEnt ::= TextDecl? content

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

Parameters
ctxtan XML parser context

xmlSAXParseDoc ( xmlSAXHandlerPtr, xmlChar *, int, int, int * )

XMLPUBFUN xmlDocPtr XMLCALLxmlSAXParseDoc(xmlSAXHandlerPtrsax,
xmlChar *cur,
intlength,
intrecovery,
int *errorCode
)

xmlSAXParseDoc: 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.

Returns the resulting document tree

OOM: possible --> OOM flag is set (and NULL is returned too)

Parameters
saxthe SAX handler block
cura pointer to an array of xmlChar
lengthsize (bytes) of the array (0 if it should be calculated)
recoverywork in recovery mode, i.e. tries to read no Well Formed documents
errorCodelast error code is recorded, 0 is no errors

xmlSAXUserParseFile ( xmlSAXHandlerPtr, void *, const char * )

XMLPUBFUN int XMLCALLxmlSAXUserParseFile(xmlSAXHandlerPtrsax,
void *user_data,
const char *filename
)

xmlSAXUserParseFile: parse an XML file and call the given SAX handler routines. Automatic support for ZLIB/Compress compressed document is provided

Returns 0 in case of success or a error number otherwise

Parameters
saxa SAX handler
user_dataThe user data returned on SAX callbacks
filenamea file name

xmlSAXUserParseMemory ( xmlSAXHandlerPtr, void *, const char *, int )

XMLPUBFUN int XMLCALLxmlSAXUserParseMemory(xmlSAXHandlerPtrsax,
void *user_data,
const char *buffer,
intsize
)

xmlSAXUserParseMemory: A better SAX parsing routine. parse an XML in-memory buffer and call the given SAX handler routines.

Returns 0 in case of success or a error number otherwise

Parameters
saxa SAX handler
user_dataThe user data returned on SAX callbacks
bufferan in-memory XML document input
sizethe length of the XML document in bytes

xmlSAXParseMemory ( xmlSAXHandlerPtr, const char *, int, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlSAXParseMemory(xmlSAXHandlerPtrsax,
const char *buffer,
intsize,
intrecovery
)

xmlSAXParseMemory: 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.

Returns the resulting document tree

Parameters
saxthe SAX handler block
bufferan pointer to a char array
sizethe size of the array
recoverywork in recovery mode, i.e. tries to read not Well Formed documents

xmlSAXParseMemoryWithData ( xmlSAXHandlerPtr, const char *, int, int, void * )

XMLPUBFUN xmlDocPtr XMLCALLxmlSAXParseMemoryWithData(xmlSAXHandlerPtrsax,
const char *buffer,
intsize,
intrecovery,
void *data
)

xmlSAXParseMemoryWithData: parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.

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

Returns the resulting document tree

Parameters
saxthe SAX handler block
bufferan pointer to a char array
sizethe size of the array
recoverywork in recovery mode, i.e. tries to read no Well Formed documents
datathe userdata

xmlSAXParseFile ( xmlSAXHandlerPtr, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlSAXParseFile(xmlSAXHandlerPtrsax,
const char *filename,
intrecovery
)

xmlSAXParseFile: 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.

Returns the resulting document tree

Parameters
saxthe SAX handler block
filenamethe filename
recoverywork in recovery mode, i.e. tries to read no Well Formed documents

xmlSAXParseFileWithData ( xmlSAXHandlerPtr, const char *, int, void * )

XMLPUBFUN xmlDocPtr XMLCALLxmlSAXParseFileWithData(xmlSAXHandlerPtrsax,
const char *filename,
intrecovery,
void *data
)

xmlSAXParseFileWithData: parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.

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

Returns the resulting document tree

Parameters
saxthe SAX handler block
filenamethe filename
recoverywork in recovery mode, i.e. tries to read no Well Formed documents
datathe userdata

xmlSAXParseEntity ( xmlSAXHandlerPtr, const char * )

XMLPUBFUN xmlDocPtr XMLCALLxmlSAXParseEntity(xmlSAXHandlerPtrsax,
const char *filename
)

xmlParseEntity ( const char * )

XMLPUBFUN xmlDocPtr XMLCALLxmlParseEntity(const char *filename)

xmlParseDTD ( const xmlChar *, const xmlChar * )

XMLPUBFUN xmlDtdPtr XMLCALLxmlParseDTD(const xmlChar *ExternalID,
const xmlChar *SystemID
)

xmlSAXParseDTD ( xmlSAXHandlerPtr, const xmlChar *, const xmlChar * )

XMLPUBFUN xmlDtdPtr XMLCALLxmlSAXParseDTD(xmlSAXHandlerPtrsax,
const xmlChar *ExternalID,
const xmlChar *SystemID
)

xmlIOParseDTD ( xmlSAXHandlerPtr, xmlParserInputBufferPtr, xmlCharEncoding )

XMLPUBFUN xmlDtdPtr XMLCALLxmlIOParseDTD(xmlSAXHandlerPtrsax,
xmlParserInputBufferPtrinput,
xmlCharEncodingenc
)

xmlParseBalancedChunkMemory ( xmlDocPtr, xmlSAXHandlerPtr, void *, int, const xmlChar *, xmlNodePtr * )

XMLPUBFUN int XMLCALLxmlParseBalancedChunkMemory(xmlDocPtrdoc,
xmlSAXHandlerPtrsax,
void *user_data,
intdepth,
const xmlChar *string,
xmlNodePtr *lst
)

xmlParseInNodeContext ( xmlNodePtr, const char *, int, int, xmlNodePtr * )

XMLPUBFUN xmlParserErrors XMLCALLxmlParseInNodeContext(xmlNodePtrnode,
const char *data,
intdatalen,
intoptions,
xmlNodePtr *lst
)

xmlParseInNodeContext: 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)*

Returns XML_ERR_OK if the chunk is well balanced, and the parser error code otherwise

Parameters
nodethe context node
datathe input string
datalenthe input string length in bytes
optionsa combination of xmlParserOption
lstthe return value for the set of parsed nodes

xmlParseBalancedChunkMemoryRecover ( xmlDocPtr, xmlSAXHandlerPtr, void *, int, const xmlChar *, xmlNodePtr *, int )

XMLPUBFUN int XMLCALLxmlParseBalancedChunkMemoryRecover(xmlDocPtrdoc,
xmlSAXHandlerPtrsax,
void *user_data,
intdepth,
const xmlChar *string,
xmlNodePtr *lst,
intrecover
)

xmlParseExternalEntity ( xmlDocPtr, xmlSAXHandlerPtr, void *, int, const xmlChar *, const xmlChar *, xmlNodePtr * )

XMLPUBFUN int XMLCALLxmlParseExternalEntity(xmlDocPtrdoc,
xmlSAXHandlerPtrsax,
void *user_data,
intdepth,
const xmlChar *URL,
const xmlChar *ID,
xmlNodePtr *lst
)

xmlParseCtxtExternalEntity ( xmlParserCtxtPtr, const xmlChar *, const xmlChar *, xmlNodePtr * )

XMLPUBFUN int XMLCALLxmlParseCtxtExternalEntity(xmlParserCtxtPtrctx,
const xmlChar *URL,
const xmlChar *ID,
xmlNodePtr *lst
)

xmlParseCtxtExternalEntity: 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

Returns 0 if the entity is well formed, -1 in case of args problem and the parser error code otherwise

Parameters
ctxthe existing parsing context
URLthe URL for the entity to load
IDthe System ID for the entity to load
lstthe return value for the set of parsed nodes

xmlNewParserCtxt ( void )

XMLPUBFUN xmlParserCtxtPtr XMLCALLxmlNewParserCtxt(void)

xmlNewParserCtxt:

Allocate and initialize a new parser context.

Returns the xmlParserCtxtPtr or NULL

OOM: possible --> returns NULL, OOM flag is set

xmlInitParserCtxt ( xmlParserCtxtPtr )

XMLPUBFUN int XMLCALLxmlInitParserCtxt(xmlParserCtxtPtrctxt)

xmlInitParserCtxt: Initialize a parser context

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

OOM: possible --> returns -1; OOM flag is set

Parameters
ctxtan XML parser context

xmlClearParserCtxt ( xmlParserCtxtPtr )

XMLPUBFUN void XMLCALLxmlClearParserCtxt(xmlParserCtxtPtrctxt)

xmlClearParserCtxt: Clear (release owned resources) and reinitialize a parser context

Parameters
ctxtan XML parser context

xmlFreeParserCtxt ( xmlParserCtxtPtr )

XMLPUBFUN void XMLCALLxmlFreeParserCtxt(xmlParserCtxtPtrctxt)

xmlFreeParserCtxt: Free all the memory used by a parser context. However the parsed document in ctxt->myDoc is not freed.

OOM: never

Parameters
ctxtan XML parser context

xmlSetupParserForBuffer ( xmlParserCtxtPtr, const xmlChar *, const char * )

XMLPUBFUN void XMLCALLxmlSetupParserForBuffer(xmlParserCtxtPtrctxt,
const xmlChar *buffer,
const char *filename
)

xmlSetupParserForBuffer: 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

Parameters
ctxtan XML parser context
buffera xmlChar * buffer
filenamea file name

xmlCreateDocParserCtxt ( const xmlChar *, int )

XMLPUBFUN xmlParserCtxtPtr XMLCALLxmlCreateDocParserCtxt(const xmlChar *cur,
intlength
)

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

Returns the new parser context or NULL

OOM: possible --> returns NULL for cur!=NULL && length>0; OOM flag is set

Parameters
cura pointer to an array of xmlChar
lengthsize (bytes) of the array (0 if it should be calculated)

xmlGetFeaturesList ( int *, const char ** )

XMLPUBFUN int XMLCALLxmlGetFeaturesList(int *len,
const char **result
)

xmlGetFeature ( xmlParserCtxtPtr, const char *, void * )

XMLPUBFUN int XMLCALLxmlGetFeature(xmlParserCtxtPtrctxt,
const char *name,
void *result
)

xmlSetFeature ( xmlParserCtxtPtr, const char *, void * )

XMLPUBFUN int XMLCALLxmlSetFeature(xmlParserCtxtPtrctxt,
const char *name,
void *value
)

xmlCreateIOParserCtxt ( xmlSAXHandlerPtr, void *, xmlInputReadCallback, xmlInputCloseCallback, void *, xmlCharEncoding )

XMLPUBFUN xmlParserCtxtPtr XMLCALLxmlCreateIOParserCtxt(xmlSAXHandlerPtrsax,
void *user_data,
xmlInputReadCallbackioread,
xmlInputCloseCallbackioclose,
void *ioctx,
xmlCharEncodingenc
)

xmlCreateIOParserCtxt: Create a parser context for using the XML parser with an existing I/O stream

Returns the new parser context or NULL

Parameters
saxa SAX handler
user_dataThe user data returned on SAX callbacks
ioreadan I/O read function
ioclosean I/O close function
ioctxan I/O handler
encthe charset encoding if known

xmlNewIOInputStream ( xmlParserCtxtPtr, xmlParserInputBufferPtr, xmlCharEncoding )

XMLPUBFUN xmlParserInputPtr XMLCALLxmlNewIOInputStream(xmlParserCtxtPtrctxt,
xmlParserInputBufferPtrinput,
xmlCharEncodingenc
)

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

Returns the new input stream or NULL

Parameters
ctxtan XML parser context
inputan I/O Input
encthe charset encoding if known

xmlSetExternalEntityLoader ( xmlExternalEntityLoader )

XMLPUBFUN void XMLCALLxmlSetExternalEntityLoader(xmlExternalEntityLoaderf)

xmlSetExternalEntityLoader: Changes the defaultexternal entity resolver function for the application

Parameters
fthe new entity resolver function

xmlGetExternalEntityLoader ( void )

XMLPUBFUN xmlExternalEntityLoader XMLCALLxmlGetExternalEntityLoader(void)

xmlGetExternalEntityLoader:

Get the default external entity resolver function for the application

Returns the xmlExternalEntityLoader function pointer

xmlLoadExternalEntity ( const char *, const char *, xmlParserCtxtPtr )

XMLPUBFUN xmlParserInputPtr XMLCALLxmlLoadExternalEntity(const char *URL,
const char *ID,
xmlParserCtxtPtrctxt
)

xmlLoadExternalEntity: Load an external entity, note that the use of this function for unparsed entities may generate problems

Returns the xmlParserInputPtr or NULL

OOM:

Parameters
URLthe URL for the entity to load
IDthe Public ID for the entity to load
ctxtthe context in which the entity is called or NULL

xmlByteConsumed ( xmlParserCtxtPtr )

XMLPUBFUN long XMLCALLxmlByteConsumed(xmlParserCtxtPtrctxt)

xmlByteConsumed: 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.

Returns the index in bytes from the beginning of the entity or -1 in case the index could not be computed.

Parameters
ctxtan XML parser context

Enum xmlParserOption

xmlParserOption:

This is the set of XML parser options that can be passed down to the xmlReadDoc() and similar calls.

xmlCtxtReset ( xmlParserCtxtPtr )

XMLPUBFUN void XMLCALLxmlCtxtReset(xmlParserCtxtPtrctxt)

xmlCtxtReset: Reset a parser context

Parameters
ctxtan XML parser context

xmlCtxtResetPush ( xmlParserCtxtPtr, const char *, int, const char *, const char * )

XMLPUBFUN int XMLCALLxmlCtxtResetPush(xmlParserCtxtPtrctxt,
const char *chunk,
intsize,
const char *filename,
const char *encoding
)

xmlCtxtResetPush: Reset a push parser context

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

Parameters
ctxtan XML parser context
chunka pointer to an array of chars
sizenumber of chars in the array
filenamean optional file name or URI
encodingthe document encoding, or NULL

xmlCtxtUseOptions ( xmlParserCtxtPtr, int )

XMLPUBFUN int XMLCALLxmlCtxtUseOptions(xmlParserCtxtPtrctxt,
intoptions
)

xmlCtxtUseOptions: Applies the options to the parser context

Returns 0 in case of success, the set of unknown or unimplemented options in case of error.

Parameters
ctxtan XML parser context
optionsa combination of xmlParserOption

xmlReadDoc ( const xmlChar *, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlReadDoc(const xmlChar *cur,
const char *URL,
const char *encoding,
intoptions
)

xmlReadDoc: parse an XML in-memory document and build a tree.

Returns the resulting document tree

Parameters
cura pointer to a zero terminated string
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlReadFile ( const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlReadFile(const char *URL,
const char *encoding,
intoptions
)

xmlReadFile: parse an XML file from the filesystem or the network.

Returns the resulting document tree

Parameters
URLa file or URL
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlReadMemory ( const char *, int, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlReadMemory(const char *buffer,
intsize,
const char *URL,
const char *encoding,
intoptions
)

xmlReadMemory: parse an XML in-memory document and build a tree.

Returns the resulting document tree

Parameters
buffera pointer to a char array
sizethe size of the array
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlReadFd ( int, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlReadFd(intfd,
const char *URL,
const char *encoding,
intoptions
)

xmlReadFd: parse an XML from a file descriptor and build a tree. NOTE that the file descriptor will not be closed when the reader is closed or reset.

Returns the resulting document tree

Parameters
fdan open file descriptor
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlReadIO ( xmlInputReadCallback, xmlInputCloseCallback, void *, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlReadIO(xmlInputReadCallbackioread,
xmlInputCloseCallbackioclose,
void *ioctx,
const char *URL,
const char *encoding,
intoptions
)

xmlReadIO: parse an XML document from I/O functions and source and build a tree.

Returns the resulting document tree

Parameters
ioreadan I/O read function
ioclosean I/O close function
ioctxan I/O handler
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlCtxtReadDoc ( xmlParserCtxtPtr, const xmlChar *, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlCtxtReadDoc(xmlParserCtxtPtrctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
intoptions
)

xmlCtxtReadDoc: parse an XML in-memory document and build a tree. This reuses the existing ctxt parser context

Returns the resulting document tree

Parameters
ctxtan XML parser context
cura pointer to a zero terminated string
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlCtxtReadFd ( xmlParserCtxtPtr, int, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlCtxtReadFd(xmlParserCtxtPtrctxt,
intfd,
const char *URL,
const char *encoding,
intoptions
)

xmlCtxtReadFd: parse an XML from a file descriptor and build a tree. This reuses the existing ctxt parser context NOTE that the file descriptor will not be closed when the reader is closed or reset.

Returns the resulting document tree

Parameters
ctxtan XML parser context
fdan open file descriptor
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlCtxtReadFile ( xmlParserCtxtPtr, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlCtxtReadFile(xmlParserCtxtPtrctxt,
const char *filename,
const char *encoding,
intoptions
)

xmlCtxtReadFile: parse an XML file from the filesystem or the network. This reuses the existing ctxt parser context

Returns the resulting document tree

Parameters
ctxtan XML parser context
filenamea file or URL
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlCtxtReadMemory ( xmlParserCtxtPtr, const char *, int, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlCtxtReadMemory(xmlParserCtxtPtrctxt,
const char *buffer,
intsize,
const char *URL,
const char *encoding,
intoptions
)

xmlCtxtReadMemory: parse an XML in-memory document and build a tree. This reuses the existing ctxt parser context

Returns the resulting document tree

Parameters
ctxtan XML parser context
buffera pointer to a char array
sizethe size of the array
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption

xmlCtxtReadIO ( xmlParserCtxtPtr, xmlInputReadCallback, xmlInputCloseCallback, void *, const char *, const char *, int )

XMLPUBFUN xmlDocPtr XMLCALLxmlCtxtReadIO(xmlParserCtxtPtrctxt,
xmlInputReadCallbackioread,
xmlInputCloseCallbackioclose,
void *ioctx,
const char *URL,
const char *encoding,
intoptions
)

xmlCtxtReadIO: parse an XML document from I/O functions and source and build a tree. This reuses the existing ctxt parser context

Returns the resulting document tree

Parameters
ctxtan XML parser context
ioreadan I/O read function
ioclosean I/O close function
ioctxan I/O handler
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption