libxml2
Loading...
Searching...
No Matches
xmlreader.h File Reference

the XMLReader implementation More...

Typedefs

typedef struct _xmlTextReader xmlTextReader
 xmlReader context
typedef void(* xmlTextReaderErrorFunc) (void *arg, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator)
 Signature of an error callback from a reader parser.

Enumerations

enum  xmlParserSeverities
 How severe an error callback is when the per-reader error callback API is used.
enum  xmlTextReaderMode
 Internal state values for the reader.
enum  xmlParserProperties
 Some common options to use with xmlTextReaderSetParserProp, but it is better to use xmlParserOption and the xmlReaderNewxxx and xmlReaderForxxx APIs now.
enum  xmlReaderTypes
 Predefined constants for the different types of nodes. More...

Functions

xmlTextReaderxmlNewTextReader (xmlParserInputBuffer *input, const char *URI)
 Create an xmlTextReader structure fed with input
xmlTextReaderxmlNewTextReaderFilename (const char *URI)
 Create an xmlTextReader structure fed with the resource at URI
void xmlFreeTextReader (xmlTextReader *reader)
 Deallocate all the resources associated to the reader.
int xmlTextReaderSetup (xmlTextReader *reader, xmlParserInputBuffer *input, const char *URL, const char *encoding, int options)
 Setup an XML reader with new options.
void xmlTextReaderSetMaxAmplification (xmlTextReader *reader, unsigned maxAmpl)
 Set the maximum amplification factor.
const xmlErrorxmlTextReaderGetLastError (xmlTextReader *reader)
int xmlTextReaderRead (xmlTextReader *reader)
 Moves the position of the current instance to the next node in the stream, exposing its properties.
xmlCharxmlTextReaderReadInnerXml (xmlTextReader *reader)
 Reads the contents of the current node, including child nodes and markup.
xmlCharxmlTextReaderReadOuterXml (xmlTextReader *reader)
 Reads the contents of the current node, including child nodes and markup.
xmlCharxmlTextReaderReadString (xmlTextReader *reader)
 Reads the contents of an element or a text node as a string.
int xmlTextReaderReadAttributeValue (xmlTextReader *reader)
 Parses an attribute value into one or more Text and EntityReference nodes.
int xmlTextReaderAttributeCount (xmlTextReader *reader)
 Provides the number of attributes of the current node.
int xmlTextReaderDepth (xmlTextReader *reader)
 The depth of the node in the tree.
int xmlTextReaderHasAttributes (xmlTextReader *reader)
 Whether the node has attributes.
int xmlTextReaderHasValue (xmlTextReader *reader)
 Whether the node can have a text value.
int xmlTextReaderIsDefault (xmlTextReader *reader)
 Whether an Attribute node was generated from the default value defined in the DTD or schema.
int xmlTextReaderIsEmptyElement (xmlTextReader *reader)
 Check if the current node is empty.
int xmlTextReaderNodeType (xmlTextReader *reader)
 Get the node type of the current node Reference: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html.
int xmlTextReaderQuoteChar (xmlTextReader *reader)
 The quotation mark character used to enclose the value of an attribute.
int xmlTextReaderReadState (xmlTextReader *reader)
 Gets the read state of the reader.
int xmlTextReaderIsNamespaceDecl (xmlTextReader *reader)
 Determine whether the current node is a namespace declaration rather than a regular attribute.
const xmlCharxmlTextReaderConstBaseUri (xmlTextReader *reader)
 The base URI of the node.
const xmlCharxmlTextReaderConstLocalName (xmlTextReader *reader)
 The local name of the node.
const xmlCharxmlTextReaderConstName (xmlTextReader *reader)
 The qualified name of the node, equal to Prefix :LocalName.
const xmlCharxmlTextReaderConstNamespaceUri (xmlTextReader *reader)
 The URI defining the namespace associated with the node.
const xmlCharxmlTextReaderConstPrefix (xmlTextReader *reader)
 A shorthand reference to the namespace associated with the node.
const xmlCharxmlTextReaderConstXmlLang (xmlTextReader *reader)
 The xml:lang scope within which the node resides.
const xmlCharxmlTextReaderConstString (xmlTextReader *reader, const xmlChar *str)
 Get an interned string from the reader, allows for example to speedup string name comparisons.
const xmlCharxmlTextReaderConstValue (xmlTextReader *reader)
 Provides the text value of the node if present.
xmlCharxmlTextReaderBaseUri (xmlTextReader *reader)
 The base URI of the node.
xmlCharxmlTextReaderLocalName (xmlTextReader *reader)
 The local name of the node.
xmlCharxmlTextReaderName (xmlTextReader *reader)
 The qualified name of the node, equal to Prefix :LocalName.
xmlCharxmlTextReaderNamespaceUri (xmlTextReader *reader)
 The URI defining the namespace associated with the node.
xmlCharxmlTextReaderPrefix (xmlTextReader *reader)
 A shorthand reference to the namespace associated with the node.
xmlCharxmlTextReaderXmlLang (xmlTextReader *reader)
 The xml:lang scope within which the node resides.
xmlCharxmlTextReaderValue (xmlTextReader *reader)
 Provides the text value of the node if present.
int xmlTextReaderClose (xmlTextReader *reader)
 This method releases any resources allocated by the current instance changes the state to Closed and close any underlying input.
xmlCharxmlTextReaderGetAttributeNo (xmlTextReader *reader, int no)
 Provides the value of the attribute with the specified index relative to the containing element.
xmlCharxmlTextReaderGetAttribute (xmlTextReader *reader, const xmlChar *name)
 Provides the value of the attribute with the specified qualified name.
xmlCharxmlTextReaderGetAttributeNs (xmlTextReader *reader, const xmlChar *localName, const xmlChar *namespaceURI)
 Provides the value of the specified attribute.
xmlParserInputBufferxmlTextReaderGetRemainder (xmlTextReader *reader)
 Method to get the remainder of the buffered XML.
xmlCharxmlTextReaderLookupNamespace (xmlTextReader *reader, const xmlChar *prefix)
 Resolves a namespace prefix in the scope of the current element.
int xmlTextReaderMoveToAttributeNo (xmlTextReader *reader, int no)
 Moves the position of the current instance to the attribute with the specified index relative to the containing element.
int xmlTextReaderMoveToAttribute (xmlTextReader *reader, const xmlChar *name)
 Moves the position of the current instance to the attribute with the specified qualified name.
int xmlTextReaderMoveToAttributeNs (xmlTextReader *reader, const xmlChar *localName, const xmlChar *namespaceURI)
 Moves the position of the current instance to the attribute with the specified local name and namespace URI.
int xmlTextReaderMoveToFirstAttribute (xmlTextReader *reader)
 Moves the position of the current instance to the first attribute associated with the current node.
int xmlTextReaderMoveToNextAttribute (xmlTextReader *reader)
 Moves the position of the current instance to the next attribute associated with the current node.
int xmlTextReaderMoveToElement (xmlTextReader *reader)
 Moves the position of the current instance to the node that contains the current Attribute node.
int xmlTextReaderNormalization (xmlTextReader *reader)
 The value indicating whether to normalize white space and attribute values.
const xmlCharxmlTextReaderConstEncoding (xmlTextReader *reader)
 Determine the encoding of the document being read.
int xmlTextReaderSetParserProp (xmlTextReader *reader, int prop, int value)
 Change the parser processing behaviour by changing some of its internal properties.
int xmlTextReaderGetParserProp (xmlTextReader *reader, int prop)
 Read the parser internal property.
xmlNodexmlTextReaderCurrentNode (xmlTextReader *reader)
 Hacking interface allowing to get the xmlNode corresponding to the current node being accessed by the xmlTextReader.
int xmlTextReaderGetParserLineNumber (xmlTextReader *reader)
 Provide the line number of the current parsing point.
int xmlTextReaderGetParserColumnNumber (xmlTextReader *reader)
 Provide the column number of the current parsing point.
xmlNodexmlTextReaderPreserve (xmlTextReader *reader)
 This tells the XML Reader to preserve the current node.
int xmlTextReaderPreservePattern (xmlTextReader *reader, const xmlChar *pattern, const xmlChar **namespaces)
 This tells the XML Reader to preserve all nodes matched by the pattern.
xmlDocxmlTextReaderCurrentDoc (xmlTextReader *reader)
 Hacking interface allowing to get the xmlDoc corresponding to the current document being accessed by the xmlTextReader.
xmlNodexmlTextReaderExpand (xmlTextReader *reader)
 Reads the contents of the current node and the full subtree.
int xmlTextReaderNext (xmlTextReader *reader)
 Skip to the node following the current one in document order while avoiding the subtree if any.
int xmlTextReaderNextSibling (xmlTextReader *reader)
 Skip to the node following the current one in document order while avoiding the subtree if any.
int xmlTextReaderIsValid (xmlTextReader *reader)
 Retrieve the validity status from the parser context.
int xmlTextReaderRelaxNGValidate (xmlTextReader *reader, const char *rng)
 Use RelaxNG schema to validate the document as it is processed.
int xmlTextReaderRelaxNGValidateCtxt (xmlTextReader *reader, xmlRelaxNGValidCtxt *ctxt, int options)
 Use RelaxNG schema context to validate the document as it is processed.
int xmlTextReaderRelaxNGSetSchema (xmlTextReader *reader, xmlRelaxNG *schema)
 Use RelaxNG to validate the document as it is processed.
int xmlTextReaderSchemaValidate (xmlTextReader *reader, const char *xsd)
 Use W3C XSD schema to validate the document as it is processed.
int xmlTextReaderSchemaValidateCtxt (xmlTextReader *reader, xmlSchemaValidCtxt *ctxt, int options)
 Use W3C XSD schema context to validate the document as it is processed.
int xmlTextReaderSetSchema (xmlTextReader *reader, xmlSchema *schema)
 Use XSD Schema to validate the document as it is processed.
const xmlCharxmlTextReaderConstXmlVersion (xmlTextReader *reader)
 Determine the XML version of the document being read.
int xmlTextReaderStandalone (xmlTextReader *reader)
 Determine the standalone status of the document being read.
long xmlTextReaderByteConsumed (xmlTextReader *reader)
 This function provides the current index of the parser used by the reader, relative to the start of the current entity.
xmlTextReaderxmlReaderWalker (xmlDoc *doc)
 Create an xmltextReader for a preparsed document.
xmlTextReaderxmlReaderForDoc (const xmlChar *cur, const char *URL, const char *encoding, int options)
 Create an xmltextReader for an XML in-memory document.
xmlTextReaderxmlReaderForFile (const char *filename, const char *encoding, int options)
 parse an XML file from the filesystem or the network.
xmlTextReaderxmlReaderForMemory (const char *buffer, int size, const char *URL, const char *encoding, int options)
 Create an xmltextReader for an XML in-memory document.
xmlTextReaderxmlReaderForFd (int fd, const char *URL, const char *encoding, int options)
 Create an xmltextReader for an XML from a file descriptor.
xmlTextReaderxmlReaderForIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 Create an xmltextReader for an XML document from I/O functions and source.
int xmlReaderNewWalker (xmlTextReader *reader, xmlDoc *doc)
 Setup an xmltextReader to parse a preparsed XML document.
