Annotation of win32/gnome/gnome-xml/include/libxml/parser.h, revision 1.1
1.1 ! paf 1: /*
! 2: * parser.h : Interfaces, constants and types related to the XML parser.
! 3: *
! 4: * See Copyright for the status of this software.
! 5: *
! 6: * daniel@veillard.com
! 7: */
! 8:
! 9: #ifndef __XML_PARSER_H__
! 10: #define __XML_PARSER_H__
! 11:
! 12: #include <libxml/tree.h>
! 13: #include <libxml/valid.h>
! 14: #include <libxml/entities.h>
! 15:
! 16: #ifdef __cplusplus
! 17: extern "C" {
! 18: #endif
! 19:
! 20: /**
! 21: * XML_DEFAULT_VERSION:
! 22: *
! 23: * The default version of XML used: 1.0
! 24: */
! 25: #define XML_DEFAULT_VERSION "1.0"
! 26:
! 27: /**
! 28: * xmlParserInput:
! 29: *
! 30: * An xmlParserInput is an input flow for the XML processor.
! 31: * Each entity parsed is associated an xmlParserInput (except the
! 32: * few predefined ones). This is the case both for internal entities
! 33: * - in which case the flow is already completely in memory - or
! 34: * external entities - in which case we use the buf structure for
! 35: * progressive reading and I18N conversions to the internal UTF-8 format.
! 36: */
! 37:
! 38: /**
! 39: * xmlParserInputDeallocate:
! 40: * @str: the string to deallocate
! 41: *
! 42: * Callback for freeing some parser input allocations.
! 43: */
! 44: typedef void (* xmlParserInputDeallocate)(xmlChar *str);
! 45:
! 46: struct _xmlParserInput {
! 47: /* Input buffer */
! 48: xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
! 49:
! 50: const char *filename; /* The file analyzed, if any */
! 51: const char *directory; /* the directory/base of the file */
! 52: const xmlChar *base; /* Base of the array to parse */
! 53: const xmlChar *cur; /* Current char being parsed */
! 54: const xmlChar *end; /* end of the array to parse */
! 55: int length; /* length if known */
! 56: int line; /* Current line */
! 57: int col; /* Current column */
! 58: int consumed; /* How many xmlChars already consumed */
! 59: xmlParserInputDeallocate free; /* function to deallocate the base */
! 60: const xmlChar *encoding; /* the encoding string for entity */
! 61: const xmlChar *version; /* the version string for entity */
! 62: int standalone; /* Was that entity marked standalone */
! 63: };
! 64:
! 65: /**
! 66: * xmlParserNodeInfo:
! 67: *
! 68: * The parser can be asked to collect Node informations, i.e. at what
! 69: * place in the file they were detected.
! 70: * NOTE: This is off by default and not very well tested.
! 71: */
! 72: typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
! 73: typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
! 74:
! 75: struct _xmlParserNodeInfo {
! 76: const struct _xmlNode* node;
! 77: /* Position & line # that text that created the node begins & ends on */
! 78: unsigned long begin_pos;
! 79: unsigned long begin_line;
! 80: unsigned long end_pos;
! 81: unsigned long end_line;
! 82: };
! 83:
! 84: typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
! 85: typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
! 86: struct _xmlParserNodeInfoSeq {
! 87: unsigned long maximum;
! 88: unsigned long length;
! 89: xmlParserNodeInfo* buffer;
! 90: };
! 91:
! 92: /**
! 93: * xmlParserInputState:
! 94: *
! 95: * The parser is now working also as a state based parser.
! 96: * The recursive one use the state info for entities processing.
! 97: */
! 98: typedef enum {
! 99: XML_PARSER_EOF = -1, /* nothing is to be parsed */
! 100: XML_PARSER_START = 0, /* nothing has been parsed */
! 101: XML_PARSER_MISC, /* Misc* before int subset */
! 102: XML_PARSER_PI, /* Within a processing instruction */
! 103: XML_PARSER_DTD, /* within some DTD content */
! 104: XML_PARSER_PROLOG, /* Misc* after internal subset */
! 105: XML_PARSER_COMMENT, /* within a comment */
! 106: XML_PARSER_START_TAG, /* within a start tag */
! 107: XML_PARSER_CONTENT, /* within the content */
! 108: XML_PARSER_CDATA_SECTION, /* within a CDATA section */
! 109: XML_PARSER_END_TAG, /* within a closing tag */
! 110: XML_PARSER_ENTITY_DECL, /* within an entity declaration */
! 111: XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
! 112: XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
! 113: XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
! 114: XML_PARSER_EPILOG, /* the Misc* after the last end tag */
! 115: XML_PARSER_IGNORE, /* within an IGNORED section */
! 116: XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
! 117: } xmlParserInputState;
! 118:
! 119: /**
! 120: * XML_DETECT_IDS:
! 121: *
! 122: * Bit in the loadsubset context field to tell to do ID/REFs lookups.
! 123: * Use it to initialize xmlLoadExtDtdDefaultValue.
! 124: */
! 125: #define XML_DETECT_IDS 2
! 126:
! 127: /**
! 128: * XML_COMPLETE_ATTRS:
! 129: *
! 130: * Bit in the loadsubset context field to tell to do complete the
! 131: * elements attributes lists with the ones defaulted from the DTDs.
! 132: * Use it to initialize xmlLoadExtDtdDefaultValue.
! 133: */
! 134: #define XML_COMPLETE_ATTRS 4
! 135:
! 136: /**
! 137: * XML_SKIP_IDS:
! 138: *
! 139: * Bit in the loadsubset context field to tell to not do ID/REFs registration.
! 140: * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
! 141: */
! 142: #define XML_SKIP_IDS 8
! 143:
! 144: /**
! 145: * xmlParserCtxt:
! 146: *
! 147: * The parser context.
! 148: * NOTE This doesn't completely define the parser state, the (current ?)
! 149: * design of the parser uses recursive function calls since this allow
! 150: * and easy mapping from the production rules of the specification
! 151: * to the actual code. The drawback is that the actual function call
! 152: * also reflect the parser state. However most of the parsing routines
! 153: * takes as the only argument the parser context pointer, so migrating
! 154: * to a state based parser for progressive parsing shouldn't be too hard.
! 155: */
! 156: struct _xmlParserCtxt {
! 157: struct _xmlSAXHandler *sax; /* The SAX handler */
! 158: void *userData; /* For SAX interface only, used by DOM build */
! 159: xmlDocPtr myDoc; /* the document being built */
! 160: int wellFormed; /* is the document well formed */
! 161: int replaceEntities; /* shall we replace entities ? */
! 162: const xmlChar *version; /* the XML version string */
! 163: const xmlChar *encoding; /* the declared encoding, if any */
! 164: int standalone; /* standalone document */
! 165: int html; /* an HTML(1)/Docbook(2) document */
! 166:
! 167: /* Input stream stack */
! 168: xmlParserInputPtr input; /* Current input stream */
! 169: int inputNr; /* Number of current input streams */
! 170: int inputMax; /* Max number of input streams */
! 171: xmlParserInputPtr *inputTab; /* stack of inputs */
! 172:
! 173: /* Node analysis stack only used for DOM building */
! 174: xmlNodePtr node; /* Current parsed Node */
! 175: int nodeNr; /* Depth of the parsing stack */
! 176: int nodeMax; /* Max depth of the parsing stack */
! 177: xmlNodePtr *nodeTab; /* array of nodes */
! 178:
! 179: int record_info; /* Whether node info should be kept */
! 180: xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
! 181:
! 182: int errNo; /* error code */
! 183:
! 184: int hasExternalSubset; /* reference and external subset */
! 185: int hasPErefs; /* the internal subset has PE refs */
! 186: int external; /* are we parsing an external entity */
! 187:
! 188: int valid; /* is the document valid */
! 189: int validate; /* shall we try to validate ? */
! 190: xmlValidCtxt vctxt; /* The validity context */
! 191:
! 192: xmlParserInputState instate; /* current type of input */
! 193: int token; /* next char look-ahead */
! 194:
! 195: char *directory; /* the data directory */
! 196:
! 197: /* Node name stack */
! 198: xmlChar *name; /* Current parsed Node */
! 199: int nameNr; /* Depth of the parsing stack */
! 200: int nameMax; /* Max depth of the parsing stack */
! 201: xmlChar * *nameTab; /* array of nodes */
! 202:
! 203: long nbChars; /* number of xmlChar processed */
! 204: long checkIndex; /* used by progressive parsing lookup */
! 205: int keepBlanks; /* ugly but ... */
! 206: int disableSAX; /* SAX callbacks are disabled */
! 207: int inSubset; /* Parsing is in int 1/ext 2 subset */
! 208: xmlChar * intSubName; /* name of subset */
! 209: xmlChar * extSubURI; /* URI of external subset */
! 210: xmlChar * extSubSystem; /* SYSTEM ID of external subset */
! 211:
! 212: /* xml:space values */
! 213: int * space; /* Should the parser preserve spaces */
! 214: int spaceNr; /* Depth of the parsing stack */
! 215: int spaceMax; /* Max depth of the parsing stack */
! 216: int * spaceTab; /* array of space infos */
! 217:
! 218: int depth; /* to prevent entity substitution loops */
! 219: xmlParserInputPtr entity; /* used to check entities boundaries */
! 220: int charset; /* encoding of the in-memory content
! 221: actually an xmlCharEncoding */
! 222: int nodelen; /* Those two fields are there to */
! 223: int nodemem; /* Speed up large node parsing */
! 224: int pedantic; /* signal pedantic warnings */
! 225: void *_private; /* For user data, libxml won't touch it */
! 226:
! 227: int loadsubset; /* should the external subset be loaded */
! 228: int linenumbers; /* set line number in element content */
! 229: void *catalogs; /* document's own catalog */
! 230: int recovery; /* run in recovery mode */
! 231: };
! 232:
! 233: /**
! 234: * xmlSAXLocator:
! 235: *
! 236: * A SAX Locator.
! 237: */
! 238: struct _xmlSAXLocator {
! 239: const xmlChar *(*getPublicId)(void *ctx);
! 240: const xmlChar *(*getSystemId)(void *ctx);
! 241: int (*getLineNumber)(void *ctx);
! 242: int (*getColumnNumber)(void *ctx);
! 243: };
! 244:
! 245: /**
! 246: * xmlSAXHandler:
! 247: *
! 248: * A SAX handler is bunch of callbacks called by the parser when processing
! 249: * of the input generate data or structure informations.
! 250: */
! 251:
! 252: /**
! 253: * resolveEntitySAXFunc:
! 254: * @ctx: the user data (XML parser context)
! 255: * @publicId: The public ID of the entity
! 256: * @systemId: The system ID of the entity
! 257: *
! 258: * Callback:
! 259: * The entity loader, to control the loading of external entities,
! 260: * the application can either:
! 261: * - override this resolveEntity() callback in the SAX block
! 262: * - or better use the xmlSetExternalEntityLoader() function to
! 263: * set up it's own entity resolution routine
! 264: *
! 265: * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
! 266: */
! 267: typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
! 268: const xmlChar *publicId,
! 269: const xmlChar *systemId);
! 270: /**
! 271: * internalSubsetSAXFunc:
! 272: * @ctx: the user data (XML parser context)
! 273: * @name: the root element name
! 274: * @ExternalID: the external ID
! 275: * @SystemID: the SYSTEM ID (e.g. filename or URL)
! 276: *
! 277: * Callback on internal subset declaration.
! 278: */
! 279: typedef void (*internalSubsetSAXFunc) (void *ctx,
! 280: const xmlChar *name,
! 281: const xmlChar *ExternalID,
! 282: const xmlChar *SystemID);
! 283: /**
! 284: * externalSubsetSAXFunc:
! 285: * @ctx: the user data (XML parser context)
! 286: * @name: the root element name
! 287: * @ExternalID: the external ID
! 288: * @SystemID: the SYSTEM ID (e.g. filename or URL)
! 289: *
! 290: * Callback on external subset declaration.
! 291: */
! 292: typedef void (*externalSubsetSAXFunc) (void *ctx,
! 293: const xmlChar *name,
! 294: const xmlChar *ExternalID,
! 295: const xmlChar *SystemID);
! 296: /**
! 297: * getEntitySAXFunc:
! 298: * @ctx: the user data (XML parser context)
! 299: * @name: The entity name
! 300: *
! 301: * Get an entity by name.
! 302: *
! 303: * Returns the xmlEntityPtr if found.
! 304: */
! 305: typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
! 306: const xmlChar *name);
! 307: /**
! 308: * getParameterEntitySAXFunc:
! 309: * @ctx: the user data (XML parser context)
! 310: * @name: The entity name
! 311: *
! 312: * Get a parameter entity by name.
! 313: *
! 314: * Returns the xmlEntityPtr if found.
! 315: */
! 316: typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
! 317: const xmlChar *name);
! 318: /**
! 319: * entityDeclSAXFunc:
! 320: * @ctx: the user data (XML parser context)
! 321: * @name: the entity name
! 322: * @type: the entity type
! 323: * @publicId: The public ID of the entity
! 324: * @systemId: The system ID of the entity
! 325: * @content: the entity value (without processing).
! 326: *
! 327: * An entity definition has been parsed.
! 328: */
! 329: typedef void (*entityDeclSAXFunc) (void *ctx,
! 330: const xmlChar *name,
! 331: int type,
! 332: const xmlChar *publicId,
! 333: const xmlChar *systemId,
! 334: xmlChar *content);
! 335: /**
! 336: * notationDeclSAXFunc:
! 337: * @ctx: the user data (XML parser context)
! 338: * @name: The name of the notation
! 339: * @publicId: The public ID of the entity
! 340: * @systemId: The system ID of the entity
! 341: *
! 342: * What to do when a notation declaration has been parsed.
! 343: */
! 344: typedef void (*notationDeclSAXFunc)(void *ctx,
! 345: const xmlChar *name,
! 346: const xmlChar *publicId,
! 347: const xmlChar *systemId);
! 348: /**
! 349: * attributeDeclSAXFunc:
! 350: * @ctx: the user data (XML parser context)
! 351: * @elem: the name of the element
! 352: * @fullname: the attribute name
! 353: * @type: the attribute type
! 354: * @def: the type of default value
! 355: * @defaultValue: the attribute default value
! 356: * @tree: the tree of enumerated value set
! 357: *
! 358: * An attribute definition has been parsed.
! 359: */
! 360: typedef void (*attributeDeclSAXFunc)(void *ctx,
! 361: const xmlChar *elem,
! 362: const xmlChar *fullname,
! 363: int type,
! 364: int def,
! 365: const xmlChar *defaultValue,
! 366: xmlEnumerationPtr tree);
! 367: /**
! 368: * elementDeclSAXFunc:
! 369: * @ctx: the user data (XML parser context)
! 370: * @name: the element name
! 371: * @type: the element type
! 372: * @content: the element value tree
! 373: *
! 374: * An element definition has been parsed.
! 375: */
! 376: typedef void (*elementDeclSAXFunc)(void *ctx,
! 377: const xmlChar *name,
! 378: int type,
! 379: xmlElementContentPtr content);
! 380: /**
! 381: * unparsedEntityDeclSAXFunc:
! 382: * @ctx: the user data (XML parser context)
! 383: * @name: The name of the entity
! 384: * @publicId: The public ID of the entity
! 385: * @systemId: The system ID of the entity
! 386: * @notationName: the name of the notation
! 387: *
! 388: * What to do when an unparsed entity declaration is parsed.
! 389: */
! 390: typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
! 391: const xmlChar *name,
! 392: const xmlChar *publicId,
! 393: const xmlChar *systemId,
! 394: const xmlChar *notationName);
! 395: /**
! 396: * setDocumentLocatorSAXFunc:
! 397: * @ctx: the user data (XML parser context)
! 398: * @loc: A SAX Locator
! 399: *
! 400: * Receive the document locator at startup, actually xmlDefaultSAXLocator.
! 401: * Everything is available on the context, so this is useless in our case.
! 402: */
! 403: typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
! 404: xmlSAXLocatorPtr loc);
! 405: /**
! 406: * startDocumentSAXFunc:
! 407: * @ctx: the user data (XML parser context)
! 408: *
! 409: * Called when the document start being processed.
! 410: */
! 411: typedef void (*startDocumentSAXFunc) (void *ctx);
! 412: /**
! 413: * endDocumentSAXFunc:
! 414: * @ctx: the user data (XML parser context)
! 415: *
! 416: * Called when the document end has been detected.
! 417: */
! 418: typedef void (*endDocumentSAXFunc) (void *ctx);
! 419: /**
! 420: * startElementSAXFunc:
! 421: * @ctx: the user data (XML parser context)
! 422: * @name: The element name, including namespace prefix
! 423: * @atts: An array of name/value attributes pairs, NULL terminated
! 424: *
! 425: * Called when an opening tag has been processed.
! 426: */
! 427: typedef void (*startElementSAXFunc) (void *ctx,
! 428: const xmlChar *name,
! 429: const xmlChar **atts);
! 430: /**
! 431: * endElementSAXFunc:
! 432: * @ctx: the user data (XML parser context)
! 433: * @name: The element name
! 434: *
! 435: * Called when the end of an element has been detected.
! 436: */
! 437: typedef void (*endElementSAXFunc) (void *ctx,
! 438: const xmlChar *name);
! 439: /**
! 440: * attributeSAXFunc:
! 441: * @ctx: the user data (XML parser context)
! 442: * @name: The attribute name, including namespace prefix
! 443: * @value: The attribute value
! 444: *
! 445: * Handle an attribute that has been read by the parser.
! 446: * The default handling is to convert the attribute into an
! 447: * DOM subtree and past it in a new xmlAttr element added to
! 448: * the element.
! 449: */
! 450: typedef void (*attributeSAXFunc) (void *ctx,
! 451: const xmlChar *name,
! 452: const xmlChar *value);
! 453: /**
! 454: * referenceSAXFunc:
! 455: * @ctx: the user data (XML parser context)
! 456: * @name: The entity name
! 457: *
! 458: * Called when an entity reference is detected.
! 459: */
! 460: typedef void (*referenceSAXFunc) (void *ctx,
! 461: const xmlChar *name);
! 462: /**
! 463: * charactersSAXFunc:
! 464: * @ctx: the user data (XML parser context)
! 465: * @ch: a xmlChar string
! 466: * @len: the number of xmlChar
! 467: *
! 468: * Receiving some chars from the parser.
! 469: */
! 470: typedef void (*charactersSAXFunc) (void *ctx,
! 471: const xmlChar *ch,
! 472: int len);
! 473: /**
! 474: * ignorableWhitespaceSAXFunc:
! 475: * @ctx: the user data (XML parser context)
! 476: * @ch: a xmlChar string
! 477: * @len: the number of xmlChar
! 478: *
! 479: * Receiving some ignorable whitespaces from the parser.
! 480: * UNUSED: by default the DOM building will use characters.
! 481: */
! 482: typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
! 483: const xmlChar *ch,
! 484: int len);
! 485: /**
! 486: * processingInstructionSAXFunc:
! 487: * @ctx: the user data (XML parser context)
! 488: * @target: the target name
! 489: * @data: the PI data's
! 490: *
! 491: * A processing instruction has been parsed.
! 492: */
! 493: typedef void (*processingInstructionSAXFunc) (void *ctx,
! 494: const xmlChar *target,
! 495: const xmlChar *data);
! 496: /**
! 497: * commentSAXFunc:
! 498: * @ctx: the user data (XML parser context)
! 499: * @value: the comment content
! 500: *
! 501: * A comment has been parsed.
! 502: */
! 503: typedef void (*commentSAXFunc) (void *ctx,
! 504: const xmlChar *value);
! 505: /**
! 506: * cdataBlockSAXFunc:
! 507: * @ctx: the user data (XML parser context)
! 508: * @value: The pcdata content
! 509: * @len: the block length
! 510: *
! 511: * Called when a pcdata block has been parsed.
! 512: */
! 513: typedef void (*cdataBlockSAXFunc) (
! 514: void *ctx,
! 515: const xmlChar *value,
! 516: int len);
! 517: /**
! 518: * warningSAXFunc:
! 519: * @ctx: an XML parser context
! 520: * @msg: the message to display/transmit
! 521: * @...: extra parameters for the message display
! 522: *
! 523: * Display and format a warning messages, callback.
! 524: */
! 525: typedef void (*warningSAXFunc) (void *ctx,
! 526: const char *msg, ...);
! 527: /**
! 528: * errorSAXFunc:
! 529: * @ctx: an XML parser context
! 530: * @msg: the message to display/transmit
! 531: * @...: extra parameters for the message display
! 532: *
! 533: * Display and format an error messages, callback.
! 534: */
! 535: typedef void (*errorSAXFunc) (void *ctx,
! 536: const char *msg, ...);
! 537: /**
! 538: * fatalErrorSAXFunc:
! 539: * @ctx: an XML parser context
! 540: * @msg: the message to display/transmit
! 541: * @...: extra parameters for the message display
! 542: *
! 543: * Display and format fatal error messages, callback.
! 544: * Note: so far fatalError() SAX callbacks are not used, error()
! 545: * get all the callbacks for errors.
! 546: */
! 547: typedef void (*fatalErrorSAXFunc) (void *ctx,
! 548: const char *msg, ...);
! 549: /**
! 550: * isStandaloneSAXFunc:
! 551: * @ctx: the user data (XML parser context)
! 552: *
! 553: * Is this document tagged standalone?
! 554: *
! 555: * Returns 1 if true
! 556: */
! 557: typedef int (*isStandaloneSAXFunc) (void *ctx);
! 558: /**
! 559: * hasInternalSubsetSAXFunc:
! 560: * @ctx: the user data (XML parser context)
! 561: *
! 562: * Does this document has an internal subset.
! 563: *
! 564: * Returns 1 if true
! 565: */
! 566: typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
! 567: /**
! 568: * hasExternalSubsetSAXFunc:
! 569: * @ctx: the user data (XML parser context)
! 570: *
! 571: * Does this document has an external subset?
! 572: *
! 573: * Returns 1 if true
! 574: */
! 575: typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
! 576:
! 577: struct _xmlSAXHandler {
! 578: internalSubsetSAXFunc internalSubset;
! 579: isStandaloneSAXFunc isStandalone;
! 580: hasInternalSubsetSAXFunc hasInternalSubset;
! 581: hasExternalSubsetSAXFunc hasExternalSubset;
! 582: resolveEntitySAXFunc resolveEntity;
! 583: getEntitySAXFunc getEntity;
! 584: entityDeclSAXFunc entityDecl;
! 585: notationDeclSAXFunc notationDecl;
! 586: attributeDeclSAXFunc attributeDecl;
! 587: elementDeclSAXFunc elementDecl;
! 588: unparsedEntityDeclSAXFunc unparsedEntityDecl;
! 589: setDocumentLocatorSAXFunc setDocumentLocator;
! 590: startDocumentSAXFunc startDocument;
! 591: endDocumentSAXFunc endDocument;
! 592: startElementSAXFunc startElement;
! 593: endElementSAXFunc endElement;
! 594: referenceSAXFunc reference;
! 595: charactersSAXFunc characters;
! 596: ignorableWhitespaceSAXFunc ignorableWhitespace;
! 597: processingInstructionSAXFunc processingInstruction;
! 598: commentSAXFunc comment;
! 599: warningSAXFunc warning;
! 600: errorSAXFunc error;
! 601: fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
! 602: getParameterEntitySAXFunc getParameterEntity;
! 603: cdataBlockSAXFunc cdataBlock;
! 604: externalSubsetSAXFunc externalSubset;
! 605: int initialized;
! 606: };
! 607:
! 608: /**
! 609: * xmlExternalEntityLoader:
! 610: * @URL: The System ID of the resource requested
! 611: * @ID: The Public ID of the resource requested
! 612: * @context: the XML parser context
! 613: *
! 614: * External entity loaders types.
! 615: *
! 616: * Returns the entity input parser.
! 617: */
! 618: typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
! 619: const char *ID,
! 620: xmlParserCtxtPtr context);
! 621:
! 622: /*
! 623: * Global variables: just the default SAX interface tables and XML
! 624: * version infos.
! 625: */
! 626: #if 0
! 627: LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
! 628: #endif
! 629:
! 630: /*
! 631: LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
! 632: LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
! 633: LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
! 634: LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
! 635: */
! 636:
! 637: /*
! 638: * Entity substitution default behavior.
! 639: */
! 640:
! 641: #if 0
! 642: LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
! 643: LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
! 644: #endif
! 645:
! 646: #ifdef __cplusplus
! 647: }
! 648: #endif
! 649: #include <libxml/encoding.h>
! 650: #include <libxml/xmlIO.h>
! 651: #include <libxml/globals.h>
! 652: #ifdef __cplusplus
! 653: extern "C" {
! 654: #endif
! 655:
! 656:
! 657: /*
! 658: * Init/Cleanup
! 659: */
! 660: void xmlInitParser (void);
! 661: void xmlCleanupParser (void);
! 662:
! 663: /*
! 664: * Input functions
! 665: */
! 666: int xmlParserInputRead (xmlParserInputPtr in,
! 667: int len);
! 668: int xmlParserInputGrow (xmlParserInputPtr in,
! 669: int len);
! 670:
! 671: /*
! 672: * xmlChar handling
! 673: */
! 674: xmlChar * xmlStrdup (const xmlChar *cur);
! 675: xmlChar * xmlStrndup (const xmlChar *cur,
! 676: int len);
! 677: xmlChar * xmlCharStrndup (const char *cur,
! 678: int len);
! 679: xmlChar * xmlCharStrdup (const char *cur);
! 680: xmlChar * xmlStrsub (const xmlChar *str,
! 681: int start,
! 682: int len);
! 683: const xmlChar * xmlStrchr (const xmlChar *str,
! 684: xmlChar val);
! 685: const xmlChar * xmlStrstr (const xmlChar *str,
! 686: const xmlChar *val);
! 687: const xmlChar * xmlStrcasestr (const xmlChar *str,
! 688: xmlChar *val);
! 689: int xmlStrcmp (const xmlChar *str1,
! 690: const xmlChar *str2);
! 691: int xmlStrncmp (const xmlChar *str1,
! 692: const xmlChar *str2,
! 693: int len);
! 694: int xmlStrcasecmp (const xmlChar *str1,
! 695: const xmlChar *str2);
! 696: int xmlStrncasecmp (const xmlChar *str1,
! 697: const xmlChar *str2,
! 698: int len);
! 699: int xmlStrEqual (const xmlChar *str1,
! 700: const xmlChar *str2);
! 701: int xmlStrlen (const xmlChar *str);
! 702: xmlChar * xmlStrcat (xmlChar *cur,
! 703: const xmlChar *add);
! 704: xmlChar * xmlStrncat (xmlChar *cur,
! 705: const xmlChar *add,
! 706: int len);
! 707:
! 708: /*
! 709: * Basic parsing Interfaces
! 710: */
! 711: xmlDocPtr xmlParseDoc (xmlChar *cur);
! 712: xmlDocPtr xmlParseMemory (const char *buffer,
! 713: int size);
! 714: xmlDocPtr xmlParseFile (const char *filename);
! 715: int xmlSubstituteEntitiesDefault(int val);
! 716: int xmlKeepBlanksDefault (int val);
! 717: void xmlStopParser (xmlParserCtxtPtr ctxt);
! 718: int xmlPedanticParserDefault(int val);
! 719: int xmlLineNumbersDefault (int val);
! 720:
! 721: /*
! 722: * Recovery mode
! 723: */
! 724: xmlDocPtr xmlRecoverDoc (xmlChar *cur);
! 725: xmlDocPtr xmlRecoverMemory (const char *buffer,
! 726: int size);
! 727: xmlDocPtr xmlRecoverFile (const char *filename);
! 728:
! 729: /*
! 730: * Less common routines and SAX interfaces
! 731: */
! 732: int xmlParseDocument (xmlParserCtxtPtr ctxt);
! 733: int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
! 734: xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
! 735: xmlChar *cur,
! 736: int recovery);
! 737: int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
! 738: void *user_data,
! 739: const char *filename);
! 740: int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
! 741: void *user_data,
! 742: const char *buffer,
! 743: int size);
! 744: xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
! 745: const char *buffer,
! 746: int size,
! 747: int recovery);
! 748: xmlDocPtr xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
! 749: const char *buffer,
! 750: int size,
! 751: int recovery,
! 752: void *data);
! 753: xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
! 754: const char *filename,
! 755: int recovery);
! 756: xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
! 757: const char *filename,
! 758: int recovery,
! 759: void *data);
! 760: xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
! 761: const char *filename);
! 762: xmlDocPtr xmlParseEntity (const char *filename);
! 763: xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
! 764: const xmlChar *SystemID);
! 765: xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
! 766: const xmlChar *ExternalID,
! 767: const xmlChar *SystemID);
! 768: xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
! 769: xmlParserInputBufferPtr input,
! 770: xmlCharEncoding enc);
! 771: int xmlParseBalancedChunkMemory(xmlDocPtr doc,
! 772: xmlSAXHandlerPtr sax,
! 773: void *user_data,
! 774: int depth,
! 775: const xmlChar *string,
! 776: xmlNodePtr *lst);
! 777: int xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
! 778: xmlSAXHandlerPtr sax,
! 779: void *user_data,
! 780: int depth,
! 781: const xmlChar *string,
! 782: xmlNodePtr *lst,
! 783: int recover);
! 784: int xmlParseExternalEntity (xmlDocPtr doc,
! 785: xmlSAXHandlerPtr sax,
! 786: void *user_data,
! 787: int depth,
! 788: const xmlChar *URL,
! 789: const xmlChar *ID,
! 790: xmlNodePtr *lst);
! 791: int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
! 792: const xmlChar *URL,
! 793: const xmlChar *ID,
! 794: xmlNodePtr *lst);
! 795:
! 796: /*
! 797: * Parser contexts handling.
! 798: */
! 799: void xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
! 800: void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
! 801: void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
! 802: void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
! 803: const xmlChar* buffer,
! 804: const char *filename);
! 805: xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
! 806:
! 807: /*
! 808: * Reading/setting optional parsing features.
! 809: */
! 810:
! 811: int xmlGetFeaturesList (int *len,
! 812: const char **result);
! 813: int xmlGetFeature (xmlParserCtxtPtr ctxt,
! 814: const char *name,
! 815: void *result);
! 816: int xmlSetFeature (xmlParserCtxtPtr ctxt,
! 817: const char *name,
! 818: void *value);
! 819:
! 820: /*
! 821: * Interfaces for the Push mode.
! 822: */
! 823: xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
! 824: void *user_data,
! 825: const char *chunk,
! 826: int size,
! 827: const char *filename);
! 828: int xmlParseChunk (xmlParserCtxtPtr ctxt,
! 829: const char *chunk,
! 830: int size,
! 831: int terminate);
! 832:
! 833: /*
! 834: * Special I/O mode.
! 835: */
! 836:
! 837: xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
! 838: void *user_data,
! 839: xmlInputReadCallback ioread,
! 840: xmlInputCloseCallback ioclose,
! 841: void *ioctx,
! 842: xmlCharEncoding enc);
! 843:
! 844: xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
! 845: xmlParserInputBufferPtr input,
! 846: xmlCharEncoding enc);
! 847:
! 848: /*
! 849: * Node infos.
! 850: */
! 851: const xmlParserNodeInfo*
! 852: xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
! 853: const xmlNodePtr node);
! 854: void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
! 855: void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
! 856: unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
! 857: const xmlNodePtr node);
! 858: void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
! 859: const xmlParserNodeInfoPtr info);
! 860:
! 861: /*
! 862: * External entities handling actually implemented in xmlIO.
! 863: */
! 864:
! 865: void xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
! 866: xmlExternalEntityLoader
! 867: xmlGetExternalEntityLoader(void);
! 868: xmlParserInputPtr
! 869: xmlLoadExternalEntity (const char *URL,
! 870: const char *ID,
! 871: xmlParserCtxtPtr ctxt);
! 872:
! 873: #ifdef __cplusplus
! 874: }
! 875: #endif
! 876: #endif /* __XML_PARSER_H__ */
! 877:
E-mail: