Gnome XML Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# xmlreader

## Name

xmlreader --

## Synopsis

    enum        xmlParserProperties;
    enum        xmlParserSeverities;
    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);
    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);

## Description

## Details

### enum xmlParserProperties

    typedef enum {
        XML_PARSER_LOADDTD = 1,
        XML_PARSER_DEFAULTATTRS = 2,
        XML_PARSER_VALIDATE = 3,
        XML_PARSER_SUBST_ENTITIES = 4
    } xmlParserProperties;

### enum xmlParserSeverities

    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;

### struct xmlTextReader

    struct xmlTextReader;

### xmlTextReaderPtr

### xmlNewTextReader ()

    xmlTextReaderPtr xmlNewTextReader           (xmlParserInputBufferPtr input,
                                                 const char *URI);

Create an xmlTextReader structure fed with `input`

`input` : |
`URI` : |
Returns : |

### xmlNewTextReaderFilename ()

    xmlTextReaderPtr xmlNewTextReaderFilename   (const char *URI);

Create an xmlTextReader structure fed with the resource at `URI`

`URI` : |
Returns : |

### xmlFreeTextReader ()

    void        xmlFreeTextReader               (xmlTextReaderPtr reader);

Deallocate all the resources associated to the reader

`reader` : |

### xmlTextReaderRead ()

    int         xmlTextReaderRead               (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderReadInnerXml ()

    xmlChar*    xmlTextReaderReadInnerXml       (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderReadOuterXml ()

    xmlChar*    xmlTextReaderReadOuterXml       (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderReadString ()

    xmlChar*    xmlTextReaderReadString         (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderReadAttributeValue ()

    int         xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderAttributeCount ()

    int         xmlTextReaderAttributeCount     (xmlTextReaderPtr reader);

Provides the number of attributes of the current node

`reader` : |
Returns : |

### xmlTextReaderBaseUri ()

    xmlChar*    xmlTextReaderBaseUri            (xmlTextReaderPtr reader);

The base URI of the node.

`reader` : |
Returns : |

### xmlTextReaderDepth ()

    int         xmlTextReaderDepth              (xmlTextReaderPtr reader);

The depth of the node in the tree.

`reader` : |
Returns : |

### xmlTextReaderHasAttributes ()

    int         xmlTextReaderHasAttributes      (xmlTextReaderPtr reader);

Whether the node has attributes.

`reader` : |
Returns : |

### xmlTextReaderHasValue ()

    int         xmlTextReaderHasValue           (xmlTextReaderPtr reader);

Whether the node can have a text value.

`reader` : |
Returns : |

### xmlTextReaderIsDefault ()

    int         xmlTextReaderIsDefault          (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderIsEmptyElement ()

    int         xmlTextReaderIsEmptyElement     (xmlTextReaderPtr reader);

Check if the current node is empty

`reader` : |
Returns : |

### xmlTextReaderLocalName ()

    xmlChar*    xmlTextReaderLocalName          (xmlTextReaderPtr reader);

The local name of the node.

`reader` : |
Returns : |

### xmlTextReaderName ()

    xmlChar*    xmlTextReaderName               (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderNamespaceUri ()

    xmlChar*    xmlTextReaderNamespaceUri       (xmlTextReaderPtr reader);

The URI defining the namespace associated with the node.

`reader` : |
Returns : |

### xmlTextReaderNodeType ()

    int         xmlTextReaderNodeType           (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderPrefix ()

    xmlChar*    xmlTextReaderPrefix             (xmlTextReaderPtr reader);

A shorthand reference to the namespace associated with the node.

`reader` : |
Returns : |

### xmlTextReaderQuoteChar ()

    int         xmlTextReaderQuoteChar          (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderValue ()

    xmlChar*    xmlTextReaderValue              (xmlTextReaderPtr reader);

Provides the text value of the node if present

`reader` : |
Returns : |

### xmlTextReaderXmlLang ()

    xmlChar*    xmlTextReaderXmlLang            (xmlTextReaderPtr reader);

The xml:lang scope within which the node resides.

`reader` : |
Returns : |

### xmlTextReaderReadState ()

    int         xmlTextReaderReadState          (xmlTextReaderPtr reader);

Gets the read state of the reader.

`reader` : |
Returns : |

### xmlTextReaderClose ()

    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` : |
Returns : |

### xmlTextReaderGetAttributeNo ()

    xmlChar*    xmlTextReaderGetAttributeNo     (xmlTextReaderPtr reader,
                                                 int no);

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

`reader` : |
`no` : |
Returns : |

### xmlTextReaderGetAttribute ()

    xmlChar*    xmlTextReaderGetAttribute       (xmlTextReaderPtr reader,
                                                 const xmlChar *name);

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

`reader` : |
`name` : |
Returns : |

### xmlTextReaderGetAttributeNs ()

    xmlChar*    xmlTextReaderGetAttributeNs     (xmlTextReaderPtr reader,
                                                 const xmlChar *localName,
                                                 const xmlChar *namespaceURI);

Provides the value of the specified attribute

`reader` : |
`localName` : |
`namespaceURI` : |
Returns : |

### xmlTextReaderGetRemainder ()

    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` : |
Returns : |

### xmlTextReaderLookupNamespace ()

    xmlChar*    xmlTextReaderLookupNamespace    (xmlTextReaderPtr reader,
                                                 const xmlChar *prefix);

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

`reader` : |
`prefix` : |
Returns : |

### xmlTextReaderMoveToAttributeNo ()

    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` : |
`no` : |
Returns : |

### xmlTextReaderMoveToAttribute ()

    int         xmlTextReaderMoveToAttribute    (xmlTextReaderPtr reader,
                                                 const xmlChar *name);

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

`reader` : |
`name` : |
Returns : |

### xmlTextReaderMoveToAttributeNs ()

    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` : |
`localName` : |
`namespaceURI` : |
Returns : |

### xmlTextReaderMoveToFirstAttribute ()

    int         xmlTextReaderMoveToFirstAttribute
                                                (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderMoveToNextAttribute ()

    int         xmlTextReaderMoveToNextAttribute
                                                (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderMoveToElement ()

    int         xmlTextReaderMoveToElement      (xmlTextReaderPtr reader);

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

`reader` : |
Returns : |

### xmlTextReaderNormalization ()

    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 &0; is of course not supported either.

`reader` : |
Returns : |

### xmlTextReaderSetParserProp ()

    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` : |
`prop` : |
`value` : |
Returns : |

### xmlTextReaderGetParserProp ()

    int         xmlTextReaderGetParserProp      (xmlTextReaderPtr reader,
                                                 int prop);

Read the parser internal property.

`reader` : |
`prop` : |
Returns : |

### xmlTextReaderCurrentNode ()

    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` : |
Returns : |

### xmlTextReaderCurrentDoc ()

    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` : |
Returns : |

### xmlTextReaderLocatorPtr

### xmlTextReaderErrorFunc ()

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

`arg` : |
`msg` : |
`severity` : |
`locator` : |

### xmlTextReaderLocatorLineNumber ()

    int         xmlTextReaderLocatorLineNumber  (xmlTextReaderLocatorPtr locator);

Obtain the line number for the given locator.

`locator` : |
Returns : |

### xmlTextReaderLocatorBaseURI ()

    xmlChar*    xmlTextReaderLocatorBaseURI     (xmlTextReaderLocatorPtr locator);

Obtain the base URI for the given locator.

`locator` : |
Returns : |

### xmlTextReaderSetErrorHandler ()

    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` : |
`f` : |
`arg` : |

### xmlTextReaderGetErrorHandler ()

    void        xmlTextReaderGetErrorHandler    (xmlTextReaderPtr reader,
                                                 xmlTextReaderErrorFunc *f,
                                                 void **arg);

Retrieve the error callback function and user argument.

`reader` : |
`f` : |
`arg` : |

<<< Previous Page | Home | Up | Next Page >>>
parser | SAX