xml/cxmllibrary/src/xmlp/include/cxml_xmlp_entity.h
branchRCL_3
changeset 20 889504eac4fb
equal deleted inserted replaced
19:6bcc0aa4be39 20:889504eac4fb
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Provides a single header for the cXML Parser
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _CXML_ENTITY_H_
       
    21 #define _CXML_ENTITY_H_
       
    22 
       
    23 #include <xml/cxml/cxml_proj.h>
       
    24 
       
    25 #ifdef __cplusplus
       
    26 extern "C" {
       
    27 #endif
       
    28 
       
    29 /* As per WBXML Format Specification (WAP-192-WBXML-20010725-a), 
       
    30  * section 5.8.4.3, the entities in WBXML can be represented either 
       
    31  * as String token (STR_I) or the ENTITY Token. The numeric character 
       
    32  * entities are reprented as ENTITY token and all other as STR_I.
       
    33  * 
       
    34  * In our implementation, all XML/HTML is represented as the numeric 
       
    35  * character entities. The numeric character entities is allocated four
       
    36  * bytes (NW_Uint32). The highest order byte will distinguish between the
       
    37  * different types of entities e.g. between predefined or character numeric 
       
    38  * entities.
       
    39  *
       
    40  */
       
    41 
       
    42   
       
    43 // The maximum length of the entities can't exceed than 
       
    44 // 9 bytes in current implementation. Provides safty
       
    45 // for the infinite loop.
       
    46 	
       
    47 enum { CXML_ATTR_VAL_STR = 512,
       
    48        CXML_ENTITY_VAL_LEN =4
       
    49 };
       
    50 
       
    51 typedef struct CXML_EntitySet_Entry_s {
       
    52    CXML_Uint8* name;
       
    53    CXML_Ucs2 value;
       
    54 }CXML_EntitySet_Entry_t;
       
    55 
       
    56 
       
    57 
       
    58 
       
    59 /** ----------------------------------------------------------------------- **
       
    60     @function:    CXML_XML_Handle_entity
       
    61     @synopsis:    Resolve the entities.
       
    62     @scope:       public      
       
    63 
       
    64     @parameters: 
       
    65         [in] NW_XML_Reader_t* pT
       
    66                   
       
    67 
       
    68         [in] NW_XML_Reader_Interval_t* pI_entityData
       
    69                   Entity name 
       
    70 
       
    71 
       
    72         [out] NW_Uint32* entityVal
       
    73                        If it is Character hex entry, Character decimal entry or
       
    74                        Prefined entry then it contains the hex value of entity.
       
    75                        In case of Internal entities it is zero.
       
    76                         
       
    77 		[out] CXML_Uint8** entityStr
       
    78                        In case of Internal Entities, it is string corresponding 
       
    79                        to the entity name defined in 
       
    80                        NW_XML_Reader_Interval_t* pI_entityData. 
       
    81 
       
    82         [out] NW_Bool* entityFound 
       
    83                        NW_TRUE: If valid type of entity is defined.
       
    84         [in] RPointerArray <CXML_Internal_Entity_t>  internalEntityList 
       
    85                        List of Internal Entities for search. This is
       
    86                        casted to (void*) to avoid c++ related error in
       
    87                        <e32std.h>
       
    88 
       
    89     @description:  * The following type of entities are handled
       
    90                  * 1) Character hex entry
       
    91                  * 2) Character decimal entry
       
    92                  * 3) Prefined entry
       
    93                  * 4) Internal Entities defined in the DTD.
       
    94                  *
       
    95                  * 
       
    96                  
       
    97 
       
    98 
       
    99     @returns:   
       
   100                   In case of file  related failures:  Error codes is returned defined in 
       
   101 				                                      nwx_status.h
       
   102                   NW_STAT_FAILURE : For any general error and entity is not predefined 
       
   103                                     entity.
       
   104                   NW_STAT_SUCCESS: For success
       
   105  -----------------------------------------------------------------------------------**/
       
   106 
       
   107 NW_Status_t CXML_XML_Handle_entity(NW_XML_Reader_t* pT,
       
   108 								   NW_XML_Reader_Interval_t* pI_entityData,
       
   109 								   NW_Uint32* entityVal,
       
   110                                    CXML_Uint8** entityStr,
       
   111 								   NW_Bool* entityFound,
       
   112                                    void* internalEntityList);
       
   113 
       
   114 
       
   115 
       
   116 
       
   117 NW_Status_t CXML_XML_Parser_Entity(NW_XML_Reader_t* pT,
       
   118 							    NW_XML_Reader_Interval_t* I_entityData,
       
   119 							    NW_Bool* entityFound);
       
   120 
       
   121 /** ----------------------------------------------------------------------- **
       
   122     @function:    CXML_XML_Get_Entity
       
   123     @synopsis:    Converts the entity value from CXML_Uint32 to CXML_Byte string.
       
   124     @scope:       public      
       
   125 
       
   126     @parameters: 
       
   127         [in] entityVal
       
   128                   
       
   129 
       
   130         [out] CXML_Byte* entityStr
       
   131                   Entity value in the string.
       
   132 
       
   133 
       
   134         [out] CXML_Uint32* strLen
       
   135                        Length of the entity string. 
       
   136 					   0: In case of error.
       
   137 
       
   138     @description: Converts the entity value from CXML_Uint32 to CXML_Byte string.
       
   139 
       
   140     @returns:   
       
   141                   In case of file  related failures:  Error codes is returned defined in 
       
   142 				                                      nwx_status.h
       
   143                   NW_STAT_FAILURE : For any general error and entity is not predefined 
       
   144                                     entity.
       
   145                   NW_STAT_SUCCESS: For success
       
   146  -----------------------------------------------------------------------------------**/
       
   147 
       
   148 IMPORT_C
       
   149 NW_Status_t CXML_XML_Get_Entity(CXML_Uint32 entityVal,
       
   150 								CXML_Byte* entityStr,
       
   151 								CXML_Uint32* strLen);
       
   152 
       
   153 #ifdef __cplusplus 
       
   154 } // extern "C" {
       
   155 #endif /* __cplusplus */
       
   156 
       
   157 #endif //_CXML_ENTITY_H_