php_encoding.h 7.8 KB

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