Changeset 38 for trunk/include/expat
- Timestamp:
- Feb 17, 2001, 3:03:14 PM (25 years ago)
- Location:
- trunk/include/expat
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/expat/expat.h
r36 r38 31 31 typedef char XML_LChar; 32 32 33 enum XML_Content_Type { 34 XML_CTYPE_EMPTY = 1, 35 XML_CTYPE_ANY, 36 XML_CTYPE_MIXED, 37 XML_CTYPE_NAME, 38 XML_CTYPE_CHOICE, 39 XML_CTYPE_SEQ 33 enum XML_Content_Type 34 { 35 XML_CTYPE_EMPTY = 1, 36 XML_CTYPE_ANY, 37 XML_CTYPE_MIXED, 38 XML_CTYPE_NAME, 39 XML_CTYPE_CHOICE, 40 XML_CTYPE_SEQ 40 41 }; 41 42 42 enum XML_Content_Quant { 43 XML_CQUANT_NONE, 44 XML_CQUANT_OPT, 45 XML_CQUANT_REP, 46 XML_CQUANT_PLUS 43 enum XML_Content_Quant 44 { 45 XML_CQUANT_NONE, 46 XML_CQUANT_OPT, 47 XML_CQUANT_REP, 48 XML_CQUANT_PLUS 47 49 }; 48 50 49 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be 50 XML_CQUANT_NONE, and the other fields will be zero or NULL. 51 If type == XML_CTYPE_MIXED, then quant will be NONE or REP and 52 numchildren will contain number of elements that may be mixed in 53 and children point to an array of XML_Content cells that will be 54 all of XML_CTYPE_NAME type with no quantification. 55 56 If type == XML_CTYPE_NAME, then the name points to the name, and 57 the numchildren field will be zero and children will be NULL. The 58 quant fields indicates any quantifiers placed on the name. 59 60 CHOICE and SEQ will have name NULL, the number of children in 61 numchildren and children will point, recursively, to an array 62 of XML_Content cells. 63 64 The EMPTY, ANY, and MIXED types will only occur at top level. 65 */ 66 67 typedef struct XML_cp XML_Content; 68 69 struct XML_cp { 70 enum XML_Content_Type type; 71 enum XML_Content_Quant quant; 72 const XML_Char * name; 73 unsigned int numchildren; 74 XML_Content * children; 75 }; 51 /* 52 *@@ XMLCONTENT: 53 * structure passed with the @expat "element declaration handler" 54 * (see XML_SetElementDeclHandler). 55 * 56 * The model argument is the root of a tree of XMLCONTENT 57 * nodes. If type equals XML_CTYPE_EMPTY or XML_CTYPE_ANY, 58 * then quant will be XML_CQUANT_NONE, and the other fields 59 * will be zero or NULL. 60 * 61 * If type is XML_CTYPE_MIXED: 62 * 63 * -- "quant" will be XML_CQUANT_NONE or XML_CQUANT_REP. 64 * 65 * -- "numchildren" will contain the number of elements that 66 * are allowed to be mixed in. 67 * 68 * -- "children" points to a sub-array of XMLCONTENT structures 69 * that will all have type XML_CTYPE_NAME with no quantification. 70 * 71 * Only the root node can be type XML_CTYPE_EMPTY, XML_CTYPE_ANY, 72 * or XML_CTYPE_MIXED. 73 * 74 * For type XML_CTYPE_NAME, the name field points to the 75 * name and the numchildren and children fields will be 76 * zero and NULL. The quant field will indicate any 77 * quantifiers placed on the name. 78 * 79 * Types XML_CTYPE_CHOICE and XML_CTYPE_SEQ indicate a 80 * choice or sequence respectively. The numchildren field 81 * indicates how many nodes in the choice or sequence and 82 * children points to the nodes. 83 * 84 *@@added V0.9.9 (2001-02-14) [umoeller] 85 */ 86 87 typedef struct _XMLCONTENT 88 { 89 enum XML_Content_Type type; 90 // one of: 91 // -- XML_CTYPE_EMPTY --> quant will be XML_CQUANT_NONE, rest is NULL 92 // -- XML_CTYPE_ANY, --> quant will be XML_CQUANT_NONE, rest is NULL 93 // -- XML_CTYPE_MIXED, --> (#PCDATA) gives us this 94 // -- XML_CTYPE_CHOICE, --> choice ("|" list) 95 // -- XML_CTYPE_SEQ --> sequence (comma list) 96 97 // -- XML_CTYPE_NAME: used for sub-content if content has CML_CTYPE_MIXED; 98 // only "name" is valid for sub-content 99 100 enum XML_Content_Quant quant; 101 // one of: 102 // -- XML_CQUANT_NONE --> all fields below are NULL 103 // -- XML_CQUANT_OPT, 104 // -- XML_CQUANT_REP, 105 // -- XML_CQUANT_PLUS 106 107 const XML_Char *name; 108 109 unsigned int numchildren; 110 111 struct _XMLCONTENT *children; 112 113 } XMLCONTENT, *PXMLCONTENT; 76 114 77 115 … … 82 120 83 121 typedef void (* EXPATENTRY XML_ElementDeclHandler) (void *userData, 84 const XML_Char *name,85 XML_Content*model);122 const XML_Char *name, 123 XMLCONTENT *model); 86 124 87 125 void XMLPARSEAPI XML_SetElementDeclHandler(XML_Parser parser, … … 292 330 have standalone="yes"). If this handler returns 0, then processing 293 331 will not continue, and the parser will return a 294 XML_ERROR_NOT_STANDALONE error. */332 ERROR_EXPAT_NOT_STANDALONE error. */ 295 333 296 334 typedef int (* EXPATENTRY XML_NotStandaloneHandler)(void *userData); … … 316 354 The handler should return 0 if processing should not continue because of 317 355 a fatal error in the handling of the external entity. 318 In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING356 In this case the calling parser will return an ERROR_EXPAT_EXTERNAL_ENTITY_HANDLING 319 357 error. 320 358 Note that unlike other handlers the first argument is the parser, not userData. */ … … 406 444 } XML_Encoding; 407 445 408 /* This is called for an encoding that is unknown to the parser.409 The encodingHandlerData argument is that which was passed as the410 second argument to XML_SetUnknownEncodingHandler.411 The name argument gives the name of the encoding as specified in412 the encoding declaration.413 If the callback can provide information about the encoding,414 it must fill in the XML_Encoding structure, and return 1.415 Otherwise it must return 0.416 If info does not describe a suitable encoding,417 then the parser will return an XML_UNKNOWN_ENCODING error. */418 419 446 typedef int (* EXPATENTRY XML_UnknownEncodingHandler)(void *encodingHandlerData, 420 const XML_Char *name,421 XML_Encoding *info);447 const XML_Char *name, 448 XML_Encoding *info); 422 449 423 450 void XMLPARSEAPI XML_SetElementHandler(XML_Parser parser, 424 XML_StartElementHandler start,425 XML_EndElementHandler end);451 XML_StartElementHandler start, 452 XML_EndElementHandler end); 426 453 427 454 void XMLPARSEAPI XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); … … 430 457 431 458 void XMLPARSEAPI XML_SetCharacterDataHandler(XML_Parser parser, 432 XML_CharacterDataHandler handler);459 XML_CharacterDataHandler handler); 433 460 434 461 void XMLPARSEAPI XML_SetProcessingInstructionHandler(XML_Parser parser, 435 XML_ProcessingInstructionHandler handler);462 XML_ProcessingInstructionHandler handler); 436 463 void XMLPARSEAPI XML_SetCommentHandler(XML_Parser parser, 437 XML_CommentHandler handler);464 XML_CommentHandler handler); 438 465 439 466 void XMLPARSEAPI XML_SetCdataSectionHandler(XML_Parser parser, 440 XML_StartCdataSectionHandler start,441 XML_EndCdataSectionHandler end);467 XML_StartCdataSectionHandler start, 468 XML_EndCdataSectionHandler end); 442 469 443 470 void XMLPARSEAPI XML_SetStartCdataSectionHandler(XML_Parser parser, … … 594 621 }; 595 622 596 /* Controls parsing of parameter entities (including the external DTD597 subset). If parsing of parameter entities is enabled, then references598 to external parameter entities (including the external DTD subset)599 will be passed to the handler set with600 XML_SetExternalEntityRefHandler. The context passed will be 0.601 Unlike external general entities, external parameter entities can only602 be parsed synchronously. If the external parameter entity is to be603 parsed, it must be parsed during the call to the external entity ref604 handler: the complete sequence of XML_ExternalEntityParserCreate,605 XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during606 this call. After XML_ExternalEntityParserCreate has been called to607 create the parser for the external parameter entity (context must be 0608 for this call), it is illegal to make any calls on the old parser609 until XML_ParserFree has been called on the newly created parser. If610 the library has been compiled without support for parameter entity611 parsing (ie without XML_DTD being defined), then612 XML_SetParamEntityParsing will return 0 if parsing of parameter613 entities is requested; otherwise it will return non-zero. */614 615 623 int XMLPARSEAPI XML_SetParamEntityParsing(XML_Parser parser, 616 enum XML_ParamEntityParsing parsing); 617 618 enum XML_Error { 619 XML_ERROR_NONE, 620 XML_ERROR_NO_MEMORY, 621 XML_ERROR_SYNTAX, 622 XML_ERROR_NO_ELEMENTS, 623 XML_ERROR_INVALID_TOKEN, 624 XML_ERROR_UNCLOSED_TOKEN, 625 XML_ERROR_PARTIAL_CHAR, 626 XML_ERROR_TAG_MISMATCH, 627 XML_ERROR_DUPLICATE_ATTRIBUTE, 628 XML_ERROR_JUNK_AFTER_DOC_ELEMENT, 629 XML_ERROR_PARAM_ENTITY_REF, 630 XML_ERROR_UNDEFINED_ENTITY, 631 XML_ERROR_RECURSIVE_ENTITY_REF, 632 XML_ERROR_ASYNC_ENTITY, 633 XML_ERROR_BAD_CHAR_REF, 634 XML_ERROR_BINARY_ENTITY_REF, 635 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, 636 XML_ERROR_MISPLACED_XML_PI, 637 XML_ERROR_UNKNOWN_ENCODING, 638 XML_ERROR_INCORRECT_ENCODING, 639 XML_ERROR_UNCLOSED_CDATA_SECTION, 640 XML_ERROR_EXTERNAL_ENTITY_HANDLING, 641 XML_ERROR_NOT_STANDALONE, 642 XML_ERROR_UNEXPECTED_STATE 643 }; 624 enum XML_ParamEntityParsing parsing); 625 626 #define ERROR_EXPAT_NONE 0 // explicitly added V0.9.9 (2001-02-14) [umoeller] 627 628 #define ERROR_XML_FIRST 40000 // first error code used 629 630 typedef enum _XMLERROR 631 { 632 // ERROR_EXPAT_NONE, // removed to adhere with APIRET V0.9.9 (2001-02-14) [umoeller] 633 ERROR_EXPAT_NO_MEMORY = ERROR_XML_FIRST, 634 ERROR_EXPAT_SYNTAX, 635 ERROR_EXPAT_NO_ELEMENTS, 636 ERROR_EXPAT_INVALID_TOKEN, 637 ERROR_EXPAT_UNCLOSED_TOKEN, 638 ERROR_EXPAT_PARTIAL_CHAR, 639 ERROR_EXPAT_TAG_MISMATCH, 640 ERROR_EXPAT_DUPLICATE_ATTRIBUTE, 641 ERROR_EXPAT_JUNK_AFTER_DOC_ELEMENT, 642 ERROR_EXPAT_PARAM_ENTITY_REF, 643 ERROR_EXPAT_UNDEFINED_ENTITY, 644 ERROR_EXPAT_RECURSIVE_ENTITY_REF, 645 ERROR_EXPAT_ASYNC_ENTITY, 646 ERROR_EXPAT_BAD_CHAR_REF, 647 ERROR_EXPAT_BINARY_ENTITY_REF, 648 ERROR_EXPAT_ATTRIBUTE_EXTERNAL_ENTITY_REF, 649 ERROR_EXPAT_MISPLACED_XML_PI, 650 ERROR_EXPAT_UNKNOWN_ENCODING, 651 ERROR_EXPAT_INCORRECT_ENCODING, 652 ERROR_EXPAT_UNCLOSED_CDATA_SECTION, 653 ERROR_EXPAT_EXTERNAL_ENTITY_HANDLING, 654 ERROR_EXPAT_NOT_STANDALONE, 655 ERROR_EXPAT_UNEXPECTED_STATE, 656 657 ERROR_EXPAT_AFTER_LAST // added V0.9.9 (2001-02-14) [umoeller]; 658 // xml.h builds on this 659 } XMLERROR; 644 660 645 661 /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode 646 662 returns information about the error. */ 647 663 648 enum XML_ErrorXMLPARSEAPI XML_GetErrorCode(XML_Parser parser);664 XMLERROR XMLPARSEAPI XML_GetErrorCode(XML_Parser parser); 649 665 650 666 /* These functions return information about the current parse location. … … 687 703 688 704 /* Returns a string describing the error. */ 689 const XML_LChar XMLPARSEAPI * XML_ErrorString(int code); 705 // const XML_LChar XMLPARSEAPI * XML_ErrorString(int code); 706 // moved this to xml.c V0.9.9 (2001-02-16) [umoeller] 690 707 691 708 /* Return a string containing the version number of this expat */ -
trunk/include/expat/expat_setup.h
r36 r38 18 18 #define EXPATENTRY _Optlink 19 19 #endif 20 21 #define XML_DTD 1 22 20 23 #endif 21 24 -
trunk/include/expat/xmlrole.h
r36 r38 6 6 #ifndef XmlRole_INCLUDED 7 7 #define XmlRole_INCLUDED 1 8 9 #include "expat\expat_setup.h" 10 // V0.9.9 (2001-02-10) [umoeller] 11 // to save the app from having to include this as well 8 12 9 13 #include "expat\xmltok.h" -
trunk/include/expat/xmltok.h
r36 r38 6 6 #ifndef XmlTok_INCLUDED 7 7 #define XmlTok_INCLUDED 1 8 9 #include "expat\expat_setup.h" 10 // V0.9.9 (2001-02-10) [umoeller] 11 // to save the app from having to include this as well 8 12 9 13 #ifdef __cplusplus … … 154 158 const char *); 155 159 void (* EXPATENTRY updatePosition)(const ENCODING *, 156 const char *ptr,157 const char *end,158 POSITION *);160 const char *ptr, 161 const char *end, 162 POSITION *); 159 163 int (* EXPATENTRY isPublicId)(const ENCODING *enc, 160 164 const char *ptr,
Note:
See TracChangeset
for help on using the changeset viewer.