XMLDefs.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _B_XML2_DEFS_H
00014 #define _B_XML2_DEFS_H
00015 
00016 #include <support/Errors.h>
00017 #include <support/TypeConstants.h>
00018 
00019 #if _SUPPORTS_NAMESPACE
00020 namespace palmos {
00021 namespace xml {
00022 using namespace support;
00023 #endif
00024 
00025 // If this is defined to 1, a lot of the conveninece methods are disabled
00026 // so it has a smaller memory footprint for BeIA
00027 // Don't just go and turn this on.  It adds tons of code.
00028 #define _SMALL_XML_FOOTPRINT_ 1
00029 
00030 
00031 // XML Type Code
00032 // =====================================================================
00033 enum
00034 {
00035     B_XML_DOCUMENT_CONTENT                      = 0x00000001,
00036     B_XML_DOCUMENT_TYPE_CONTENT                 = 0x00000002,
00037     B_XML_ELEMENT_CONTENT                       = 0x00000004,
00038     B_XML_ATTRIBUTE_CONTENT                     = 0x00000008,
00039     B_XML_TEXT_CONTENT                          = 0x00000010,
00040     B_XML_CDATA_CONTENT                         = 0x00000020,
00041     B_XML_PROCESSING_INSTRUCTION_CONTENT        = 0x00000040,
00042     B_XML_COMMENT_CONTENT                       = 0x00000080,
00043     B_XML_ATTRIBUTE_DECL_OBJECT                 = 0x00000100,
00044     B_XML_ELEMENT_DECL_OBJECT                   = 0x00000200,
00045     B_XML_ENTITY_DECL_OBJECT                    = 0x00000400,
00046     B_XML_DTD_OBJECT                            = 0x00000800,
00047     
00048     B_XML_ANY_CONTENT                           = 0xFFFFFFFF,
00049     
00050     B_XML_BEOS_CONTENT_TYPE_MASK    = 0x0000FFFF    // Anything that masks with this
00051                                                     // is reserved for use by Be. Other
00052                                                     // people can use the rest for their
00053                                                     // own purposes
00054 };
00055 
00056 
00057 #define B_XML_DTD_DIRECTORY "xml_dtds"
00058 
00059 
00060 // XML Kit Errors
00061 // =====================================================================
00062 // These should go into Errors.h
00063 // XXX NEED TO DEFINE XML ERROR CLASS
00064 #define B_XML_ERROR_BASE            (xmlErrorClass+1)
00065 enum {
00066     B_XML_ALREADY_ATTACHED          = B_XML_ERROR_BASE,
00067     B_XML_NOT_ATTACHED,
00068     B_XML_CANT_CONVERT_STRING,
00069     B_XML_ONE_ELEMENT_PER_DOCUMENT,
00070     B_XML_ONE_DOCTYPE_PER_DOCUMENT,
00071     B_XML_BAD_PARENT,
00072     B_XML_MATCH_NOT_FOUND,
00073     B_XML_INVALID_XPATH,
00074     B_XML_INVALID_XSLT_DOCUMENT,
00075     B_XML_BAD_ELEMENT_NESTING,
00076     
00077     B_XML_MAX_TOKEN_LENGTH_EXCEEDED,            // Names, etc. can only be 256 chars long
00078                                                 // because you need to set some limit
00079     B_XML_BAD_NAME_CHARACTER,                   // Names for elements, etc.
00080     B_XML_PARSE_ERROR,                          // General Parse Error -- Something in the wrong place
00081     B_XML_ENTITY_VALUE_NO_QUOTES,               // Entity values / IDs must be surrounded by quotation marks
00082     B_XML_RECURSIVE_ENTITY,
00083     B_XML_NO_UNPARSED_PARAMETER_ENTITIES,
00084     B_XML_ENTITY_NOT_FOUND,
00085     B_XML_DECLARATION_NOT_IN_DTD,
00086     B_XML_NO_DTD,
00087     B_XML_ILLEGAL_UNPARSED_ENTITY_REF,
00088     B_XML_INVALID_ATTR_TYPE,
00089     B_XML_BAD_ATTR_BEHAVIOR,
00090     B_XML_AMBIGUOS_CHILDREN_PATTERN,
00091     B_XML_NO_EMPTY_NAMES,
00092     B_XML_ATTR_NAME_IN_USE,
00093     
00094     B_XML_NAMESPACE_NOT_DECLARED,
00095     B_XML_BAD_NAMESPACE_PREFIX,
00096     B_XML_NAMESPACE_PREFIX_COLLISION,
00097     B_XML_ATTRS_WITH_COLLIDING_NAMESPACES,
00098     B_XML_ALREADY_DECLARED,
00099     
00100     // Validation Errors
00101     B_XML_ELEMENT_NOT_DECLARED,
00102     B_XML_ATTRIBUTE_NOT_DECLARED,
00103     B_XML_ATTRIBUTE_BAD_FIXED_VALUE,
00104     B_XML_REQUIRED_ATTRIBUTE_MISSING,
00105     B_XML_ENTITY_REF_NOT_UNPARSED,
00106     B_XML_BAD_ENUM_VALUE,
00107     B_XML_ELEMENT_NOT_EMPTY,
00108     B_XML_CHILD_ELEMENT_NOT_ALLOWED,
00109     B_XML_CHILD_TEXT_NOT_ALLOWED,
00110     B_XML_CHILD_CDATA_NOT_ALLOWED,
00111     B_XML_CHILD_PATTERN_NOT_FINISHED,
00112     
00113     // These are only warnings.  The default OnParseError fails on them.
00114     // Maybe this behavior should be changed.
00115     B_XML_WARNINGS_BASE,
00116     
00117     B_XML_ENTITY_ALREADY_EXISTS,                // The first one is the one that's used.
00118     
00119     B_XML_ERRORS_END
00120 };
00121 
00122 enum xml_attr_behavior
00123 {
00124     B_XML_ATTRIBUTE_REQUIRED,
00125     B_XML_ATTRIBUTE_IMPLIED,
00126     B_XML_ATTRIBUTE_FIXED,
00127     B_XML_ATTRIBUTE_OPTIONAL,
00128     B_XML_ATTRIBUTE_DEFAULT
00129 };
00130 
00131 enum
00132 {
00133     B_ENUM_TYPE         = 'ENUM',
00134     B_NOTATION_TYPE     = 'NOTN',       // Not supported yet
00135     B_ID_TYPE           = 'IDYO',
00136     B_IDREF_TYPE        = 'IDRF',
00137     B_IDREFS_TYPE       = 'IRFS',
00138     B_ENTITY_TYPE       = 'ENTI',
00139     B_ENTITIES_TYPE     = 'ENTS',
00140     B_NMTOKEN_TYPE      = 'NTKN',
00141     B_NMTOKENS_TYPE     = 'NTKS'
00142 };
00143 
00144 
00145 // Parsing Flags
00146 // =====================================================================
00147 enum
00148 {
00149     B_XML_COALESCE_WHITESPACE           = 0x00000001,
00150     B_XML_HANDLE_ATTRIBUTE_ENTITIES     = 0x00000002,
00151     B_XML_HANDLE_CONTENT_ENTITIES       = 0x00000004,
00152     B_XML_HANDLE_ALL_ENTITIES           = 0x00000006,
00153     B_XML_HANDLE_NAMESPACES             = 0x00000008,
00154     B_XML_GET_NAMESPACE_DTDS            = 0x00000010,
00155     B_XML_DONT_EXPAND_CHARREFS          = 0x00000020
00156 };
00157 
00158 
00159 #if _SUPPORTS_NAMESPACE
00160 }; // namespace xml
00161 }; // namespace palmos
00162 #endif
00163 
00164 #endif // _B_XML2_DEFS_H