php_encoding.h 7.6 KB

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