int xmlReaderNewDoc (xmlTextReader *reader, const xmlChar *cur, const char *URL, const char *encoding, int options)
 Setup an xmltextReader to parse an XML in-memory document.
int xmlReaderNewFile (xmlTextReader *reader, const char *filename, const char *encoding, int options)
 parse an XML file from the filesystem or the network.
int xmlReaderNewMemory (xmlTextReader *reader, const char *buffer, int size, const char *URL, const char *encoding, int options)
 Setup an xmltextReader to parse an XML in-memory document.
int xmlReaderNewFd (xmlTextReader *reader, int fd, const char *URL, const char *encoding, int options)
 Setup an xmltextReader to parse an XML from a file descriptor.
int xmlReaderNewIO (xmlTextReader *reader, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
 Setup an xmltextReader to parse an XML document from I/O functions and source.
int xmlTextReaderLocatorLineNumber (xmlTextReaderLocatorPtr locator)
 Obtain the line number for the given locator.
xmlCharxmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator)
 Obtain the base URI for the given locator.
void xmlTextReaderSetErrorHandler (xmlTextReader *reader, xmlTextReaderErrorFunc f, void *arg)
 Register a callback function that will be called on error and warnings.
void xmlTextReaderSetStructuredErrorHandler (xmlTextReader *reader, xmlStructuredErrorFunc f, void *arg)
 xmlTextReaderSetStructuredErrorHandler:
void xmlTextReaderGetErrorHandler (xmlTextReader *reader, xmlTextReaderErrorFunc *f, void **arg)
 Retrieve the error callback function and user argument.
void xmlTextReaderSetResourceLoader (xmlTextReader *reader, xmlResourceLoader loader, void *data)
 Register a callback function that will be called to load external resources like entities.

Detailed Description

the XMLReader implementation

API of the XML streaming API based on C# interfaces.

Author
Daniel Veillard

Typedef Documentation

◆ xmlTextReaderErrorFunc

typedef void(* xmlTextReaderErrorFunc) (void *arg, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator)

Signature of an error callback from a reader parser.

Parameters
argthe user argument
msgthe message
severitythe severity of the error
locatora locator indicating where the error occurred

Enumeration Type Documentation

◆ xmlReaderTypes

Predefined constants for the different types of nodes.

Enumerator
XML_READER_TYPE_NONE 

unknown or error

XML_READER_TYPE_ELEMENT 

element

XML_READER_TYPE_ATTRIBUTE 

attribute

XML_READER_TYPE_TEXT 

text

XML_READER_TYPE_CDATA 

CDATA section.

XML_READER_TYPE_ENTITY_REFERENCE 

entity reference

XML_READER_TYPE_ENTITY 

unused

XML_READER_TYPE_PROCESSING_INSTRUCTION 

processing instruction

XML_READER_TYPE_COMMENT 

comment

XML_READER_TYPE_DOCUMENT 

document

XML_READER_TYPE_DOCUMENT_TYPE 

unused

XML_READER_TYPE_DOCUMENT_FRAGMENT 

document fragment

XML_READER_TYPE_NOTATION 

notation, unused

XML_READER_TYPE_WHITESPACE 

whitespace

XML_READER_TYPE_SIGNIFICANT_WHITESPACE 

significant whitespace

XML_READER_TYPE_END_ELEMENT 

end of element

XML_READER_TYPE_END_ENTITY 

unused

XML_READER_TYPE_XML_DECLARATION 

unused

Function Documentation

◆ xmlFreeTextReader()

void xmlFreeTextReader ( xmlTextReader * reader)

Deallocate all the resources associated to the reader.

Parameters
readerthe xmlTextReader

◆ xmlNewTextReader()

xmlTextReader * xmlNewTextReader ( xmlParserInputBuffer * input,
const char * URI )

Create an xmlTextReader structure fed with input

Parameters
inputthe xmlParserInputBuffer used to read data
URIthe URI information for the source if available
Returns
the new xmlTextReader or NULL in case of error

◆ xmlNewTextReaderFilename()

xmlTextReader * xmlNewTextReaderFilename ( const char * URI)

Create an xmlTextReader structure fed with the resource at URI

Parameters
URIthe URI of the resource to process
Returns
the new xmlTextReader or NULL in case of error

◆ xmlReaderForDoc()

xmlTextReader * xmlReaderForDoc ( const xmlChar * cur,
const char * URL,
const char * encoding,
int options )

Create an xmltextReader for an XML in-memory document.

The parsing flags options are a combination of xmlParserOption.

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
Returns
the new reader or NULL in case of error.

◆ xmlReaderForFd()

xmlTextReader * xmlReaderForFd ( int fd,
const char * URL,
const char * encoding,
int options )

Create an xmltextReader for an XML from a file descriptor.

The parsing flags options are a combination of xmlParserOption. NOTE that the file descriptor will not be closed when the reader is closed or reset.

Parameters
fdan open file descriptor
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption
Returns
the new reader or NULL in case of error.

◆ xmlReaderForFile()

xmlTextReader * xmlReaderForFile ( const char * filename,
const char * encoding,
int options )

parse an XML file from the filesystem or the network.

The parsing flags options are a combination of xmlParserOption.

Parameters
filenamea file or URL
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption
Returns
the new reader or NULL in case of error.

◆ xmlReaderForIO()

xmlTextReader * xmlReaderForIO ( xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options )

Create an xmltextReader for an XML document from I/O functions and source.

The parsing flags options are a combination of xmlParserOption.

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
Returns
the new reader or NULL in case of error.

◆ xmlReaderForMemory()

xmlTextReader * xmlReaderForMemory ( const char * buffer,
int size,
const char * URL,
const char * encoding,
int options )

Create an xmltextReader for an XML in-memory document.

The parsing flags options are a combination of xmlParserOption.

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
Returns
the new reader or NULL in case of error.

