Ignore:
Timestamp:
May 22, 2001, 7:18:41 PM (24 years ago)
Author:
umoeller
Message:

misc updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/xml.h

    r64 r71  
    4343     ********************************************************************/
    4444
    45     typedef enum _DOMERROR
    46     {
    47         // validity errors:
     45    // ERROR_XML_FIRST is defined in expat\expat.h;
     46    // the range up to ERROR_XML_FIRST + 24 is used
     47    // by expat
     48
    4849// START MATCHING ERROR MESSAGES (xmlDescribeError)
    49         ERROR_DOM_UNDECLARED_ELEMENT = ERROR_EXPAT_AFTER_LAST,
     50            // validity errors:
     51    #define ERROR_DOM_UNDECLARED_ELEMENT    (ERROR_XML_FIRST + 24)
    5052                // invalidity: element is undeclared
    51         ERROR_DOM_ROOT_ELEMENT_MISNAMED,
    52         ERROR_DOM_INVALID_ROOT_ELEMENT,
    53         ERROR_DOM_INVALID_SUBELEMENT,
     53    #define ERROR_DOM_ROOT_ELEMENT_MISNAMED (ERROR_XML_FIRST + 25)
     54    #define ERROR_DOM_INVALID_ROOT_ELEMENT (ERROR_XML_FIRST + 26)
     55    #define ERROR_DOM_INVALID_SUBELEMENT (ERROR_XML_FIRST + 27)
    5456                // subelement may not appear in its parent element
    55         ERROR_DOM_DUPLICATE_ELEMENT_DECL,
     57    #define ERROR_DOM_DUPLICATE_ELEMENT_DECL (ERROR_XML_FIRST + 28)
    5658                // more than one declaration for an element type
    57         ERROR_DOM_DUPLICATE_ATTRIBUTE_DECL,
     59    #define ERROR_DOM_DUPLICATE_ATTRIBUTE_DECL (ERROR_XML_FIRST + 29)
    5860                // more than one declaration for an attribute type
    59         ERROR_DOM_UNDECLARED_ATTRIBUTE,
    60         ERROR_ELEMENT_CANNOT_HAVE_CONTENT,
     61    #define ERROR_DOM_UNDECLARED_ATTRIBUTE (ERROR_XML_FIRST + 30)
     62    #define ERROR_ELEMENT_CANNOT_HAVE_CONTENT (ERROR_XML_FIRST + 31)
    6163                // element was declared "empty" and contains text anyway,
    6264                // or was declared "children" and contains something other
    6365                // than whitespace
    64         ERROR_DOM_INVALID_ATTRIB_VALUE,
    65         ERROR_DOM_REQUIRED_ATTRIBUTE_MISSING,
    66         ERROR_DOM_SUBELEMENT_IN_EMPTY_ELEMENT,
     66    #define ERROR_DOM_INVALID_ATTRIB_VALUE (ERROR_XML_FIRST + 32)
     67    #define ERROR_DOM_REQUIRED_ATTRIBUTE_MISSING (ERROR_XML_FIRST + 33)
     68    #define ERROR_DOM_SUBELEMENT_IN_EMPTY_ELEMENT (ERROR_XML_FIRST + 34)
    6769// END MATCHING ERROR MESSAGES (xmlDescribeError)
    6870
    6971        // error categories:
    70         ERROR_DOM_PARSING,
    71         ERROR_DOM_VALIDITY,
     72    #define ERROR_DOM_PARSING (ERROR_XML_FIRST + 35)
     73    #define ERROR_DOM_VALIDITY (ERROR_XML_FIRST + 36)
    7274
    7375        // additional DOM errors
    74         ERROR_DOM_NODETYPE_NOT_SUPPORTED,
     76    #define ERROR_DOM_NODETYPE_NOT_SUPPORTED (ERROR_XML_FIRST + 37)
    7577                // invalid node type in xmlCreateDomNode
    76         ERROR_DOM_NO_DOCUMENT,
     78    #define ERROR_DOM_NO_DOCUMENT (ERROR_XML_FIRST + 38)
    7779                // cannot find document node
    78         ERROR_DOM_NO_ELEMENT,
    79         ERROR_DOM_DUPLICATE_DOCTYPE,
    80         ERROR_DOM_DOCTYPE_ROOT_NAMES_MISMATCH,
     80    #define ERROR_DOM_NO_ELEMENT (ERROR_XML_FIRST + 39)
     81    #define ERROR_DOM_DUPLICATE_DOCTYPE (ERROR_XML_FIRST + 40)
     82    #define ERROR_DOM_DOCTYPE_ROOT_NAMES_MISMATCH (ERROR_XML_FIRST + 41)
    8183                // DOCTYPE is given and root element name does not match doctype name
    82         ERROR_DOM_INTEGRITY,
    83         ERROR_DOM_DUPLICATE_ATTRIBUTE,
     84    #define ERROR_DOM_INTEGRITY (ERROR_XML_FIRST + 42)
     85    #define ERROR_DOM_DUPLICATE_ATTRIBUTE (ERROR_XML_FIRST + 43)
    8486
    8587        // @@@todo these
    86         ERROR_DOM_VALIDATE_INVALID_ELEMENT,
    87         ERROR_DOM_ELEMENT_DECL_OUTSIDE_DOCTYPE,
    88         ERROR_DOM_ATTLIST_DECL_OUTSIDE_DOCTYPE
    89     } DOMERROR;
     88    #define ERROR_DOM_VALIDATE_INVALID_ELEMENT (ERROR_XML_FIRST + 44)
     89    #define ERROR_DOM_ELEMENT_DECL_OUTSIDE_DOCTYPE (ERROR_XML_FIRST + 45)
     90    #define ERROR_DOM_ATTLIST_DECL_OUTSIDE_DOCTYPE (ERROR_XML_FIRST + 46)
    9091
    9192    const char* xmlDescribeError(int code);
     
    130131    /*
    131132     *@@ NODEBASE:
    132      *      "content model" node. With the DOM content models,
    133      *      this represents an entry in a DTD or XML schema.
     133     *      root class of all nodes used in the
     134     *      DOM tree.
     135     *
     136     *      The first item is a TREE to make this insertable
     137     *      into string maps via the functions in tree.c.
     138     *
     139     *      A NODEBASE is also the first member of a DOMNODE
     140     *      so this is effectively a simulation of inheritance
     141     *      in plain C... DOMNODE inherits from NODEBASE,
     142     *      and some other types inherit from DOMNODE.
     143     *
     144     *      This contains the node name, which is also used
     145     *      by the DOMNODE's (e.g. for element names).
     146     *      However, only DOMNODE defines the node value
     147     *      string.
    134148     *
    135149     *@@added V0.9.9 (2001-02-14) [umoeller]
     
    138152    typedef struct _NODEBASE
    139153    {
    140         TREE            Tree;
    141 
    142         NODEBASETYPE    ulNodeType;
     154        TREE            Tree;           // tree.c
     155
     156        NODEBASETYPE    ulNodeType;     // class type; this is precious,
     157                                        // all xml* functions make assumptions
     158                                        // from this value
    143159
    144160        XSTRING         strNodeName;
     
    189205     *      Overview of member fields usage:
    190206     +
    191      +      ulNodeType    | strNodeName | strNodeValue | llChildren | llAttributes
     207     +      ulNodeType    | strNodeName | strNodeValue | llChildren | AttributesMap
     208     +      (NODEBASE)    | (NODEBASE)  | (DOMNODE)    | (DOMNODE)  | (DOMNODE)
    192209     +      =======================================================================
    193210     +                    |             |              |            |
     
    409426                    // one of:
    410427                    // -- XML_CQUANT_NONE   --> all fields below are NULL
    411                     // -- XML_CQUANT_OPT,
    412                     // -- XML_CQUANT_REP,
    413                     // -- XML_CQUANT_PLUS
     428                    // -- XML_CQUANT_OPT,   question mark
     429                    // -- XML_CQUANT_REP,   asterisk
     430                    // -- XML_CQUANT_PLUS   plus sign
    414431
    415432        struct _CMELEMENTPARTICLE *pParentParticle;     // or NULL if this is in the
     
    596613    /* ******************************************************************
    597614     *
    598      *   DOM APIs
     615     *   DOM parser APIs
    599616     *
    600617     ********************************************************************/
     
    690707                                   const char *pcszAttribName);
    691708
     709    /* ******************************************************************
     710     *
     711     *   DOM build
     712     *
     713     ********************************************************************/
     714
     715    APIRET xmlCreateDocument(const char *pcszRootElementName,
     716                             PDOMDOCUMENTNODE *ppDocument,
     717                             PDOMNODE *ppRootElement);
     718
     719    APIRET xmlWriteDocument(PDOMDOCUMENTNODE pDocument,
     720                            const char *pcszEncoding,
     721                            const char *pcszDoctype,
     722                            PXSTRING pxstr);
    692723#endif
    693724
Note: See TracChangeset for help on using the changeset viewer.