1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | http://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Brad Lafountain <rodif_bl@yahoo.com> | 14 | Shane Caraveo <shane@caraveo.com> | 15 | Dmitry Stogov <dmitry@php.net> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 #ifndef PHP_ENCODING_H 20 #define PHP_ENCODING_H 21 22 #define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema" 23 #define XSD_1999_TIMEINSTANT 401 24 #define XSD_1999_TIMEINSTANT_STRING "timeInstant" 25 26 #define SOAP_1_1_ENV_NAMESPACE "http://schemas.xmlsoap.org/soap/envelope/" 27 #define SOAP_1_1_ENV_NS_PREFIX "SOAP-ENV" 28 29 #define SOAP_1_2_ENV_NAMESPACE "http://www.w3.org/2003/05/soap-envelope" 30 #define SOAP_1_2_ENV_NS_PREFIX "env" 31 32 #define SOAP_1_1_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/" 33 #define SOAP_1_1_ENC_NS_PREFIX "SOAP-ENC" 34 35 #define SOAP_1_2_ENC_NAMESPACE "http://www.w3.org/2003/05/soap-encoding" 36 #define SOAP_1_2_ENC_NS_PREFIX "enc" 37 38 #define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema" 39 #define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema" 40 #define XSD_NS_PREFIX "xsd" 41 #define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance" 42 #define XSI_NS_PREFIX "xsi" 43 #define XML_NAMESPACE "http://www.w3.org/XML/1998/namespace" 44 #define XML_NS_PREFIX "xml" 45 46 #define XSD_STRING 101 47 #define XSD_STRING_STRING "string" 48 #define XSD_BOOLEAN 102 49 #define XSD_BOOLEAN_STRING "boolean" 50 #define XSD_DECIMAL 103 51 #define XSD_DECIMAL_STRING "decimal" 52 #define XSD_FLOAT 104 53 #define XSD_FLOAT_STRING "float" 54 #define XSD_DOUBLE 105 55 #define XSD_DOUBLE_STRING "double" 56 #define XSD_DURATION 106 57 #define XSD_DURATION_STRING "duration" 58 #define XSD_DATETIME 107 59 #define XSD_DATETIME_STRING "dateTime" 60 #define XSD_TIME 108 61 #define XSD_TIME_STRING "time" 62 #define XSD_DATE 109 63 #define XSD_DATE_STRING "date" 64 #define XSD_GYEARMONTH 110 65 #define XSD_GYEARMONTH_STRING "gYearMonth" 66 #define XSD_GYEAR 111 67 #define XSD_GYEAR_STRING "gYear" 68 #define XSD_GMONTHDAY 112 69 #define XSD_GMONTHDAY_STRING "gMonthDay" 70 #define XSD_GDAY 113 71 #define XSD_GDAY_STRING "gDay" 72 #define XSD_GMONTH 114 73 #define XSD_GMONTH_STRING "gMonth" 74 #define XSD_HEXBINARY 115 75 #define XSD_HEXBINARY_STRING "hexBinary" 76 #define XSD_BASE64BINARY 116 77 #define XSD_BASE64BINARY_STRING "base64Binary" 78 #define XSD_ANYURI 117 79 #define XSD_ANYURI_STRING "anyURI" 80 #define XSD_QNAME 118 81 #define XSD_QNAME_STRING "QName" 82 #define XSD_NOTATION 119 83 #define XSD_NOTATION_STRING "NOTATION" 84 #define XSD_NORMALIZEDSTRING 120 85 #define XSD_NORMALIZEDSTRING_STRING "normalizedString" 86 #define XSD_TOKEN 121 87 #define XSD_TOKEN_STRING "token" 88 #define XSD_LANGUAGE 122 89 #define XSD_LANGUAGE_STRING "language" 90 #define XSD_NMTOKEN 123 91 #define XSD_NMTOKEN_STRING "NMTOKEN" 92 #define XSD_NAME 124 93 #define XSD_NAME_STRING "Name" 94 #define XSD_NCNAME 125 95 #define XSD_NCNAME_STRING "NCName" 96 #define XSD_ID 126 97 #define XSD_ID_STRING "ID" 98 #define XSD_IDREF 127 99 #define XSD_IDREF_STRING "IDREF" 100 #define XSD_IDREFS 128 101 #define XSD_IDREFS_STRING "IDREFS" 102 #define XSD_ENTITY 129 103 #define XSD_ENTITY_STRING "ENTITY" 104 #define XSD_ENTITIES 130 105 #define XSD_ENTITIES_STRING "ENTITIES" 106 #define XSD_INTEGER 131 107 #define XSD_INTEGER_STRING "integer" 108 #define XSD_NONPOSITIVEINTEGER 132 109 #define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger" 110 #define XSD_NEGATIVEINTEGER 133 111 #define XSD_NEGATIVEINTEGER_STRING "negativeInteger" 112 #define XSD_LONG 134 113 #define XSD_LONG_STRING "long" 114 #define XSD_INT 135 115 #define XSD_INT_STRING "int" 116 #define XSD_SHORT 136 117 #define XSD_SHORT_STRING "short" 118 #define XSD_BYTE 137 119 #define XSD_BYTE_STRING "byte" 120 #define XSD_NONNEGATIVEINTEGER 138 121 #define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger" 122 #define XSD_UNSIGNEDLONG 139 123 #define XSD_UNSIGNEDLONG_STRING "unsignedLong" 124 #define XSD_UNSIGNEDINT 140 125 #define XSD_UNSIGNEDINT_STRING "unsignedInt" 126 #define XSD_UNSIGNEDSHORT 141 127 #define XSD_UNSIGNEDSHORT_STRING "unsignedShort" 128 #define XSD_UNSIGNEDBYTE 142 129 #define XSD_UNSIGNEDBYTE_STRING "unsignedByte" 130 #define XSD_POSITIVEINTEGER 143 131 #define XSD_POSITIVEINTEGER_STRING "positiveInteger" 132 #define XSD_NMTOKENS 144 133 #define XSD_NMTOKENS_STRING "NMTOKENS" 134 #define XSD_ANYTYPE 145 135 #define XSD_ANYTYPE_STRING "anyType" 136 #define XSD_UR_TYPE 146 137 #define XSD_UR_TYPE_STRING "ur-type" 138 139 #define XSD_ANYXML 147 140 141 #define APACHE_NAMESPACE "http://xml.apache.org/xml-soap" 142 #define APACHE_MAP 200 143 #define APACHE_MAP_STRING "Map" 144 145 #define SOAP_ENC_ARRAY 300 146 #define SOAP_ENC_ARRAY_STRING "Array" 147 #define SOAP_ENC_OBJECT 301 148 #define SOAP_ENC_OBJECT_STRING "Struct" 149 150 #define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/" 151 #define WSDL_NS_PREFIX "wsdl" 152 153 #define WSDL_SOAP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/" 154 #define WSDL_SOAP12_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap12/" 155 #define RPC_SOAP12_NAMESPACE "http://www.w3.org/2003/05/soap-rpc" 156 #define RPC_SOAP12_NS_PREFIX "rpc" 157 158 #define WSDL_HTTP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/" 159 #define WSDL_HTTP12_NAMESPACE "http://www.w3.org/2003/05/soap/bindings/HTTP/" 160 #define WSDL_HTTP_NS_PREFIX "http" 161 162 #define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http" 163 164 #define WSDL_MIME_NAMESPACE "http://schemas.xmlsoap.org/wsdl/mime/" 165 166 #define WSDL_DIME_NAMESPACE "http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/" 167 #define WSDL_DIME_OPEN "http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout" 168 #define WSDL_DIME_CLOSED "http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" 169 170 #define UNKNOWN_TYPE 999998 171 #define END_KNOWN_TYPES 999999 172 173 struct _encodeType { 174 int type; 175 char *type_str; 176 char *ns; 177 sdlTypePtr sdl_type; 178 soapMappingPtr map; 179 }; 180 181 struct _encode { 182 encodeType details; 183 zval *(*to_zval)(zval *ret, encodeTypePtr type, xmlNodePtr data); 184 xmlNodePtr (*to_xml)(encodeTypePtr type, zval *data, int style, xmlNodePtr parent); 185 }; 186 187 /* Master functions all encode/decode should be called thur these functions */ 188 xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent); 189 zval *master_to_zval(zval *ret, encodePtr encode, xmlNodePtr data); 190 191 /* user defined mapping */ 192 xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr parent); 193 zval *to_zval_user(zval *ret, encodeTypePtr type, xmlNodePtr node); 194 195 void whiteSpace_replace(xmlChar* str); 196 void whiteSpace_collapse(xmlChar* str); 197 198 xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval* data, int style, xmlNodePtr parent); 199 zval *sdl_guess_convert_zval(zval *ret, encodeTypePtr enc, xmlNodePtr data); 200 201 void encode_finish(); 202 void encode_reset_ns(); 203 xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns); 204 205 encodePtr get_conversion(int encode); 206 207 void delete_encoder(zval *zv); 208 void delete_encoder_persistent(zval *zv); 209 210 extern const encode defaultEncoding[]; 211 extern int numDefaultEncodings; 212 213 #endif 214