◆ xmlReaderNewDoc()

int xmlReaderNewDoc ( xmlTextReader * reader,
const xmlChar * cur,
const char * URL,
const char * encoding,
int options )

Setup an xmltextReader to parse an XML in-memory document.

The parsing flags options are a combination of xmlParserOption. This reuses the existing reader xmlTextReader.

Parameters
readeran XML reader
cura pointer to a zero terminated string
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption
Returns
0 in case of success and -1 in case of error

◆ xmlReaderNewFd()

int xmlReaderNewFd ( xmlTextReader * reader,
int fd,
const char * URL,
const char * encoding,
int options )

Setup an xmltextReader to parse an XML from a file descriptor.

NOTE that the file descriptor will not be closed when the reader is closed or reset. The parsing flags options are a combination of xmlParserOption. This reuses the existing reader xmlTextReader.

Parameters
readeran XML reader
fdan open file descriptor
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption
Returns
0 in case of success and -1 in case of error

◆ xmlReaderNewFile()

int xmlReaderNewFile ( xmlTextReader * reader,
const char * filename,
const char * encoding,
int options )

parse an XML file from the filesystem or the network.

The parsing flags options are a combination of xmlParserOption. This reuses the existing reader xmlTextReader.

Parameters
readeran XML reader
filenamea file or URL
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption
Returns
0 in case of success and -1 in case of error

◆ xmlReaderNewIO()

int xmlReaderNewIO ( xmlTextReader * reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void * ioctx,
const char * URL,
const char * encoding,
int options )

Setup an xmltextReader to parse an XML document from I/O functions and source.

The parsing flags options are a combination of xmlParserOption. This reuses the existing reader xmlTextReader.

Parameters
readeran XML reader
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
Returns
0 in case of success and -1 in case of error

◆ xmlReaderNewMemory()

int xmlReaderNewMemory ( xmlTextReader * reader,
const char * buffer,
int size,
const char * URL,
const char * encoding,
int options )

Setup an xmltextReader to parse an XML in-memory document.

The parsing flags options are a combination of xmlParserOption. This reuses the existing reader xmlTextReader.

Parameters
readeran XML reader
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
Returns
0 in case of success and -1 in case of error

◆ xmlReaderNewWalker()

int xmlReaderNewWalker ( xmlTextReader * reader,
xmlDoc * doc )

Setup an xmltextReader to parse a preparsed XML document.

This reuses the existing reader xmlTextReader.

Parameters
readeran XML reader
doca preparsed document
Returns
0 in case of success and -1 in case of error

◆ xmlReaderWalker()

xmlTextReader * xmlReaderWalker ( xmlDoc * doc)

Create an xmltextReader for a preparsed document.

Parameters
doca preparsed document
Returns
the new reader or NULL in case of error.

◆ xmlTextReaderAttributeCount()

int xmlTextReaderAttributeCount ( xmlTextReader * reader)

Provides the number of attributes of the current node.

Parameters
readerthe xmlTextReader used
Returns
0 i no attributes, -1 in case of error or the attribute count

◆ xmlTextReaderBaseUri()

xmlChar * xmlTextReaderBaseUri ( xmlTextReader * reader)

The base URI of the node.

Parameters
readerthe xmlTextReader used
Returns
the base URI or NULL if not available, if non NULL it need to be freed by the caller.

◆ xmlTextReaderByteConsumed()

long xmlTextReaderByteConsumed ( xmlTextReader * reader)

This function provides the current index of the parser used by the reader, relative to the start of the current entity.

This function actually just wraps a call to xmlByteConsumed for the parser context associated with the reader. See xmlByteConsumed for more information.

Deprecated
The returned value is mostly random and useless. It reflects the parser reading ahead and is in no way related to the current node.
Parameters
readeran XML reader
Returns
the index in bytes from the beginning of the entity or -1 in case the index could not be computed.

◆ xmlTextReaderClose()

int xmlTextReaderClose ( xmlTextReader * reader)

This method releases any resources allocated by the current instance changes the state to Closed and close any underlying input.

Parameters
readerthe xmlTextReader used
Returns
0 or -1 in case of error

◆ xmlTextReaderConstBaseUri()

const xmlChar * xmlTextReaderConstBaseUri ( xmlTextReader * reader)

The base URI of the node.

Parameters
readerthe xmlTextReader used
Returns
the base URI or NULL if not available, the string will be deallocated with the reader

◆ xmlTextReaderConstEncoding()

const xmlChar * xmlTextReaderConstEncoding ( xmlTextReader * reader)

Determine the encoding of the document being read.

Parameters
readerthe xmlTextReader used
Returns
a string containing the encoding of the document or NULL in case of error. The string is deallocated with the reader.

◆ xmlTextReaderConstLocalName()

const xmlChar * xmlTextReaderConstLocalName ( xmlTextReader * reader)

The local name of the node.

Parameters
readerthe xmlTextReader used
Returns
the local name or NULL if not available, the string will be deallocated with the reader.

◆ xmlTextReaderConstName()

const xmlChar * xmlTextReaderConstName ( xmlTextReader * reader)

The qualified name of the node, equal to Prefix :LocalName.

Parameters
readerthe xmlTextReader used
Returns
the local name or NULL if not available, the string is deallocated with the reader.

◆ xmlTextReaderConstNamespaceUri()

const xmlChar * xmlTextReaderConstNamespaceUri ( xmlTextReader * reader)

The URI defining the namespace associated with the node.

Parameters
readerthe xmlTextReader used
Returns
the namespace URI or NULL if not available, the string will be deallocated with the reader

◆ xmlTextReaderConstPrefix()

const xmlChar * xmlTextReaderConstPrefix ( xmlTextReader * reader)

