![]() | ![]() | ![]() | [Insert name here] Reference Manual | ![]() |
---|
xmlreader —
enum xmlParserProperties; enum xmlParserSeverities; enum xmlReaderTypes; struct xmlTextReader; typedef xmlTextReaderPtr; xmlTextReaderPtr xmlNewTextReader (xmlParserInputBufferPtr input, const char *URI); xmlTextReaderPtr xmlNewTextReaderFilename (const char *URI); void xmlFreeTextReader (xmlTextReaderPtr reader); int xmlTextReaderRead (xmlTextReaderPtr reader); xmlChar* xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); xmlChar* xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); xmlChar* xmlTextReaderReadString (xmlTextReaderPtr reader); int xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); int xmlTextReaderAttributeCount (xmlTextReaderPtr reader); xmlChar* xmlTextReaderBaseUri (xmlTextReaderPtr reader); int xmlTextReaderDepth (xmlTextReaderPtr reader); int xmlTextReaderHasAttributes (xmlTextReaderPtr reader); int xmlTextReaderHasValue (xmlTextReaderPtr reader); int xmlTextReaderIsDefault (xmlTextReaderPtr reader); int xmlTextReaderIsEmptyElement (xmlTextReaderPtr reader); xmlChar* xmlTextReaderLocalName (xmlTextReaderPtr reader); xmlChar* xmlTextReaderName (xmlTextReaderPtr reader); xmlChar* xmlTextReaderNamespaceUri (xmlTextReaderPtr reader); int xmlTextReaderNodeType (xmlTextReaderPtr reader); xmlChar* xmlTextReaderPrefix (xmlTextReaderPtr reader); int xmlTextReaderQuoteChar (xmlTextReaderPtr reader); xmlChar* xmlTextReaderValue (xmlTextReaderPtr reader); xmlChar* xmlTextReaderXmlLang (xmlTextReaderPtr reader); int xmlTextReaderReadState (xmlTextReaderPtr reader); int xmlTextReaderClose (xmlTextReaderPtr reader); xmlChar* xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, int no); xmlChar* xmlTextReaderGetAttribute (xmlTextReaderPtr reader, const xmlChar *name); xmlChar* xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); xmlParserInputBufferPtr xmlTextReaderGetRemainder (xmlTextReaderPtr reader); xmlChar* xmlTextReaderLookupNamespace (xmlTextReaderPtr reader, const xmlChar *prefix); int xmlTextReaderMoveToAttributeNo (xmlTextReaderPtr reader, int no); int xmlTextReaderMoveToAttribute (xmlTextReaderPtr reader, const xmlChar *name); int xmlTextReaderMoveToAttributeNs (xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); int xmlTextReaderMoveToFirstAttribute (xmlTextReaderPtr reader); int xmlTextReaderMoveToNextAttribute (xmlTextReaderPtr reader); int xmlTextReaderMoveToElement (xmlTextReaderPtr reader); int xmlTextReaderNormalization (xmlTextReaderPtr reader); int xmlTextReaderSetParserProp (xmlTextReaderPtr reader, int prop, int value); int xmlTextReaderGetParserProp (xmlTextReaderPtr reader, int prop); xmlNodePtr xmlTextReaderCurrentNode (xmlTextReaderPtr reader); xmlDocPtr xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); xmlNodePtr xmlTextReaderExpand (xmlTextReaderPtr reader); int xmlTextReaderNext (xmlTextReaderPtr reader); int xmlTextReaderIsValid (xmlTextReaderPtr reader); int xmlTextReaderRelaxNGValidate (xmlTextReaderPtr reader, const char *rng); int xmlTextReaderRelaxNGSetSchema (xmlTextReaderPtr reader, xmlRelaxNGPtr schema); typedef xmlTextReaderLocatorPtr; void (*xmlTextReaderErrorFunc) (void *arg, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator); int xmlTextReaderLocatorLineNumber (xmlTextReaderLocatorPtr locator); xmlChar* xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); void xmlTextReaderSetErrorHandler (xmlTextReaderPtr reader, xmlTextReaderErrorFunc f, void *arg); void xmlTextReaderGetErrorHandler (xmlTextReaderPtr reader, xmlTextReaderErrorFunc *f, void **arg);
typedef enum { XML_PARSER_LOADDTD = 1, XML_PARSER_DEFAULTATTRS = 2, XML_PARSER_VALIDATE = 3, XML_PARSER_SUBST_ENTITIES = 4 } xmlParserProperties;
typedef enum { XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, XML_PARSER_SEVERITY_WARNING = 3, XML_PARSER_SEVERITY_ERROR = 4 } xmlParserSeverities;
typedef enum { XML_READER_TYPE_NONE = 0, XML_READER_TYPE_ELEMENT = 1, XML_READER_TYPE_ATTRIBUTE = 2, XML_READER_TYPE_TEXT = 3, XML_READER_TYPE_CDATA = 4, XML_READER_TYPE_ENTITY_REFERENCE = 5, XML_READER_TYPE_ENTITY = 6, XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, XML_READER_TYPE_COMMENT = 8, XML_READER_TYPE_DOCUMENT = 9, XML_READER_TYPE_DOCUMENT_TYPE = 10, XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, XML_READER_TYPE_NOTATION = 12, XML_READER_TYPE_WHITESPACE = 13, XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, XML_READER_TYPE_END_ELEMENT = 15, XML_READER_TYPE_END_ENTITY = 16, XML_READER_TYPE_XML_DECLARATION = 17 } xmlReaderTypes;
xmlTextReaderPtr xmlNewTextReader (xmlParserInputBufferPtr input, const char *URI);
Create an xmlTextReader structure fed with input
input : | the xmlParserInputBufferPtr used to read data |
URI : | the URI information for the source if available |
Returns : | the new xmlTextReaderPtr or NULL in case of error |
xmlTextReaderPtr xmlNewTextReaderFilename (const char *URI);
Create an xmlTextReader structure fed with the resource at URI
URI : | the URI of the resource to process |
Returns : | the new xmlTextReaderPtr or NULL in case of error |
void xmlFreeTextReader (xmlTextReaderPtr reader);
Deallocate all the resources associated to the reader
reader : | the xmlTextReaderPtr |
int xmlTextReaderRead (xmlTextReaderPtr reader);
Moves the position of the current instance to the next node in the stream, exposing its properties.
reader : | the xmlTextReaderPtr used |
Returns : | 1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error |
xmlChar* xmlTextReaderReadInnerXml (xmlTextReaderPtr reader);
Reads the contents of the current node, including child nodes and markup.
reader : | the xmlTextReaderPtr 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. |
xmlChar* xmlTextReaderReadOuterXml (xmlTextReaderPtr reader);
Reads the contents of the current node, including child nodes and markup.
reader : | the xmlTextReaderPtr 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. |
xmlChar* xmlTextReaderReadString (xmlTextReaderPtr reader);
Reads the contents of an element or a text node as a string.
reader : | the xmlTextReaderPtr used |
Returns : | a string containing the contents of the Element or Text node, or NULL if the reader is positioned on any other type of node. The string must be deallocated by the caller. |
int xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader);
Parses an attribute value into one or more Text and EntityReference nodes.
reader : | the xmlTextReaderPtr used |
Returns : | 1 in case of success, 0 if the reader was not positionned on an ttribute node or all the attribute values have been read, or -1 in case of error. |
int xmlTextReaderAttributeCount (xmlTextReaderPtr reader);
Provides the number of attributes of the current node
reader : | the xmlTextReaderPtr used |
Returns : | 0 i no attributes, -1 in case of error or the attribute count |
xmlChar* xmlTextReaderBaseUri (xmlTextReaderPtr reader);
The base URI of the node.
reader : | the xmlTextReaderPtr used |
Returns : | the base URI or NULL if not available |
int xmlTextReaderDepth (xmlTextReaderPtr reader);
The depth of the node in the tree.
reader : | the xmlTextReaderPtr used |
Returns : | the depth or -1 in case of error |
int xmlTextReaderHasAttributes (xmlTextReaderPtr reader);
Whether the node has attributes.
reader : | the xmlTextReaderPtr used |
Returns : | 1 if true, 0 if false, and -1 in case or error |
int xmlTextReaderHasValue (xmlTextReaderPtr reader);
Whether the node can have a text value.
reader : | the xmlTextReaderPtr used |
Returns : | 1 if true, 0 if false, and -1 in case or error |
int xmlTextReaderIsDefault (xmlTextReaderPtr reader);
Whether an Attribute node was generated from the default value defined in the DTD or schema.
reader : | the xmlTextReaderPtr used |
Returns : | 0 if not defaulted, 1 if defaulted, and -1 in case of error |
int xmlTextReaderIsEmptyElement (xmlTextReaderPtr reader);
Check if the current node is empty
reader : | the xmlTextReaderPtr used |
Returns : | 1 if empty, 0 if not and -1 in case of error |
xmlChar* xmlTextReaderLocalName (xmlTextReaderPtr reader);
The local name of the node.
reader : | the xmlTextReaderPtr used |
Returns : | the local name or NULL if not available |
xmlChar* xmlTextReaderName (xmlTextReaderPtr reader);
The qualified name of the node, equal to Prefix :LocalName.
reader : | the xmlTextReaderPtr used |
Returns : | the local name or NULL if not available |
xmlChar* xmlTextReaderNamespaceUri (xmlTextReaderPtr reader);
The URI defining the namespace associated with the node.
reader : | the xmlTextReaderPtr used |
Returns : | the namespace URI or NULL if not available |
int xmlTextReaderNodeType (xmlTextReaderPtr reader);
Get the node type of the current node Reference: http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html
reader : | the xmlTextReaderPtr used |
Returns : | the xmlNodeType of the current node or -1 in case of error |
xmlChar* xmlTextReaderPrefix (xmlTextReaderPtr reader);
A shorthand reference to the namespace associated with the node.
reader : | the xmlTextReaderPtr used |
Returns : | the prefix or NULL if not available |
int xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
The quotation mark character used to enclose the value of an attribute.
reader : | the xmlTextReaderPtr used |
Returns : | " or ' and -1 in case of error |
xmlChar* xmlTextReaderValue (xmlTextReaderPtr reader);
Provides the text value of the node if present
reader : | the xmlTextReaderPtr used |
Returns : | the string or NULL if not available. The retsult must be deallocated with xmlFree() |
xmlChar* xmlTextReaderXmlLang (xmlTextReaderPtr reader);
The xml:lang scope within which the node resides.
reader : | the xmlTextReaderPtr used |
Returns : | the xml:lang value or NULL if none exists. |
int xmlTextReaderReadState (xmlTextReaderPtr reader);
Gets the read state of the reader.
reader : | the xmlTextReaderPtr used |
Returns : | the state value, or -1 in case of error |
int xmlTextReaderClose (xmlTextReaderPtr reader);
This method releases any resources allocated by the current instance changes the state to Closed and close any underlying input.
reader : | the xmlTextReaderPtr used |
Returns : | 0 or -1 in case of error |
xmlChar* xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, int no);
Provides the value of the attribute with the specified index relative to the containing element.
reader : | the xmlTextReaderPtr used |
no : | the 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. |
xmlChar* xmlTextReaderGetAttribute (xmlTextReaderPtr reader, const xmlChar *name);
Provides the value of the attribute with the specified qualified name.
reader : | the xmlTextReaderPtr used |
name : | the 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. |
xmlChar* xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI);
Provides the value of the specified attribute
reader : | the xmlTextReaderPtr used |
localName : | the local name of the attribute. |
namespaceURI : | the 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. |
xmlParserInputBufferPtr xmlTextReaderGetRemainder (xmlTextReaderPtr 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.
reader : | the xmlTextReaderPtr used |
Returns : | the xmlParserInputBufferPtr attached to the XML or NULL in case of error. |
xmlChar* xmlTextReaderLookupNamespace (xmlTextReaderPtr reader, const xmlChar *prefix);
Resolves a namespace prefix in the scope of the current element.
reader : | the xmlTextReaderPtr used |
prefix : | the 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. |
int xmlTextReaderMoveToAttributeNo (xmlTextReaderPtr reader, int no);
Moves the position of the current instance to the attribute with the specified index relative to the containing element.
reader : | the xmlTextReaderPtr used |
no : | the 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 |
int xmlTextReaderMoveToAttribute (xmlTextReaderPtr reader, const xmlChar *name);
Moves the position of the current instance to the attribute with the specified qualified name.
reader : | the xmlTextReaderPtr used |
name : | the qualified name of the attribute. |
Returns : | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToAttributeNs (xmlTextReaderPtr 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.
reader : | the xmlTextReaderPtr used |
localName : | the local name of the attribute. |
namespaceURI : | the namespace URI of the attribute. |
Returns : | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToFirstAttribute (xmlTextReaderPtr reader);
Moves the position of the current instance to the first attribute associated with the current node.
reader : | the xmlTextReaderPtr used |
Returns : | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToNextAttribute (xmlTextReaderPtr reader);
Moves the position of the current instance to the next attribute associated with the current node.
reader : | the xmlTextReaderPtr used |
Returns : | 1 in case of success, -1 in case of error, 0 if not found |
int xmlTextReaderMoveToElement (xmlTextReaderPtr reader);
Moves the position of the current instance to the node that contains the current Attribute node.
reader : | the xmlTextReaderPtr used |
Returns : | 1 in case of success, -1 in case of error, 0 if not moved |
int xmlTextReaderNormalization (xmlTextReaderPtr 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 bahaviour of
accepting out of range character entities like &
reader : | the xmlTextReaderPtr used |
Returns : | 1 or -1 in case of error. |
int xmlTextReaderSetParserProp (xmlTextReaderPtr 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.
reader : | the xmlTextReaderPtr used |
prop : | the xmlParserProperties to set |
value : | usually 0 or 1 to (de)activate it |
Returns : | 0 if the call was successful, or -1 in case of error |
int xmlTextReaderGetParserProp (xmlTextReaderPtr reader, int prop);
Read the parser internal property.
reader : | the xmlTextReaderPtr used |
prop : | the xmlParserProperties to get |
Returns : | the value, usually 0 or 1, or -1 in case of error. |
xmlNodePtr xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
Hacking interface allowing to get the xmlNodePtr correponding to the current node being accessed by the xmlTextReader. This is dangerous because the underlying node may be destroyed on the next Reads.
reader : | the xmlTextReaderPtr used |
Returns : | the xmlNodePtr or NULL in case of error. |
xmlDocPtr xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
Hacking interface allowing to get the xmlDocPtr correponding to the current document being accessed by the xmlTextReader. This is dangerous because the associated node may be destroyed on the next Reads.
reader : | the xmlTextReaderPtr used |
Returns : | the xmlDocPtr or NULL in case of error. |
xmlNodePtr xmlTextReaderExpand (xmlTextReaderPtr reader);
Reads the contents of the current node and the full subtree. It then makes the subtree available until the next xmlTextReaderRead() call
reader : | the xmlTextReaderPtr used |
Returns : | a node pointer valid until the next xmlTextReaderRead() call or NULL in case of error. |
int xmlTextReaderNext (xmlTextReaderPtr reader);
Skip to the node following the current one in document order while avoiding the subtree if any.
reader : | the xmlTextReaderPtr used |
Returns : | 1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error |
int xmlTextReaderIsValid (xmlTextReaderPtr reader);
Retrieve the validity status from the parser context
reader : | the xmlTextReaderPtr used |
Returns : | the flag value 1 if valid, 0 if no, and -1 in case of error |
int xmlTextReaderRelaxNGValidate (xmlTextReaderPtr reader, const char *rng);
Use RelaxNG to validate the document as it is processed.
Activation is only possible before the first
reader : | the xmlTextReaderPtr used |
rng : | the path to a RelaxNG schema or NULL |
Returns : | 0 in case the RelaxNG validation could be (des)activated and -1 in case of error. |
int xmlTextReaderRelaxNGSetSchema (xmlTextReaderPtr reader, xmlRelaxNGPtr schema);
Use RelaxNG to validate the document as it is processed.
Activation is only possible before the first
reader : | the xmlTextReaderPtr used |
schema : | a precompiled RelaxNG schema |
Returns : | 0 in case the RelaxNG validation could be (des)activated and -1 in case of error. |
void (*xmlTextReaderErrorFunc) (void *arg, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator);
arg : | |
msg : | |
severity : | |
locator : |
int xmlTextReaderLocatorLineNumber (xmlTextReaderLocatorPtr locator);
Obtain the line number for the given locator.
locator : | the xmlTextReaderLocatorPtr used |
Returns : | the line number or -1 in case of error. |
xmlChar* xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
Obtain the base URI for the given locator.
locator : | the xmlTextReaderLocatorPtr used |
Returns : | the base URI or NULL in case of error. |
void xmlTextReaderSetErrorHandler (xmlTextReaderPtr reader, xmlTextReaderErrorFunc f, void *arg);
Register a callback function that will be called on error and warnings.
If f is NULL, the default error and warning handlers are restored.
reader : | the xmlTextReaderPtr used |
f : | the callback function to call on error and warnings |
arg : | a user argument to pass to the callback function |
void xmlTextReaderGetErrorHandler (xmlTextReaderPtr reader, xmlTextReaderErrorFunc *f, void **arg);
Retrieve the error callback function and user argument.
reader : | the xmlTextReaderPtr used |
f : | the callback function or NULL is no callback has been registered |
arg : | a user argument |
<< xinclude | debugXML >> |