Path: blob/master/venv/Lib/site-packages/lxml/includes/libxml/xmlreader.h
811 views
/*1* Summary: the XMLReader implementation2* Description: API of the XML streaming API based on C# interfaces.3*4* Copy: See Copyright for the status of this software.5*6* Author: Daniel Veillard7*/89#ifndef __XML_XMLREADER_H__10#define __XML_XMLREADER_H__1112#include <libxml/xmlversion.h>13#include <libxml/tree.h>14#include <libxml/xmlIO.h>15#ifdef LIBXML_SCHEMAS_ENABLED16#include <libxml/relaxng.h>17#include <libxml/xmlschemas.h>18#endif1920#ifdef __cplusplus21extern "C" {22#endif2324/**25* xmlParserSeverities:26*27* How severe an error callback is when the per-reader error callback API28* is used.29*/30typedef enum {31XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,32XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,33XML_PARSER_SEVERITY_WARNING = 3,34XML_PARSER_SEVERITY_ERROR = 435} xmlParserSeverities;3637#ifdef LIBXML_READER_ENABLED3839/**40* xmlTextReaderMode:41*42* Internal state values for the reader.43*/44typedef enum {45XML_TEXTREADER_MODE_INITIAL = 0,46XML_TEXTREADER_MODE_INTERACTIVE = 1,47XML_TEXTREADER_MODE_ERROR = 2,48XML_TEXTREADER_MODE_EOF =3,49XML_TEXTREADER_MODE_CLOSED = 4,50XML_TEXTREADER_MODE_READING = 551} xmlTextReaderMode;5253/**54* xmlParserProperties:55*56* Some common options to use with xmlTextReaderSetParserProp, but it57* is better to use xmlParserOption and the xmlReaderNewxxx and58* xmlReaderForxxx APIs now.59*/60typedef enum {61XML_PARSER_LOADDTD = 1,62XML_PARSER_DEFAULTATTRS = 2,63XML_PARSER_VALIDATE = 3,64XML_PARSER_SUBST_ENTITIES = 465} xmlParserProperties;6667/**68* xmlReaderTypes:69*70* Predefined constants for the different types of nodes.71*/72typedef enum {73XML_READER_TYPE_NONE = 0,74XML_READER_TYPE_ELEMENT = 1,75XML_READER_TYPE_ATTRIBUTE = 2,76XML_READER_TYPE_TEXT = 3,77XML_READER_TYPE_CDATA = 4,78XML_READER_TYPE_ENTITY_REFERENCE = 5,79XML_READER_TYPE_ENTITY = 6,80XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,81XML_READER_TYPE_COMMENT = 8,82XML_READER_TYPE_DOCUMENT = 9,83XML_READER_TYPE_DOCUMENT_TYPE = 10,84XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,85XML_READER_TYPE_NOTATION = 12,86XML_READER_TYPE_WHITESPACE = 13,87XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,88XML_READER_TYPE_END_ELEMENT = 15,89XML_READER_TYPE_END_ENTITY = 16,90XML_READER_TYPE_XML_DECLARATION = 1791} xmlReaderTypes;9293/**94* xmlTextReader:95*96* Structure for an xmlReader context.97*/98typedef struct _xmlTextReader xmlTextReader;99100/**101* xmlTextReaderPtr:102*103* Pointer to an xmlReader context.104*/105typedef xmlTextReader *xmlTextReaderPtr;106107/*108* Constructors & Destructor109*/110XMLPUBFUN xmlTextReaderPtr XMLCALL111xmlNewTextReader (xmlParserInputBufferPtr input,112const char *URI);113XMLPUBFUN xmlTextReaderPtr XMLCALL114xmlNewTextReaderFilename(const char *URI);115116XMLPUBFUN void XMLCALL117xmlFreeTextReader (xmlTextReaderPtr reader);118119XMLPUBFUN int XMLCALL120xmlTextReaderSetup(xmlTextReaderPtr reader,121xmlParserInputBufferPtr input, const char *URL,122const char *encoding, int options);123124/*125* Iterators126*/127XMLPUBFUN int XMLCALL128xmlTextReaderRead (xmlTextReaderPtr reader);129130#ifdef LIBXML_WRITER_ENABLED131XMLPUBFUN xmlChar * XMLCALL132xmlTextReaderReadInnerXml(xmlTextReaderPtr reader);133134XMLPUBFUN xmlChar * XMLCALL135xmlTextReaderReadOuterXml(xmlTextReaderPtr reader);136#endif137138XMLPUBFUN xmlChar * XMLCALL139xmlTextReaderReadString (xmlTextReaderPtr reader);140XMLPUBFUN int XMLCALL141xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader);142143/*144* Attributes of the node145*/146XMLPUBFUN int XMLCALL147xmlTextReaderAttributeCount(xmlTextReaderPtr reader);148XMLPUBFUN int XMLCALL149xmlTextReaderDepth (xmlTextReaderPtr reader);150XMLPUBFUN int XMLCALL151xmlTextReaderHasAttributes(xmlTextReaderPtr reader);152XMLPUBFUN int XMLCALL153xmlTextReaderHasValue(xmlTextReaderPtr reader);154XMLPUBFUN int XMLCALL155xmlTextReaderIsDefault (xmlTextReaderPtr reader);156XMLPUBFUN int XMLCALL157xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);158XMLPUBFUN int XMLCALL159xmlTextReaderNodeType (xmlTextReaderPtr reader);160XMLPUBFUN int XMLCALL161xmlTextReaderQuoteChar (xmlTextReaderPtr reader);162XMLPUBFUN int XMLCALL163xmlTextReaderReadState (xmlTextReaderPtr reader);164XMLPUBFUN int XMLCALL165xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);166167XMLPUBFUN const xmlChar * XMLCALL168xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);169XMLPUBFUN const xmlChar * XMLCALL170xmlTextReaderConstLocalName (xmlTextReaderPtr reader);171XMLPUBFUN const xmlChar * XMLCALL172xmlTextReaderConstName (xmlTextReaderPtr reader);173XMLPUBFUN const xmlChar * XMLCALL174xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);175XMLPUBFUN const xmlChar * XMLCALL176xmlTextReaderConstPrefix (xmlTextReaderPtr reader);177XMLPUBFUN const xmlChar * XMLCALL178xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);179XMLPUBFUN const xmlChar * XMLCALL180xmlTextReaderConstString (xmlTextReaderPtr reader,181const xmlChar *str);182XMLPUBFUN const xmlChar * XMLCALL183xmlTextReaderConstValue (xmlTextReaderPtr reader);184185/*186* use the Const version of the routine for187* better performance and simpler code188*/189XMLPUBFUN xmlChar * XMLCALL190xmlTextReaderBaseUri (xmlTextReaderPtr reader);191XMLPUBFUN xmlChar * XMLCALL192xmlTextReaderLocalName (xmlTextReaderPtr reader);193XMLPUBFUN xmlChar * XMLCALL194xmlTextReaderName (xmlTextReaderPtr reader);195XMLPUBFUN xmlChar * XMLCALL196xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);197XMLPUBFUN xmlChar * XMLCALL198xmlTextReaderPrefix (xmlTextReaderPtr reader);199XMLPUBFUN xmlChar * XMLCALL200xmlTextReaderXmlLang (xmlTextReaderPtr reader);201XMLPUBFUN xmlChar * XMLCALL202xmlTextReaderValue (xmlTextReaderPtr reader);203204/*205* Methods of the XmlTextReader206*/207XMLPUBFUN int XMLCALL208xmlTextReaderClose (xmlTextReaderPtr reader);209XMLPUBFUN xmlChar * XMLCALL210xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,211int no);212XMLPUBFUN xmlChar * XMLCALL213xmlTextReaderGetAttribute (xmlTextReaderPtr reader,214const xmlChar *name);215XMLPUBFUN xmlChar * XMLCALL216xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,217const xmlChar *localName,218const xmlChar *namespaceURI);219XMLPUBFUN xmlParserInputBufferPtr XMLCALL220xmlTextReaderGetRemainder (xmlTextReaderPtr reader);221XMLPUBFUN xmlChar * XMLCALL222xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,223const xmlChar *prefix);224XMLPUBFUN int XMLCALL225xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,226int no);227XMLPUBFUN int XMLCALL228xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,229const xmlChar *name);230XMLPUBFUN int XMLCALL231xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,232const xmlChar *localName,233const xmlChar *namespaceURI);234XMLPUBFUN int XMLCALL235xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);236XMLPUBFUN int XMLCALL237xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);238XMLPUBFUN int XMLCALL239xmlTextReaderMoveToElement (xmlTextReaderPtr reader);240XMLPUBFUN int XMLCALL241xmlTextReaderNormalization (xmlTextReaderPtr reader);242XMLPUBFUN const xmlChar * XMLCALL243xmlTextReaderConstEncoding (xmlTextReaderPtr reader);244245/*246* Extensions247*/248XMLPUBFUN int XMLCALL249xmlTextReaderSetParserProp (xmlTextReaderPtr reader,250int prop,251int value);252XMLPUBFUN int XMLCALL253xmlTextReaderGetParserProp (xmlTextReaderPtr reader,254int prop);255XMLPUBFUN xmlNodePtr XMLCALL256xmlTextReaderCurrentNode (xmlTextReaderPtr reader);257258XMLPUBFUN int XMLCALL259xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);260261XMLPUBFUN int XMLCALL262xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);263264XMLPUBFUN xmlNodePtr XMLCALL265xmlTextReaderPreserve (xmlTextReaderPtr reader);266#ifdef LIBXML_PATTERN_ENABLED267XMLPUBFUN int XMLCALL268xmlTextReaderPreservePattern(xmlTextReaderPtr reader,269const xmlChar *pattern,270const xmlChar **namespaces);271#endif /* LIBXML_PATTERN_ENABLED */272XMLPUBFUN xmlDocPtr XMLCALL273xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);274XMLPUBFUN xmlNodePtr XMLCALL275xmlTextReaderExpand (xmlTextReaderPtr reader);276XMLPUBFUN int XMLCALL277xmlTextReaderNext (xmlTextReaderPtr reader);278XMLPUBFUN int XMLCALL279xmlTextReaderNextSibling (xmlTextReaderPtr reader);280XMLPUBFUN int XMLCALL281xmlTextReaderIsValid (xmlTextReaderPtr reader);282#ifdef LIBXML_SCHEMAS_ENABLED283XMLPUBFUN int XMLCALL284xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,285const char *rng);286XMLPUBFUN int XMLCALL287xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader,288xmlRelaxNGValidCtxtPtr ctxt,289int options);290291XMLPUBFUN int XMLCALL292xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,293xmlRelaxNGPtr schema);294XMLPUBFUN int XMLCALL295xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,296const char *xsd);297XMLPUBFUN int XMLCALL298xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,299xmlSchemaValidCtxtPtr ctxt,300int options);301XMLPUBFUN int XMLCALL302xmlTextReaderSetSchema (xmlTextReaderPtr reader,303xmlSchemaPtr schema);304#endif305XMLPUBFUN const xmlChar * XMLCALL306xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);307XMLPUBFUN int XMLCALL308xmlTextReaderStandalone (xmlTextReaderPtr reader);309310311/*312* Index lookup313*/314XMLPUBFUN long XMLCALL315xmlTextReaderByteConsumed (xmlTextReaderPtr reader);316317/*318* New more complete APIs for simpler creation and reuse of readers319*/320XMLPUBFUN xmlTextReaderPtr XMLCALL321xmlReaderWalker (xmlDocPtr doc);322XMLPUBFUN xmlTextReaderPtr XMLCALL323xmlReaderForDoc (const xmlChar * cur,324const char *URL,325const char *encoding,326int options);327XMLPUBFUN xmlTextReaderPtr XMLCALL328xmlReaderForFile (const char *filename,329const char *encoding,330int options);331XMLPUBFUN xmlTextReaderPtr XMLCALL332xmlReaderForMemory (const char *buffer,333int size,334const char *URL,335const char *encoding,336int options);337XMLPUBFUN xmlTextReaderPtr XMLCALL338xmlReaderForFd (int fd,339const char *URL,340const char *encoding,341int options);342XMLPUBFUN xmlTextReaderPtr XMLCALL343xmlReaderForIO (xmlInputReadCallback ioread,344xmlInputCloseCallback ioclose,345void *ioctx,346const char *URL,347const char *encoding,348int options);349350XMLPUBFUN int XMLCALL351xmlReaderNewWalker (xmlTextReaderPtr reader,352xmlDocPtr doc);353XMLPUBFUN int XMLCALL354xmlReaderNewDoc (xmlTextReaderPtr reader,355const xmlChar * cur,356const char *URL,357const char *encoding,358int options);359XMLPUBFUN int XMLCALL360xmlReaderNewFile (xmlTextReaderPtr reader,361const char *filename,362const char *encoding,363int options);364XMLPUBFUN int XMLCALL365xmlReaderNewMemory (xmlTextReaderPtr reader,366const char *buffer,367int size,368const char *URL,369const char *encoding,370int options);371XMLPUBFUN int XMLCALL372xmlReaderNewFd (xmlTextReaderPtr reader,373int fd,374const char *URL,375const char *encoding,376int options);377XMLPUBFUN int XMLCALL378xmlReaderNewIO (xmlTextReaderPtr reader,379xmlInputReadCallback ioread,380xmlInputCloseCallback ioclose,381void *ioctx,382const char *URL,383const char *encoding,384int options);385/*386* Error handling extensions387*/388typedef void * xmlTextReaderLocatorPtr;389390/**391* xmlTextReaderErrorFunc:392* @arg: the user argument393* @msg: the message394* @severity: the severity of the error395* @locator: a locator indicating where the error occurred396*397* Signature of an error callback from a reader parser398*/399typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg,400const char *msg,401xmlParserSeverities severity,402xmlTextReaderLocatorPtr locator);403XMLPUBFUN int XMLCALL404xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);405XMLPUBFUN xmlChar * XMLCALL406xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);407XMLPUBFUN void XMLCALL408xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,409xmlTextReaderErrorFunc f,410void *arg);411XMLPUBFUN void XMLCALL412xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,413xmlStructuredErrorFunc f,414void *arg);415XMLPUBFUN void XMLCALL416xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,417xmlTextReaderErrorFunc *f,418void **arg);419420#endif /* LIBXML_READER_ENABLED */421422#ifdef __cplusplus423}424#endif425426#endif /* __XML_XMLREADER_H__ */427428429430