A shorthand reference to the namespace associated with the node.

Parameters
readerthe xmlTextReader used
Returns
the prefix or NULL if not available, the string is deallocated with the reader.

◆ xmlTextReaderConstString()

const xmlChar * xmlTextReaderConstString ( xmlTextReader * reader,
const xmlChar * str )

Get an interned string from the reader, allows for example to speedup string name comparisons.

Parameters
readerthe xmlTextReader used
strthe string to intern.
Returns
an interned copy of the string or NULL in case of error. The string will be deallocated with the reader.

◆ xmlTextReaderConstValue()

const xmlChar * xmlTextReaderConstValue ( xmlTextReader * reader)

Provides the text value of the node if present.

Parameters
readerthe xmlTextReader used
Returns
the string or NULL if not available. The result will be deallocated on the next Read() operation.

◆ xmlTextReaderConstXmlLang()

const xmlChar * xmlTextReaderConstXmlLang ( xmlTextReader * reader)

The xml:lang scope within which the node resides.

Parameters
readerthe xmlTextReader used
Returns
the xml:lang value or NULL if none exists.

◆ xmlTextReaderConstXmlVersion()

const xmlChar * xmlTextReaderConstXmlVersion ( xmlTextReader * reader)

Determine the XML version of the document being read.

Parameters
readerthe xmlTextReader used
Returns
a string containing the XML version of the document or NULL in case of error. The string is deallocated with the reader.

◆ xmlTextReaderCurrentDoc()

xmlDoc * xmlTextReaderCurrentDoc ( xmlTextReader * reader)

Hacking interface allowing to get the xmlDoc corresponding to the current document being accessed by the xmlTextReader.

NOTE: as a result of this call, the reader will not destroy the associated XML document and calling xmlFreeDoc on the result is needed once the reader parsing has finished.

Parameters
readerthe xmlTextReader used
Returns
the xmlDoc or NULL in case of error.

◆ xmlTextReaderCurrentNode()

xmlNode * xmlTextReaderCurrentNode ( xmlTextReader * reader)

Hacking interface allowing to get the xmlNode corresponding to the current node being accessed by the xmlTextReader.

This is dangerous because the underlying node may be destroyed on the next Reads.

Parameters
readerthe xmlTextReader used
Returns
the xmlNode or NULL in case of error.

◆ xmlTextReaderDepth()

int xmlTextReaderDepth ( xmlTextReader * reader)

The depth of the node in the tree.

Parameters
readerthe xmlTextReader used
Returns
the depth or -1 in case of error

◆ xmlTextReaderExpand()

xmlNode * xmlTextReaderExpand ( xmlTextReader * reader)

Reads the contents of the current node and the full subtree.

It then makes the subtree available until the next xmlTextReaderRead call

Parameters
readerthe xmlTextReader used
Returns
a node pointer valid until the next xmlTextReaderRead call or NULL in case of error.

◆ xmlTextReaderGetAttribute()

xmlChar * xmlTextReaderGetAttribute ( xmlTextReader * reader,
const xmlChar * name )

Provides the value of the attribute with the specified qualified name.

Parameters
readerthe xmlTextReader used
namethe qualified name of the attribute.
Returns
a string containing the value of the specified attribute, or NULL in case of error. The string must be deallocated by the caller.

◆ xmlTextReaderGetAttributeNo()

xmlChar * xmlTextReaderGetAttributeNo ( xmlTextReader * reader,
int no )

Provides the value of the attribute with the specified index relative to the containing element.

Parameters
readerthe xmlTextReader used
nothe zero-based index of the attribute relative to the containing element
Returns
a string containing the value of the specified attribute, or NULL in case of error. The string must be deallocated by the caller.

◆ xmlTextReaderGetAttributeNs()

xmlChar * xmlTextReaderGetAttributeNs ( xmlTextReader * reader,
const xmlChar * localName,
const xmlChar * namespaceURI )

Provides the value of the specified attribute.

Parameters
readerthe xmlTextReader used
localNamethe local name of the attribute.
namespaceURIthe namespace URI of the attribute.
Returns
a string containing the value of the specified attribute, or NULL in case of error. The string must be deallocated by the caller.

◆ xmlTextReaderGetErrorHandler()

void xmlTextReaderGetErrorHandler ( xmlTextReader * reader,
xmlTextReaderErrorFunc * f,
void ** arg )

Retrieve the error callback function and user argument.

Parameters
readerthe xmlTextReader used
fthe callback function or NULL is no callback has been registered
arga user argument

◆ xmlTextReaderGetLastError()

const xmlError * xmlTextReaderGetLastError ( xmlTextReader * reader)
Since
2.13.0
Parameters
readeran XML reader
Returns
the last error.

◆ xmlTextReaderGetParserColumnNumber()

int xmlTextReaderGetParserColumnNumber ( xmlTextReader * reader)

Provide the column number of the current parsing point.

Parameters
readerthe user data (XML reader context)
Returns
an int or 0 if not available

◆ xmlTextReaderGetParserLineNumber()

int xmlTextReaderGetParserLineNumber ( xmlTextReader * reader)

Provide the line number of the current parsing point.

Parameters
readerthe user data (XML reader context)
Returns
an int or 0 if not available

◆ xmlTextReaderGetParserProp()

int xmlTextReaderGetParserProp ( xmlTextReader * reader,
int prop )

Read the parser internal property.

Parameters
readerthe xmlTextReader used
propthe xmlParserProperties to get
Returns
the value, usually 0 or 1, or -1 in case of error.

◆ xmlTextReaderGetRemainder()

xmlParserInputBuffer * xmlTextReaderGetRemainder ( xmlTextReader * reader)

Method to get the remainder of the buffered XML.

