imgtools/imgcheck/libxml/xmlreader.h
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2  * Summary: the XMLReader implementation
       
     3  * Description: API of the XML streaming API based on C# interfaces.
       
     4  *
       
     5  * Copy: See Copyright for the status of this software.
       
     6  *
       
     7  * Author: Daniel Veillard
       
     8  */
       
     9 
       
    10 #ifndef __XML_XMLREADER_H__
       
    11 #define __XML_XMLREADER_H__
       
    12 
       
    13 #include <libxml/xmlversion.h>
       
    14 #include <libxml/tree.h>
       
    15 #include <libxml/xmlIO.h>
       
    16 #ifdef LIBXML_SCHEMAS_ENABLED
       
    17 #include <libxml/relaxng.h>
       
    18 #include <libxml/xmlschemas.h>
       
    19 #endif
       
    20 
       
    21 #ifdef LIBXML_READER_ENABLED
       
    22 
       
    23 #ifdef __cplusplus
       
    24 extern "C" {
       
    25 #endif
       
    26 
       
    27 /**
       
    28  * xmlTextReaderMode:
       
    29  *
       
    30  * Internal state values for the reader.
       
    31  */
       
    32 typedef enum {
       
    33     XML_TEXTREADER_MODE_INITIAL = 0,
       
    34     XML_TEXTREADER_MODE_INTERACTIVE = 1,
       
    35     XML_TEXTREADER_MODE_ERROR = 2,
       
    36     XML_TEXTREADER_MODE_EOF =3,
       
    37     XML_TEXTREADER_MODE_CLOSED = 4,
       
    38     XML_TEXTREADER_MODE_READING = 5
       
    39 } xmlTextReaderMode;
       
    40 
       
    41 /**
       
    42  * xmlParserProperties:
       
    43  *
       
    44  * Some common options to use with xmlTextReaderSetParserProp, but it
       
    45  * is better to use xmlParserOption and the xmlReaderNewxxx and 
       
    46  * xmlReaderForxxx APIs now.
       
    47  */
       
    48 typedef enum {
       
    49     XML_PARSER_LOADDTD = 1,
       
    50     XML_PARSER_DEFAULTATTRS = 2,
       
    51     XML_PARSER_VALIDATE = 3,
       
    52     XML_PARSER_SUBST_ENTITIES = 4
       
    53 } xmlParserProperties;
       
    54 
       
    55 /**
       
    56  * xmlParserSeverities:
       
    57  *
       
    58  * How severe an error callback is when the per-reader error callback API
       
    59  * is used.
       
    60  */
       
    61 typedef enum {
       
    62     XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
       
    63     XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
       
    64     XML_PARSER_SEVERITY_WARNING = 3,
       
    65     XML_PARSER_SEVERITY_ERROR = 4
       
    66 } xmlParserSeverities;
       
    67 
       
    68 /**
       
    69  * xmlReaderTypes:
       
    70  *
       
    71  * Predefined constants for the different types of nodes.
       
    72  */
       
    73 typedef enum {
       
    74     XML_READER_TYPE_NONE = 0,
       
    75     XML_READER_TYPE_ELEMENT = 1,
       
    76     XML_READER_TYPE_ATTRIBUTE = 2,
       
    77     XML_READER_TYPE_TEXT = 3,
       
    78     XML_READER_TYPE_CDATA = 4,
       
    79     XML_READER_TYPE_ENTITY_REFERENCE = 5,
       
    80     XML_READER_TYPE_ENTITY = 6,
       
    81     XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
       
    82     XML_READER_TYPE_COMMENT = 8,
       
    83     XML_READER_TYPE_DOCUMENT = 9,
       
    84     XML_READER_TYPE_DOCUMENT_TYPE = 10,
       
    85     XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
       
    86     XML_READER_TYPE_NOTATION = 12,
       
    87     XML_READER_TYPE_WHITESPACE = 13,
       
    88     XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
       
    89     XML_READER_TYPE_END_ELEMENT = 15,
       
    90     XML_READER_TYPE_END_ENTITY = 16,
       
    91     XML_READER_TYPE_XML_DECLARATION = 17
       
    92 } xmlReaderTypes;
       
    93 
       
    94 /**
       
    95  * xmlTextReader:
       
    96  *
       
    97  * Structure for an xmlReader context.
       
    98  */
       
    99 typedef struct _xmlTextReader xmlTextReader;
       
   100 
       
   101 /**
       
   102  * xmlTextReaderPtr:
       
   103  *
       
   104  * Pointer to an xmlReader context.
       
   105  */
       
   106 typedef xmlTextReader *xmlTextReaderPtr;
       
   107 
       
   108 /*
       
   109  * Constructors & Destructor
       
   110  */
       
   111 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   112 			xmlNewTextReader	(xmlParserInputBufferPtr input,
       
   113 	                                         const char *URI);
       
   114 XMLPUBFUN xmlTextReaderPtr XMLCALL	
       
   115 			xmlNewTextReaderFilename(const char *URI);
       
   116 XMLPUBFUN void XMLCALL			
       
   117 			xmlFreeTextReader	(xmlTextReaderPtr reader);
       
   118 
       
   119 /*
       
   120  * Iterators
       
   121  */
       
   122 XMLPUBFUN int XMLCALL		
       
   123 			xmlTextReaderRead	(xmlTextReaderPtr reader);
       
   124 
       
   125 #ifdef LIBXML_WRITER_ENABLED
       
   126 XMLPUBFUN xmlChar * XMLCALL	
       
   127 			xmlTextReaderReadInnerXml	(xmlTextReaderPtr reader);
       
   128 			
       
   129 XMLPUBFUN xmlChar * XMLCALL	
       
   130 			xmlTextReaderReadOuterXml	(xmlTextReaderPtr reader);
       
   131 #endif
       
   132 
       
   133 XMLPUBFUN xmlChar * XMLCALL	
       
   134 			xmlTextReaderReadString		(xmlTextReaderPtr reader);
       
   135 XMLPUBFUN int XMLCALL		
       
   136 			xmlTextReaderReadAttributeValue	(xmlTextReaderPtr reader);
       
   137 
       
   138 /*
       
   139  * Attributes of the node
       
   140  */
       
   141 XMLPUBFUN int XMLCALL		
       
   142 			xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
       
   143 XMLPUBFUN int XMLCALL		
       
   144 			xmlTextReaderDepth	(xmlTextReaderPtr reader);
       
   145 XMLPUBFUN int XMLCALL		
       
   146 			xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
       
   147 XMLPUBFUN int XMLCALL		
       
   148 			xmlTextReaderHasValue(xmlTextReaderPtr reader);
       
   149 XMLPUBFUN int XMLCALL		
       
   150 			xmlTextReaderIsDefault	(xmlTextReaderPtr reader);
       
   151 XMLPUBFUN int XMLCALL		
       
   152 			xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
       
   153 XMLPUBFUN int XMLCALL		
       
   154 			xmlTextReaderNodeType	(xmlTextReaderPtr reader);
       
   155 XMLPUBFUN int XMLCALL		
       
   156 			xmlTextReaderQuoteChar	(xmlTextReaderPtr reader);
       
   157 XMLPUBFUN int XMLCALL		
       
   158 			xmlTextReaderReadState	(xmlTextReaderPtr reader);
       
   159 XMLPUBFUN int XMLCALL
       
   160                         xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
       
   161 
       
   162 XMLPUBFUN const xmlChar * XMLCALL	
       
   163 		    xmlTextReaderConstBaseUri	(xmlTextReaderPtr reader);
       
   164 XMLPUBFUN const xmlChar * XMLCALL	
       
   165 		    xmlTextReaderConstLocalName	(xmlTextReaderPtr reader);
       
   166 XMLPUBFUN const xmlChar * XMLCALL	
       
   167 		    xmlTextReaderConstName	(xmlTextReaderPtr reader);
       
   168 XMLPUBFUN const xmlChar * XMLCALL	
       
   169 		    xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
       
   170 XMLPUBFUN const xmlChar * XMLCALL	
       
   171 		    xmlTextReaderConstPrefix	(xmlTextReaderPtr reader);
       
   172 XMLPUBFUN const xmlChar * XMLCALL	
       
   173 		    xmlTextReaderConstXmlLang	(xmlTextReaderPtr reader);
       
   174 XMLPUBFUN const xmlChar * XMLCALL	
       
   175 		    xmlTextReaderConstString	(xmlTextReaderPtr reader,
       
   176 		    				 const xmlChar *str);
       
   177 XMLPUBFUN const xmlChar * XMLCALL	
       
   178 		    xmlTextReaderConstValue	(xmlTextReaderPtr reader);
       
   179 
       
   180 /*
       
   181  * use the Const version of the routine for
       
   182  * better performance and simpler code
       
   183  */
       
   184 XMLPUBFUN xmlChar * XMLCALL	
       
   185 			xmlTextReaderBaseUri	(xmlTextReaderPtr reader);
       
   186 XMLPUBFUN xmlChar * XMLCALL	
       
   187 			xmlTextReaderLocalName	(xmlTextReaderPtr reader);
       
   188 XMLPUBFUN xmlChar * XMLCALL	
       
   189 			xmlTextReaderName	(xmlTextReaderPtr reader);
       
   190 XMLPUBFUN xmlChar * XMLCALL	
       
   191 			xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
       
   192 XMLPUBFUN xmlChar * XMLCALL	
       
   193 			xmlTextReaderPrefix	(xmlTextReaderPtr reader);
       
   194 XMLPUBFUN xmlChar * XMLCALL	
       
   195 			xmlTextReaderXmlLang	(xmlTextReaderPtr reader);
       
   196 XMLPUBFUN xmlChar * XMLCALL	
       
   197 			xmlTextReaderValue	(xmlTextReaderPtr reader);
       
   198 
       
   199 /*
       
   200  * Methods of the XmlTextReader
       
   201  */
       
   202 XMLPUBFUN int XMLCALL		
       
   203 		    xmlTextReaderClose		(xmlTextReaderPtr reader);
       
   204 XMLPUBFUN xmlChar * XMLCALL	
       
   205 		    xmlTextReaderGetAttributeNo	(xmlTextReaderPtr reader,
       
   206 						 int no);
       
   207 XMLPUBFUN xmlChar * XMLCALL	
       
   208 		    xmlTextReaderGetAttribute	(xmlTextReaderPtr reader,
       
   209 						 const xmlChar *name);
       
   210 XMLPUBFUN xmlChar * XMLCALL	
       
   211 		    xmlTextReaderGetAttributeNs	(xmlTextReaderPtr reader,
       
   212 						 const xmlChar *localName,
       
   213 						 const xmlChar *namespaceURI);
       
   214 XMLPUBFUN xmlParserInputBufferPtr XMLCALL 
       
   215 		    xmlTextReaderGetRemainder	(xmlTextReaderPtr reader);
       
   216 XMLPUBFUN xmlChar * XMLCALL	
       
   217 		    xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
       
   218 						 const xmlChar *prefix);
       
   219 XMLPUBFUN int XMLCALL		
       
   220 		    xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
       
   221 						 int no);
       
   222 XMLPUBFUN int XMLCALL		
       
   223 		    xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
       
   224 						 const xmlChar *name);
       
   225 XMLPUBFUN int XMLCALL		
       
   226 		    xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
       
   227 						 const xmlChar *localName,
       
   228 						 const xmlChar *namespaceURI);
       
   229 XMLPUBFUN int XMLCALL		
       
   230 		    xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
       
   231 XMLPUBFUN int XMLCALL		
       
   232 		    xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
       
   233 XMLPUBFUN int XMLCALL		
       
   234 		    xmlTextReaderMoveToElement	(xmlTextReaderPtr reader);
       
   235 XMLPUBFUN int XMLCALL		
       
   236 		    xmlTextReaderNormalization	(xmlTextReaderPtr reader);
       
   237 XMLPUBFUN const xmlChar * XMLCALL
       
   238 		    xmlTextReaderConstEncoding  (xmlTextReaderPtr reader);
       
   239 
       
   240 /*
       
   241  * Extensions
       
   242  */
       
   243 XMLPUBFUN int XMLCALL		
       
   244 		    xmlTextReaderSetParserProp	(xmlTextReaderPtr reader,
       
   245 						 int prop,
       
   246 						 int value);
       
   247 XMLPUBFUN int XMLCALL		
       
   248 		    xmlTextReaderGetParserProp	(xmlTextReaderPtr reader,
       
   249 						 int prop);
       
   250 XMLPUBFUN xmlNodePtr XMLCALL	
       
   251 		    xmlTextReaderCurrentNode	(xmlTextReaderPtr reader);
       
   252 
       
   253 XMLPUBFUN int XMLCALL
       
   254             xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
       
   255 
       
   256 XMLPUBFUN int XMLCALL
       
   257             xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
       
   258 
       
   259 XMLPUBFUN xmlNodePtr XMLCALL	
       
   260 		    xmlTextReaderPreserve	(xmlTextReaderPtr reader);
       
   261 #ifdef LIBXML_PATTERN_ENABLED
       
   262 XMLPUBFUN int XMLCALL	
       
   263 		    xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
       
   264 		    				 const xmlChar *pattern,
       
   265 						 const xmlChar **namespaces);
       
   266 #endif /* LIBXML_PATTERN_ENABLED */
       
   267 XMLPUBFUN xmlDocPtr XMLCALL	
       
   268 		    xmlTextReaderCurrentDoc	(xmlTextReaderPtr reader);
       
   269 XMLPUBFUN xmlNodePtr XMLCALL	
       
   270 		    xmlTextReaderExpand		(xmlTextReaderPtr reader);
       
   271 XMLPUBFUN int XMLCALL		
       
   272 		    xmlTextReaderNext		(xmlTextReaderPtr reader);
       
   273 XMLPUBFUN int XMLCALL
       
   274 		    xmlTextReaderNextSibling	(xmlTextReaderPtr reader);
       
   275 XMLPUBFUN int XMLCALL		
       
   276 		    xmlTextReaderIsValid	(xmlTextReaderPtr reader);
       
   277 #ifdef LIBXML_SCHEMAS_ENABLED
       
   278 XMLPUBFUN int XMLCALL		
       
   279 		    xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
       
   280 						 const char *rng);
       
   281 XMLPUBFUN int XMLCALL		
       
   282 		    xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
       
   283 						 xmlRelaxNGPtr schema);
       
   284 XMLPUBFUN int XMLCALL
       
   285 		    xmlTextReaderSchemaValidate	(xmlTextReaderPtr reader,
       
   286 		    				 const char *xsd);
       
   287 XMLPUBFUN int XMLCALL
       
   288 		    xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
       
   289 						 xmlSchemaValidCtxtPtr ctxt,
       
   290 						 int options);
       
   291 XMLPUBFUN int XMLCALL		
       
   292 		    xmlTextReaderSetSchema	(xmlTextReaderPtr reader,
       
   293 		    				 xmlSchemaPtr schema);
       
   294 #endif
       
   295 XMLPUBFUN const xmlChar * XMLCALL
       
   296 		    xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
       
   297 XMLPUBFUN int XMLCALL
       
   298 		    xmlTextReaderStandalone     (xmlTextReaderPtr reader);
       
   299 
       
   300 
       
   301 /*
       
   302  * Index lookup
       
   303  */
       
   304 XMLPUBFUN long XMLCALL
       
   305 		xmlTextReaderByteConsumed	(xmlTextReaderPtr reader);
       
   306 
       
   307 /*
       
   308  * New more complete APIs for simpler creation and reuse of readers
       
   309  */
       
   310 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   311 		xmlReaderWalker		(xmlDocPtr doc);
       
   312 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   313 		xmlReaderForDoc		(const xmlChar * cur,
       
   314 					 const char *URL,
       
   315 					 const char *encoding,
       
   316 					 int options);
       
   317 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   318 		xmlReaderForFile	(const char *filename,
       
   319 					 const char *encoding,
       
   320 					 int options);
       
   321 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   322 		xmlReaderForMemory	(const char *buffer,
       
   323 					 int size,
       
   324 					 const char *URL,
       
   325 					 const char *encoding,
       
   326 					 int options);
       
   327 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   328 		xmlReaderForFd		(int fd,
       
   329 					 const char *URL,
       
   330 					 const char *encoding,
       
   331 					 int options);
       
   332 XMLPUBFUN xmlTextReaderPtr XMLCALL
       
   333 		xmlReaderForIO		(xmlInputReadCallback ioread,
       
   334 					 xmlInputCloseCallback ioclose,
       
   335 					 void *ioctx,
       
   336 					 const char *URL,
       
   337 					 const char *encoding,
       
   338 					 int options);
       
   339 
       
   340 XMLPUBFUN int XMLCALL
       
   341 		xmlReaderNewWalker	(xmlTextReaderPtr reader,
       
   342 					 xmlDocPtr doc);
       
   343 XMLPUBFUN int XMLCALL
       
   344 		xmlReaderNewDoc		(xmlTextReaderPtr reader,
       
   345 					 const xmlChar * cur,
       
   346 					 const char *URL,
       
   347 					 const char *encoding,
       
   348 					 int options);
       
   349 XMLPUBFUN int XMLCALL
       
   350 		xmlReaderNewFile	(xmlTextReaderPtr reader,
       
   351 					 const char *filename,
       
   352 					 const char *encoding,
       
   353 					 int options);
       
   354 XMLPUBFUN int XMLCALL
       
   355 		xmlReaderNewMemory	(xmlTextReaderPtr reader,
       
   356 					 const char *buffer,
       
   357 					 int size,
       
   358 					 const char *URL,
       
   359 					 const char *encoding,
       
   360 					 int options);
       
   361 XMLPUBFUN int XMLCALL
       
   362 		xmlReaderNewFd		(xmlTextReaderPtr reader,
       
   363 					 int fd,
       
   364 					 const char *URL,
       
   365 					 const char *encoding,
       
   366 					 int options);
       
   367 XMLPUBFUN int XMLCALL
       
   368 		xmlReaderNewIO		(xmlTextReaderPtr reader,
       
   369 					 xmlInputReadCallback ioread,
       
   370 					 xmlInputCloseCallback ioclose,
       
   371 					 void *ioctx,
       
   372 					 const char *URL,
       
   373 					 const char *encoding,
       
   374 					 int options);
       
   375 /*
       
   376  * Error handling extensions
       
   377  */
       
   378 typedef void *  xmlTextReaderLocatorPtr;
       
   379 typedef void   (XMLCALL *xmlTextReaderErrorFunc)        (void *arg, 
       
   380 						 const char *msg,
       
   381 						 xmlParserSeverities severity,
       
   382 						 xmlTextReaderLocatorPtr locator);
       
   383 XMLPUBFUN int XMLCALL             
       
   384 		    xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
       
   385 XMLPUBFUN xmlChar * XMLCALL       
       
   386 		    xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
       
   387 XMLPUBFUN void XMLCALL            
       
   388 		    xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, 
       
   389 						 xmlTextReaderErrorFunc f, 
       
   390 						 void *arg);
       
   391 XMLPUBFUN void XMLCALL
       
   392 		    xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
       
   393 							   xmlStructuredErrorFunc f,
       
   394 							   void *arg);
       
   395 XMLPUBFUN void XMLCALL            
       
   396 		    xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, 
       
   397 						 xmlTextReaderErrorFunc *f, 
       
   398 						 void **arg);
       
   399 
       
   400 #ifdef __cplusplus
       
   401 }
       
   402 #endif
       
   403 
       
   404 #endif /* LIBXML_READER_ENABLED */
       
   405 
       
   406 #endif /* __XML_XMLREADER_H__ */
       
   407