Eneboo - Documentación para desarrolladores
|
00001 /* 00002 * Summary: the XMLReader implementation 00003 * Description: API of the XML streaming API based on C# interfaces. 00004 * 00005 * Copy: See Copyright for the status of this software. 00006 * 00007 * Author: Daniel Veillard 00008 */ 00009 00010 #ifndef __XML_XMLREADER_H__ 00011 #define __XML_XMLREADER_H__ 00012 00013 #include <libxml/xmlversion.h> 00014 #include <libxml/tree.h> 00015 #include <libxml/xmlIO.h> 00016 #ifdef LIBXML_SCHEMAS_ENABLED 00017 #include <libxml/relaxng.h> 00018 #include <libxml/xmlschemas.h> 00019 #endif 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00031 typedef enum { 00032 XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, 00033 XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, 00034 XML_PARSER_SEVERITY_WARNING = 3, 00035 XML_PARSER_SEVERITY_ERROR = 4 00036 } xmlParserSeverities; 00037 00038 #ifdef LIBXML_READER_ENABLED 00039 00045 typedef enum { 00046 XML_TEXTREADER_MODE_INITIAL = 0, 00047 XML_TEXTREADER_MODE_INTERACTIVE = 1, 00048 XML_TEXTREADER_MODE_ERROR = 2, 00049 XML_TEXTREADER_MODE_EOF =3, 00050 XML_TEXTREADER_MODE_CLOSED = 4, 00051 XML_TEXTREADER_MODE_READING = 5 00052 } xmlTextReaderMode; 00053 00061 typedef enum { 00062 XML_PARSER_LOADDTD = 1, 00063 XML_PARSER_DEFAULTATTRS = 2, 00064 XML_PARSER_VALIDATE = 3, 00065 XML_PARSER_SUBST_ENTITIES = 4 00066 } xmlParserProperties; 00067 00073 typedef enum { 00074 XML_READER_TYPE_NONE = 0, 00075 XML_READER_TYPE_ELEMENT = 1, 00076 XML_READER_TYPE_ATTRIBUTE = 2, 00077 XML_READER_TYPE_TEXT = 3, 00078 XML_READER_TYPE_CDATA = 4, 00079 XML_READER_TYPE_ENTITY_REFERENCE = 5, 00080 XML_READER_TYPE_ENTITY = 6, 00081 XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, 00082 XML_READER_TYPE_COMMENT = 8, 00083 XML_READER_TYPE_DOCUMENT = 9, 00084 XML_READER_TYPE_DOCUMENT_TYPE = 10, 00085 XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, 00086 XML_READER_TYPE_NOTATION = 12, 00087 XML_READER_TYPE_WHITESPACE = 13, 00088 XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, 00089 XML_READER_TYPE_END_ELEMENT = 15, 00090 XML_READER_TYPE_END_ENTITY = 16, 00091 XML_READER_TYPE_XML_DECLARATION = 17 00092 } xmlReaderTypes; 00093 00099 typedef struct _xmlTextReader xmlTextReader; 00100 00106 typedef xmlTextReader *xmlTextReaderPtr; 00107 00108 /* 00109 * Constructors & Destructor 00110 */ 00111 XMLPUBFUN xmlTextReaderPtr XMLCALL 00112 xmlNewTextReader (xmlParserInputBufferPtr input, 00113 const char *URI); 00114 XMLPUBFUN xmlTextReaderPtr XMLCALL 00115 xmlNewTextReaderFilename(const char *URI); 00116 00117 XMLPUBFUN void XMLCALL 00118 xmlFreeTextReader (xmlTextReaderPtr reader); 00119 00120 XMLPUBFUN int XMLCALL 00121 xmlTextReaderSetup(xmlTextReaderPtr reader, 00122 xmlParserInputBufferPtr input, const char *URL, 00123 const char *encoding, int options); 00124 00125 /* 00126 * Iterators 00127 */ 00128 XMLPUBFUN int XMLCALL 00129 xmlTextReaderRead (xmlTextReaderPtr reader); 00130 00131 #ifdef LIBXML_WRITER_ENABLED 00132 XMLPUBFUN xmlChar * XMLCALL 00133 xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); 00134 00135 XMLPUBFUN xmlChar * XMLCALL 00136 xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); 00137 #endif 00138 00139 XMLPUBFUN xmlChar * XMLCALL 00140 xmlTextReaderReadString (xmlTextReaderPtr reader); 00141 XMLPUBFUN int XMLCALL 00142 xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); 00143 00144 /* 00145 * Attributes of the node 00146 */ 00147 XMLPUBFUN int XMLCALL 00148 xmlTextReaderAttributeCount(xmlTextReaderPtr reader); 00149 XMLPUBFUN int XMLCALL 00150 xmlTextReaderDepth (xmlTextReaderPtr reader); 00151 XMLPUBFUN int XMLCALL 00152 xmlTextReaderHasAttributes(xmlTextReaderPtr reader); 00153 XMLPUBFUN int XMLCALL 00154 xmlTextReaderHasValue(xmlTextReaderPtr reader); 00155 XMLPUBFUN int XMLCALL 00156 xmlTextReaderIsDefault (xmlTextReaderPtr reader); 00157 XMLPUBFUN int XMLCALL 00158 xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); 00159 XMLPUBFUN int XMLCALL 00160 xmlTextReaderNodeType (xmlTextReaderPtr reader); 00161 XMLPUBFUN int XMLCALL 00162 xmlTextReaderQuoteChar (xmlTextReaderPtr reader); 00163 XMLPUBFUN int XMLCALL 00164 xmlTextReaderReadState (xmlTextReaderPtr reader); 00165 XMLPUBFUN int XMLCALL 00166 xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); 00167 00168 XMLPUBFUN const xmlChar * XMLCALL 00169 xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); 00170 XMLPUBFUN const xmlChar * XMLCALL 00171 xmlTextReaderConstLocalName (xmlTextReaderPtr reader); 00172 XMLPUBFUN const xmlChar * XMLCALL 00173 xmlTextReaderConstName (xmlTextReaderPtr reader); 00174 XMLPUBFUN const xmlChar * XMLCALL 00175 xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); 00176 XMLPUBFUN const xmlChar * XMLCALL 00177 xmlTextReaderConstPrefix (xmlTextReaderPtr reader); 00178 XMLPUBFUN const xmlChar * XMLCALL 00179 xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); 00180 XMLPUBFUN const xmlChar * XMLCALL 00181 xmlTextReaderConstString (xmlTextReaderPtr reader, 00182 const xmlChar *str); 00183 XMLPUBFUN const xmlChar * XMLCALL 00184 xmlTextReaderConstValue (xmlTextReaderPtr reader); 00185 00186 /* 00187 * use the Const version of the routine for 00188 * better performance and simpler code 00189 */ 00190 XMLPUBFUN xmlChar * XMLCALL 00191 xmlTextReaderBaseUri (xmlTextReaderPtr reader); 00192 XMLPUBFUN xmlChar * XMLCALL 00193 xmlTextReaderLocalName (xmlTextReaderPtr reader); 00194 XMLPUBFUN xmlChar * XMLCALL 00195 xmlTextReaderName (xmlTextReaderPtr reader); 00196 XMLPUBFUN xmlChar * XMLCALL 00197 xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); 00198 XMLPUBFUN xmlChar * XMLCALL 00199 xmlTextReaderPrefix (xmlTextReaderPtr reader); 00200 XMLPUBFUN xmlChar * XMLCALL 00201 xmlTextReaderXmlLang (xmlTextReaderPtr reader); 00202 XMLPUBFUN xmlChar * XMLCALL 00203 xmlTextReaderValue (xmlTextReaderPtr reader); 00204 00205 /* 00206 * Methods of the XmlTextReader 00207 */ 00208 XMLPUBFUN int XMLCALL 00209 xmlTextReaderClose (xmlTextReaderPtr reader); 00210 XMLPUBFUN xmlChar * XMLCALL 00211 xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, 00212 int no); 00213 XMLPUBFUN xmlChar * XMLCALL 00214 xmlTextReaderGetAttribute (xmlTextReaderPtr reader, 00215 const xmlChar *name); 00216 XMLPUBFUN xmlChar * XMLCALL 00217 xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, 00218 const xmlChar *localName, 00219 const xmlChar *namespaceURI); 00220 XMLPUBFUN xmlParserInputBufferPtr XMLCALL 00221 xmlTextReaderGetRemainder (xmlTextReaderPtr reader); 00222 XMLPUBFUN xmlChar * XMLCALL 00223 xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, 00224 const xmlChar *prefix); 00225 XMLPUBFUN int XMLCALL 00226 xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, 00227 int no); 00228 XMLPUBFUN int XMLCALL 00229 xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, 00230 const xmlChar *name); 00231 XMLPUBFUN int XMLCALL 00232 xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, 00233 const xmlChar *localName, 00234 const xmlChar *namespaceURI); 00235 XMLPUBFUN int XMLCALL 00236 xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); 00237 XMLPUBFUN int XMLCALL 00238 xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); 00239 XMLPUBFUN int XMLCALL 00240 xmlTextReaderMoveToElement (xmlTextReaderPtr reader); 00241 XMLPUBFUN int XMLCALL 00242 xmlTextReaderNormalization (xmlTextReaderPtr reader); 00243 XMLPUBFUN const xmlChar * XMLCALL 00244 xmlTextReaderConstEncoding (xmlTextReaderPtr reader); 00245 00246 /* 00247 * Extensions 00248 */ 00249 XMLPUBFUN int XMLCALL 00250 xmlTextReaderSetParserProp (xmlTextReaderPtr reader, 00251 int prop, 00252 int value); 00253 XMLPUBFUN int XMLCALL 00254 xmlTextReaderGetParserProp (xmlTextReaderPtr reader, 00255 int prop); 00256 XMLPUBFUN xmlNodePtr XMLCALL 00257 xmlTextReaderCurrentNode (xmlTextReaderPtr reader); 00258 00259 XMLPUBFUN int XMLCALL 00260 xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); 00261 00262 XMLPUBFUN int XMLCALL 00263 xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); 00264 00265 XMLPUBFUN xmlNodePtr XMLCALL 00266 xmlTextReaderPreserve (xmlTextReaderPtr reader); 00267 #ifdef LIBXML_PATTERN_ENABLED 00268 XMLPUBFUN int XMLCALL 00269 xmlTextReaderPreservePattern(xmlTextReaderPtr reader, 00270 const xmlChar *pattern, 00271 const xmlChar **namespaces); 00272 #endif /* LIBXML_PATTERN_ENABLED */ 00273 XMLPUBFUN xmlDocPtr XMLCALL 00274 xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); 00275 XMLPUBFUN xmlNodePtr XMLCALL 00276 xmlTextReaderExpand (xmlTextReaderPtr reader); 00277 XMLPUBFUN int XMLCALL 00278 xmlTextReaderNext (xmlTextReaderPtr reader); 00279 XMLPUBFUN int XMLCALL 00280 xmlTextReaderNextSibling (xmlTextReaderPtr reader); 00281 XMLPUBFUN int XMLCALL 00282 xmlTextReaderIsValid (xmlTextReaderPtr reader); 00283 #ifdef LIBXML_SCHEMAS_ENABLED 00284 XMLPUBFUN int XMLCALL 00285 xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, 00286 const char *rng); 00287 XMLPUBFUN int XMLCALL 00288 xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, 00289 xmlRelaxNGPtr schema); 00290 XMLPUBFUN int XMLCALL 00291 xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, 00292 const char *xsd); 00293 XMLPUBFUN int XMLCALL 00294 xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, 00295 xmlSchemaValidCtxtPtr ctxt, 00296 int options); 00297 XMLPUBFUN int XMLCALL 00298 xmlTextReaderSetSchema (xmlTextReaderPtr reader, 00299 xmlSchemaPtr schema); 00300 #endif 00301 XMLPUBFUN const xmlChar * XMLCALL 00302 xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); 00303 XMLPUBFUN int XMLCALL 00304 xmlTextReaderStandalone (xmlTextReaderPtr reader); 00305 00306 00307 /* 00308 * Index lookup 00309 */ 00310 XMLPUBFUN long XMLCALL 00311 xmlTextReaderByteConsumed (xmlTextReaderPtr reader); 00312 00313 /* 00314 * New more complete APIs for simpler creation and reuse of readers 00315 */ 00316 XMLPUBFUN xmlTextReaderPtr XMLCALL 00317 xmlReaderWalker (xmlDocPtr doc); 00318 XMLPUBFUN xmlTextReaderPtr XMLCALL 00319 xmlReaderForDoc (const xmlChar * cur, 00320 const char *URL, 00321 const char *encoding, 00322 int options); 00323 XMLPUBFUN xmlTextReaderPtr XMLCALL 00324 xmlReaderForFile (const char *filename, 00325 const char *encoding, 00326 int options); 00327 XMLPUBFUN xmlTextReaderPtr XMLCALL 00328 xmlReaderForMemory (const char *buffer, 00329 int size, 00330 const char *URL, 00331 const char *encoding, 00332 int options); 00333 XMLPUBFUN xmlTextReaderPtr XMLCALL 00334 xmlReaderForFd (int fd, 00335 const char *URL, 00336 const char *encoding, 00337 int options); 00338 XMLPUBFUN xmlTextReaderPtr XMLCALL 00339 xmlReaderForIO (xmlInputReadCallback ioread, 00340 xmlInputCloseCallback ioclose, 00341 void *ioctx, 00342 const char *URL, 00343 const char *encoding, 00344 int options); 00345 00346 XMLPUBFUN int XMLCALL 00347 xmlReaderNewWalker (xmlTextReaderPtr reader, 00348 xmlDocPtr doc); 00349 XMLPUBFUN int XMLCALL 00350 xmlReaderNewDoc (xmlTextReaderPtr reader, 00351 const xmlChar * cur, 00352 const char *URL, 00353 const char *encoding, 00354 int options); 00355 XMLPUBFUN int XMLCALL 00356 xmlReaderNewFile (xmlTextReaderPtr reader, 00357 const char *filename, 00358 const char *encoding, 00359 int options); 00360 XMLPUBFUN int XMLCALL 00361 xmlReaderNewMemory (xmlTextReaderPtr reader, 00362 const char *buffer, 00363 int size, 00364 const char *URL, 00365 const char *encoding, 00366 int options); 00367 XMLPUBFUN int XMLCALL 00368 xmlReaderNewFd (xmlTextReaderPtr reader, 00369 int fd, 00370 const char *URL, 00371 const char *encoding, 00372 int options); 00373 XMLPUBFUN int XMLCALL 00374 xmlReaderNewIO (xmlTextReaderPtr reader, 00375 xmlInputReadCallback ioread, 00376 xmlInputCloseCallback ioclose, 00377 void *ioctx, 00378 const char *URL, 00379 const char *encoding, 00380 int options); 00381 /* 00382 * Error handling extensions 00383 */ 00384 typedef void * xmlTextReaderLocatorPtr; 00385 00395 typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, 00396 const char *msg, 00397 xmlParserSeverities severity, 00398 xmlTextReaderLocatorPtr locator); 00399 XMLPUBFUN int XMLCALL 00400 xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); 00401 /*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/ 00402 XMLPUBFUN xmlChar * XMLCALL 00403 xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); 00404 XMLPUBFUN void XMLCALL 00405 xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, 00406 xmlTextReaderErrorFunc f, 00407 void *arg); 00408 XMLPUBFUN void XMLCALL 00409 xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, 00410 xmlStructuredErrorFunc f, 00411 void *arg); 00412 XMLPUBFUN void XMLCALL 00413 xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, 00414 xmlTextReaderErrorFunc *f, 00415 void **arg); 00416 00417 #endif /* LIBXML_READER_ENABLED */ 00418 00419 #ifdef __cplusplus 00420 } 00421 #endif 00422 00423 #endif /* __XML_XMLREADER_H__ */ 00424