this method stops the parser, set its state to End Of File and return the input stream with what is left that the parser did not use.

The implementation is not good, the parser certainly progressed past what's left in reader->input, and there is an allocation problem. Best would be to rewrite it differently.

Parameters
readerthe xmlTextReader used
Returns
the xmlParserInputBuffer attached to the XML or NULL in case of error.

◆ xmlTextReaderHasAttributes()

int xmlTextReaderHasAttributes ( xmlTextReader * reader)

Whether the node has attributes.

Parameters
readerthe xmlTextReader used
Returns
1 if true, 0 if false, and -1 in case or error

◆ xmlTextReaderHasValue()

int xmlTextReaderHasValue ( xmlTextReader * reader)

Whether the node can have a text value.

Parameters
readerthe xmlTextReader used
Returns
1 if true, 0 if false, and -1 in case or error

◆ xmlTextReaderIsDefault()

int xmlTextReaderIsDefault ( xmlTextReader * reader)

Whether an Attribute node was generated from the default value defined in the DTD or schema.

Parameters
readerthe xmlTextReader used
Returns
0 if not defaulted, 1 if defaulted, and -1 in case of error

◆ xmlTextReaderIsEmptyElement()

int xmlTextReaderIsEmptyElement ( xmlTextReader * reader)

Check if the current node is empty.

Parameters
readerthe xmlTextReader used
Returns
1 if empty, 0 if not and -1 in case of error

◆ xmlTextReaderIsNamespaceDecl()

int xmlTextReaderIsNamespaceDecl ( xmlTextReader * reader)

Determine whether the current node is a namespace declaration rather than a regular attribute.

Parameters
readerthe xmlTextReader used
Returns
1 if the current node is a namespace declaration, 0 if it is a regular attribute or other type of node, or -1 in case of error.

◆ xmlTextReaderIsValid()

int xmlTextReaderIsValid ( xmlTextReader * reader)

Retrieve the validity status from the parser context.

Parameters
readerthe xmlTextReader used
Returns
the flag value 1 if valid, 0 if no, and -1 in case of error

◆ xmlTextReaderLocalName()

xmlChar * xmlTextReaderLocalName ( xmlTextReader * reader)

The local name of the node.

Parameters
readerthe xmlTextReader used
Returns
the local name or NULL if not available, if non NULL it need to be freed by the caller.

◆ xmlTextReaderLocatorBaseURI()

xmlChar * xmlTextReaderLocatorBaseURI ( xmlTextReaderLocatorPtr locator)

Obtain the base URI for the given locator.

Parameters
locatorthe void used
Returns
the base URI or NULL in case of error, if non NULL it need to be freed by the caller.

◆ xmlTextReaderLocatorLineNumber()

int xmlTextReaderLocatorLineNumber ( xmlTextReaderLocatorPtr locator)

Obtain the line number for the given locator.

Parameters
locatorthe void used
Returns
the line number or -1 in case of error.

◆ xmlTextReaderLookupNamespace()

xmlChar * xmlTextReaderLookupNamespace ( xmlTextReader * reader,
const xmlChar * prefix )

Resolves a namespace prefix in the scope of the current element.

Parameters
readerthe xmlTextReader used
prefixthe prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL
Returns
a string containing the namespace URI to which the prefix maps or NULL in case of error. The string must be deallocated by the caller.

◆ xmlTextReaderMoveToAttribute()

int xmlTextReaderMoveToAttribute ( xmlTextReader * reader,
const xmlChar * name )

Moves the position of the current instance to the attribute with the specified qualified name.

Parameters
readerthe xmlTextReader used
namethe qualified name of the attribute.
Returns
1 in case of success, -1 in case of error, 0 if not found

◆ xmlTextReaderMoveToAttributeNo()

int xmlTextReaderMoveToAttributeNo ( xmlTextReader * reader,
int no )

Moves the position of the current instance to the attribute with the specified index relative to the containing element.

Parameters
readerthe xmlTextReader used
nothe zero-based index of the attribute relative to the containing element.
Returns
1 in case of success, -1 in case of error, 0 if not found

◆ xmlTextReaderMoveToAttributeNs()

int xmlTextReaderMoveToAttributeNs ( xmlTextReader * reader,
const xmlChar * localName,
const xmlChar * namespaceURI )

Moves the position of the current instance to the attribute with the specified local name and namespace URI.

Parameters
readerthe xmlTextReader used
localNamethe local name of the attribute.
namespaceURIthe namespace URI of the attribute.
Returns
1 in case of success, -1 in case of error, 0 if not found

◆ xmlTextReaderMoveToElement()

int xmlTextReaderMoveToElement ( xmlTextReader * reader)

Moves the position of the current instance to the node that contains the current Attribute node.

Parameters
readerthe xmlTextReader used
Returns
1 in case of success, -1 in case of error, 0 if not moved

◆ xmlTextReaderMoveToFirstAttribute()

int xmlTextReaderMoveToFirstAttribute ( xmlTextReader * reader)

Moves the position of the current instance to the first attribute associated with the current node.

Parameters
readerthe xmlTextReader used
Returns
1 in case of success, -1 in case of error, 0 if not found

◆ xmlTextReaderMoveToNextAttribute()

int xmlTextReaderMoveToNextAttribute ( xmlTextReader * reader)

Moves the position of the current instance to the next attribute associated with the current node.

Parameters
readerthe xmlTextReader used
Returns
1 in case of success, -1 in case of error, 0 if not found

◆ xmlTextReaderName()

xmlChar * xmlTextReaderName ( xmlTextReader * reader)

The qualified name of the node, equal to Prefix :LocalName.

Parameters
readerthe xmlTextReader used
Returns
the local name or NULL if not available, if non NULL it need to be freed by the caller.

◆ xmlTextReaderNamespaceUri()

xmlChar * xmlTextReaderNamespaceUri ( xmlTextReader * reader)

The URI defining the namespace associated with the node.

Parameters
readerthe xmlTextReader used
Returns
the namespace URI or NULL if not available, if non NULL it need to be freed by the caller.

◆ xmlTextReaderNext()

int xmlTextReaderNext ( xmlTextReader * reader)

Skip to the node following the current one in document order while avoiding the subtree if any.

Parameters
readerthe xmlTextReader used
Returns
1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error

◆ xmlTextReaderNextSibling()

int xmlTextReaderNextSibling ( xmlTextReader * reader)

Skip to the node following the current one in document order while avoiding the subtree if any.

Currently implemented only for Readers built on a document

Parameters
readerthe xmlTextReader used
Returns
1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error

◆ xmlTextReaderNodeType()

int xmlTextReaderNodeType ( xmlTextReader * reader)

Get the node type of the current node Reference: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html.

Parameters
readerthe xmlTextReader used
Returns
the xmlReaderTypes of the current node or -1 in case of error

◆ xmlTextReaderNormalization()

int xmlTextReaderNormalization ( xmlTextReader * reader)

The value indicating whether to normalize white space and attribute values.

Since attribute value and end of line normalizations are a MUST in the XML specification only the value true is accepted. The broken behaviour of accepting out of range character entities like � is of course not supported either.

Parameters
readerthe xmlTextReader used
Returns
1 or -1 in case of error.

◆ xmlTextReaderPrefix()

xmlChar * xmlTextReaderPrefix ( xmlTextReader * reader)

A shorthand reference to the namespace associated with the node.

Parameters
readerthe xmlTextReader used
Returns
the prefix or NULL if not available, if non NULL it need to be freed by the caller.

◆ xmlTextReaderPreserve()

xmlNode * xmlTextReaderPreserve ( xmlTextReader * reader)

This tells the XML Reader to preserve the current node.

The caller must also use xmlTextReaderCurrentDoc to keep an handle on the resulting document once parsing has finished

Parameters
readerthe xmlTextReader used
Returns
the xmlNode or NULL in case of error.

◆ xmlTextReaderPreservePattern()

int xmlTextReaderPreservePattern ( xmlTextReader * reader,
const xmlChar * pattern,
const xmlChar ** namespaces )

This tells the XML Reader to preserve all nodes matched by the pattern.

The caller must also use xmlTextReaderCurrentDoc to keep an handle on the resulting document once parsing has finished

Parameters
readerthe xmlTextReader used
patternan XPath subset pattern
namespacesthe prefix definitions, array of [URI, prefix] or NULL
Returns
a non-negative number in case of success and -1 in case of error

◆ xmlTextReaderQuoteChar()

int xmlTextReaderQuoteChar ( xmlTextReader * reader)

The quotation mark character used to enclose the value of an attribute.

Parameters
readerthe xmlTextReader used
Returns
" or ' and -1 in case of error

◆ xmlTextReaderRead()

int xmlTextReaderRead ( xmlTextReader * reader)

Moves the position of the current instance to the next node in the stream, exposing its properties.

Parameters
readerthe xmlTextReader used
Returns
1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error

◆ xmlTextReaderReadAttributeValue()

int xmlTextReaderReadAttributeValue ( xmlTextReader * reader)

Parses an attribute value into one or more Text and EntityReference nodes.

Parameters
readerthe xmlTextReader used
Returns
1 in case of success, 0 if the reader was not positioned on an attribute node or all the attribute values have been read, or -1 in case of error.

◆ xmlTextReaderReadInnerXml()

xmlChar * xmlTextReaderReadInnerXml ( xmlTextReader * reader)

Reads the contents of the current node, including child nodes and markup.

Parameters
readerthe xmlTextReader used
Returns
a string containing the XML content, or NULL if the current node is neither an element nor attribute, or has no child nodes. The string must be deallocated by the caller.

◆ xmlTextReaderReadOuterXml()

xmlChar * xmlTextReaderReadOuterXml ( xmlTextReader * reader)

Reads the contents of the current node, including child nodes and markup.

Parameters
readerthe xmlTextReader used
Returns
a string containing the node and any XML content, or NULL if the current node cannot be serialized. The string must be deallocated by the caller.

◆ xmlTextReaderReadState()

int xmlTextReaderReadState ( xmlTextReader * reader)

Gets the read state of the reader.

Parameters
readerthe xmlTextReader used
Returns
the state value, or -1 in case of error

◆ xmlTextReaderReadString()

xmlChar * xmlTextReaderReadString ( xmlTextReader * reader)

Reads the contents of an element or a text node as a string.

Parameters
readerthe xmlTextReader used
Returns
a string containing the contents of the non-empty Element or Text node (including CDATA sections), or NULL if the reader is positioned on any other type of node. The string must be deallocated by the caller.

◆ xmlTextReaderRelaxNGSetSchema()

int xmlTextReaderRelaxNGSetSchema ( xmlTextReader * reader,
xmlRelaxNG * schema )

Use RelaxNG to validate the document as it is processed.

Activation is only possible before the first Read(). if schema is NULL, then RelaxNG validation is deactivated. The schema should not be freed until the reader is deallocated or its use has been deactivated.

Parameters
readerthe xmlTextReader used
schemaa precompiled RelaxNG schema
Returns
0 in case the RelaxNG validation could be (de)activated and -1 in case of error.

◆ xmlTextReaderRelaxNGValidate()

int xmlTextReaderRelaxNGValidate ( xmlTextReader * reader,
const char * rng )

Use RelaxNG schema to validate the document as it is processed.

Activation is only possible before the first Read(). If rng is NULL, then RelaxNG schema validation is deactivated.

Parameters
readerthe xmlTextReader used
rngthe path to a RelaxNG schema or NULL
Returns
0 in case the schemas validation could be (de)activated and -1 in case of error.

◆ xmlTextReaderRelaxNGValidateCtxt()

int xmlTextReaderRelaxNGValidateCtxt ( xmlTextReader * reader,
xmlRelaxNGValidCtxt * ctxt,
int options )

Use RelaxNG schema context to validate the document as it is processed.

Activation is only possible before the first Read(). If ctxt is NULL, then RelaxNG schema validation is deactivated.

Parameters
readerthe xmlTextReader used
ctxtthe RelaxNG schema validation context or NULL
optionsoptions (not used yet)
Returns
0 in case the schemas validation could be (de)activated and -1 in case of error.

◆ xmlTextReaderSchemaValidate()

int xmlTextReaderSchemaValidate ( xmlTextReader * reader,
const char * xsd )

Use W3C XSD schema to validate the document as it is processed.

Activation is only possible before the first Read(). If xsd is NULL, then XML Schema validation is deactivated.

Parameters
readerthe xmlTextReader used
xsdthe path to a W3C XSD schema or NULL
Returns
0 in case the schemas validation could be (de)activated and -1 in case of error.

◆ xmlTextReaderSchemaValidateCtxt()

int xmlTextReaderSchemaValidateCtxt ( xmlTextReader * reader,
xmlSchemaValidCtxt * ctxt,
int options )

Use W3C XSD schema context to validate the document as it is processed.

Activation is only possible before the first Read(). If ctxt is NULL, then XML Schema validation is deactivated.

Parameters
readerthe xmlTextReader used
ctxtthe XML Schema validation context or NULL
optionsoptions (not used yet)
Returns
0 in case the schemas validation could be (de)activated and -1 in case of error.

◆ xmlTextReaderSetErrorHandler()

void xmlTextReaderSetErrorHandler ( xmlTextReader * reader,
xmlTextReaderErrorFunc f,
void * arg )

Register a callback function that will be called on error and warnings.

Deprecated
Use xmlTextReaderSetStructuredErrorHandler.

If f is NULL, the default error and warning handlers are restored.

Parameters
readerthe xmlTextReader used
fthe callback function to call on error and warnings
arga user argument to pass to the callback function

◆ xmlTextReaderSetMaxAmplification()

void xmlTextReaderSetMaxAmplification ( xmlTextReader * reader,
unsigned maxAmpl )

Set the maximum amplification factor.

See xmlCtxtSetMaxAmplification.

Parameters
readeran XML reader
maxAmplmaximum amplification factor

◆ xmlTextReaderSetParserProp()

int xmlTextReaderSetParserProp ( xmlTextReader * reader,
int prop,
int value )

Change the parser processing behaviour by changing some of its internal properties.

Note that some properties can only be changed before any read has been done.

Parameters
readerthe xmlTextReader used
propthe xmlParserProperties to set
valueusually 0 or 1 to (de)activate it
Returns
0 if the call was successful, or -1 in case of error

◆ xmlTextReaderSetResourceLoader()

void xmlTextReaderSetResourceLoader ( xmlTextReader * reader,
xmlResourceLoader loader,
void * data )

Register a callback function that will be called to load external resources like entities.

Since
2.14.0
Parameters
readerthr reader
loaderresource loader
datauser data which will be passed to the loader

◆ xmlTextReaderSetSchema()

int xmlTextReaderSetSchema ( xmlTextReader * reader,
xmlSchema * schema )

Use XSD Schema to validate the document as it is processed.

Activation is only possible before the first Read(). if schema is NULL, then Schema validation is deactivated. The schema should not be freed until the reader is deallocated or its use has been deactivated.

Parameters
readerthe xmlTextReader used
schemaa precompiled Schema schema
Returns
0 in case the Schema validation could be (de)activated and -1 in case of error.

◆ xmlTextReaderSetStructuredErrorHandler()

void xmlTextReaderSetStructuredErrorHandler ( xmlTextReader * reader,
xmlStructuredErrorFunc f,
void * arg )

xmlTextReaderSetStructuredErrorHandler:

Register a callback function that will be called on error and warnings.

If f is NULL, the default error and warning handlers are restored.

Parameters
readerthe xmlTextReader used
fthe callback function to call on error and warnings
arga user argument to pass to the callback function

◆ xmlTextReaderSetup()

int xmlTextReaderSetup ( xmlTextReader * reader,
xmlParserInputBuffer * input,
const char * URL,
const char * encoding,
int options )

Setup an XML reader with new options.

Parameters
readeran XML reader
inputxmlParserInputBuffer used to feed the reader, will be destroyed with it.
URLthe base URL to use for the document
encodingthe document encoding, or NULL
optionsa combination of xmlParserOption
Returns
0 in case of success and -1 in case of error.

◆ xmlTextReaderStandalone()

int xmlTextReaderStandalone ( xmlTextReader * reader)

Determine the standalone status of the document being read.

Parameters
readerthe xmlTextReader used
Returns
1 if the document was declared to be standalone, 0 if it was declared to be not standalone, or -1 if the document did not specify its standalone status or in case of error.

◆ xmlTextReaderValue()

xmlChar * xmlTextReaderValue ( xmlTextReader * reader)

Provides the text value of the node if present.

Parameters
readerthe xmlTextReader used
Returns
the string or NULL if not available. The result must be deallocated with xmlFree

◆ xmlTextReaderXmlLang()

xmlChar * xmlTextReaderXmlLang ( xmlTextReader * reader)

The xml:lang scope within which the node resides.

Parameters
readerthe xmlTextReader used
Returns
the xml:lang value or NULL if none exists., if non NULL it need to be freed by the caller.