You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/05 07:22:15 UTC
svn commit: r353997 [2/2] - in /webservices/axis2/trunk/c/bindings/php: ./
axis2/ axis2/tests/
Added: webservices/axis2/trunk/c/bindings/php/axis2/om_processing_instruction.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_processing_instruction.c?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_processing_instruction.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_processing_instruction.c Sun Dec 4 22:21:44 2005
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_om_node.h"
+#include "axis2_om_processing_instruction.h"
+
+zend_function_entry axis2_om_pi_class_functions[] =
+{
+ PHP_FALIAS(setValue , axis2_om_pi_set_value, NULL)
+ PHP_FALIAS(setTarget , axis2_om_pi_set_target, NULL)
+ PHP_FALIAS(getValue , axis2_om_pi_get_value, NULL)
+ PHP_FALIAS(getTarget , axis2_om_pi_getTarget, NULL)
+ /* PHP_FALIAS(serialize , axis2_om_pi_serialize, NULL) */
+ PHP_ME(om_pi, __construct, NULL, ZEND_ACC_PUBLIC)
+ { NULL, NULL, NULL}
+};
+
+
+PHP_METHOD(om_pi, __construct)
+{
+ axis2_object_ptr intern = NULL;
+ axis2_object_ptr intern_parent = NULL;
+
+ om_node_ptr node_obj = NULL;
+ om_node_ptr node_obj_parent = NULL;
+
+ zval *object = NULL;
+ zval *object_parent = NULL;
+
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+ int value_len = 0;
+ char *target = NULL;
+ int target_len = 0;
+
+ axis2_om_processing_instruction_t *om_pi = NULL;
+ axis2_om_node_t *node = NULL;
+ axis2_om_node_t *node_parent = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "OO!ss",&object, axis2_om_pi_class_entry, &object_parent,
+ axis2_om_node_class_entry, &target, &target_len, &value, &value_len) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+
+ env = php_axis2_get_env();
+
+ intern = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+
+ node_obj = (om_node_ptr)emalloc(sizeof(om_node_t));
+ node_obj->builder = NULL;
+ node_obj->doc = NULL;
+ node_obj->node_type = OM_PI;
+
+ if(object_parent)
+ {
+ AXIS2_GET_OBJ(node_obj_parent, object_parent, om_node_ptr, intern_parent);
+ if(node_obj_parent && node_obj_parent->ptr)
+ node_parent = (axis2_om_node_t *)(node_obj_parent->ptr);
+ }
+
+ om_pi = axis2_om_processing_instruction_create(&env, node_parent, target, value, &node);
+ node_obj->ptr = node;
+ intern->obj_type = OM_NODE_OBJ;
+ intern->ptr = node_obj;
+}
+
+PHP_FUNCTION(axis2_om_pi_get_value)
+{
+ axis2_object_ptr intern = NULL;
+ om_node_ptr node_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+
+ axis2_om_processing_instruction_t *om_pi = NULL;
+ axis2_om_node_t *node = NULL;
+
+
+ env = php_axis2_get_env();
+
+ AXIS2_GET_THIS(object);
+ AXIS2_GET_OBJ(node_obj, object, om_node_ptr, intern);
+ node = (axis2_om_node_t *)(node_obj->ptr);
+ if(node)
+ {
+ om_pi = (axis2_om_processing_instruction_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, &env);
+ value = AXIS2_OM_PROCESSING_INSTRUCTION_GET_VALUE(om_pi, &env);
+ RETURN_STRING(value, 1);
+ }
+ RETURN_NULL();
+}
+
+
+PHP_FUNCTION(axis2_om_pi_getTarget)
+{
+ axis2_object_ptr intern = NULL;
+ om_node_ptr node_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ char *target = NULL;
+
+ axis2_om_processing_instruction_t *om_pi = NULL;
+ axis2_om_node_t *node = NULL;
+
+
+ env = php_axis2_get_env();
+
+ AXIS2_GET_THIS(object);
+ AXIS2_GET_OBJ(node_obj, object, om_node_ptr, intern);
+ node = (axis2_om_node_t *)(node_obj->ptr);
+ if(node)
+ {
+ om_pi = (axis2_om_processing_instruction_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, &env);
+ target = AXIS2_OM_PROCESSING_INSTRUCTION_GET_TARGET(om_pi, &env);
+ RETURN_STRING(target , 1);
+ }
+ RETURN_NULL();
+}
+
+PHP_FUNCTION(axis2_om_pi_set_value)
+{
+ axis2_object_ptr intern = NULL;
+ om_node_ptr node_obj = NULL;
+
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+ int value_len = 0;
+
+ axis2_om_processing_instruction_t *om_pi = NULL;
+ axis2_om_node_t *node = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "Os",&object, axis2_om_pi_class_entry, &value, &value_len) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+
+ AXIS2_GET_OBJ(node_obj, object, om_node_ptr, intern);
+
+ node = (axis2_om_node_t *)(node_obj->ptr);
+ if(node)
+ {
+ om_pi = (axis2_om_processing_instruction_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, &env);
+ AXIS2_OM_PROCESSING_INSTRUCION_SET_VALUE(om_pi, &env, value);
+ }
+}
+PHP_FUNCTION(axis2_om_pi_set_target){}
+PHP_FUNCTION(axis2_om_pi_serialize){}
+
Added: webservices/axis2/trunk/c/bindings/php/axis2/om_stax_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_stax_builder.c?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_stax_builder.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_stax_builder.c Sun Dec 4 22:21:44 2005
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_om_node.h"
+#include "axis2_om_stax_builder.h"
+
+zend_function_entry php_axis2_om_stax_builder_class_functions[] =
+{
+ PHP_FALIAS(next , axis2_om_stax_builder_next, NULL)
+ PHP_FALIAS(discard , axis2_om_stax_builder_discard_current_element, NULL)
+ PHP_ME(om_stax_builder, __construct, NULL, ZEND_ACC_PUBLIC)
+ { NULL, NULL, NULL}
+};
+
+PHP_METHOD(om_stax_builder, __construct)
+{
+ axis2_object_ptr intern = NULL;
+ axis2_object_ptr intern_reader = NULL;
+
+ om_object_ptr om_obj = NULL;
+ om_object_ptr om_obj_reader = NULL;
+
+ zval *object = NULL;
+ zval *object_reader = NULL;
+
+ axis2_om_stax_builder_t *builder = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "OO",&object, axis2_om_stax_builder_class_entry, &object_reader,
+ axis2_xml_reader_class_entry) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+
+ env = php_axis2_get_env();
+ AXIS2_GET_OBJ(om_obj_reader, object_reader, om_object_ptr, intern_reader);
+
+ intern = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+
+ om_obj = (om_object_ptr)emalloc(sizeof(om_object));
+ om_obj->obj_type = OM_STAX_BUILDER;
+ om_obj->ptr = NULL;
+ reader = (axis2_xml_reader_t *)(om_obj_reader->ptr);
+ builder = axis2_om_stax_builder_create(&env, reader);
+ om_obj->ptr = builder;
+ intern->ptr = om_obj;
+}
+
+PHP_FUNCTION(axis2_om_stax_builder_next)
+{
+ axis2_object_ptr intern = NULL;
+ axis2_object_ptr intern_node = NULL;
+
+ om_object_ptr om_obj = NULL;
+ om_node_ptr node_obj = NULL;
+
+ zval *object = NULL;
+ zval *object_node = NULL;
+
+ axis2_om_stax_builder_t *builder = NULL;
+ axis2_om_node_t *node = NULL;
+ axis2_env_t *env = NULL;
+ int node_type = 0;
+ zend_class_entry *ce_node = NULL;
+
+
+ AXIS2_GET_THIS(object);
+
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+
+ env = php_axis2_get_env();
+
+ builder = (axis2_om_stax_builder_t *)(om_obj->ptr);
+
+
+ if(builder)
+ {
+ node = AXIS2_OM_STAX_BUILDER_NEXT(builder, &env);
+ /*
+ if(node)
+ {
+ node_type = AXIS2_OM_NODE_GET_NODE_TYPE(node, &env);
+ ce_node = php_axis2_get_class_type(node_type);
+ object_node = php_axis2_create_om_node_object(node, node_type, ce_node TSRMLS_CC);
+ RETURN_ZVAL(object_node, NULL, NULL);
+ }
+ */
+
+ }
+
+
+ RETURN_NULL();
+}
+
+PHP_FUNCTION(axis2_om_stax_builder_discard_current_element)
+{
+ php_printf("not implemented yet");
+}
Added: webservices/axis2/trunk/c/bindings/php/axis2/om_text.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_text.c?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_text.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_text.c Sun Dec 4 22:21:44 2005
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_om_node.h"
+#include "axis2_om_text.h"
+
+zend_function_entry php_axis2_om_text_class_functions[] =
+{
+ PHP_FALIAS(getValue, axis2_om_text_get_value, NULL)
+ PHP_FALIAS(setValue, axis2_om_text_get_value, NULL)
+ /* PHP_FALIAS(serialize, axis2_om_text_serialize, NULL) */
+ PHP_ME(om_text, __construct, NULL, ZEND_ACC_PUBLIC)
+ { NULL, NULL, NULL}
+};
+
+
+PHP_METHOD(om_text, __construct)
+{
+ axis2_object_ptr intern = NULL;
+ axis2_object_ptr intern_parent = NULL;
+
+ om_node_ptr node_obj = NULL;
+ om_node_ptr node_obj_parent = NULL;
+
+ zval *object = NULL;
+ zval *object_parent = NULL;
+
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+ int value_len = 0;
+
+ axis2_om_text_t *om_text = NULL;
+ axis2_om_node_t *node = NULL;
+ axis2_om_node_t *node_parent = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "OO!s",&object, axis2_om_text_class_entry, &object_parent,
+ axis2_om_node_class_entry, &value, &value_len) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+
+ intern = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+ node_obj = (om_node_ptr)emalloc(sizeof(om_node_t));
+ node_obj->builder = NULL;
+ node_obj->doc = NULL;
+ node_obj->node_type = OM_ELEMENT;
+
+ if(object_parent)
+ {
+ AXIS2_GET_OBJ(node_obj_parent, object_parent, om_node_ptr, intern_parent);
+ if(node_obj_parent && node_obj_parent->ptr)
+ node_parent = (axis2_om_node_t *)(node_obj_parent->ptr);
+ }
+
+ om_text = axis2_om_text_create(&env, node_parent, value, &node);
+ node_obj->ptr = node;
+ intern->obj_type = OM_NODE_OBJ;
+ intern->ptr = node_obj;
+}
+
+PHP_FUNCTION(axis2_om_text_set_value)
+{
+ axis2_object_ptr intern = NULL;
+ om_node_ptr node_obj = NULL;
+ zval *object = NULL;
+
+ char *value = NULL;
+ int value_len = 0;
+
+ axis2_env_t *env = NULL;
+ axis2_om_text_t *om_text = NULL;
+ axis2_om_node_t *node = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "Os",&object, axis2_om_text_class_entry, &value,
+ &value_len) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+
+ AXIS2_GET_OBJ(node_obj, object, om_node_ptr, intern);
+
+ node = (axis2_om_node_t*)(node_obj->ptr);
+ om_text = (axis2_om_text_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(node , &env);
+ if(om_text)
+ {
+ AXIS2_OM_TEXT_SET_VALUE(om_text, &env, value);
+ }
+}
+
+
+PHP_FUNCTION(axis2_om_text_get_value)
+{
+ axis2_object_ptr intern = NULL;
+ om_node_ptr node_obj = NULL;
+
+ zval *object = NULL;
+
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+ axis2_om_text_t *om_text = NULL;
+ axis2_om_node_t *node = NULL;
+
+ AXIS2_GET_THIS(object);
+
+ env = php_axis2_get_env();
+
+ AXIS2_GET_OBJ(node_obj, object, om_node_ptr, intern);
+ node = (axis2_om_node_t*)(node_obj->ptr);
+ om_text = (axis2_om_text_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(node , &env);
+
+ value = AXIS2_OM_TEXT_GET_VALUE(om_text, &env);
+ if(value)
+ {
+ RETURN_STRING(value, 1);
+ }
+ RETURN_NULL();
+}
+PHP_FUNCTION(axis2_om_text_serialize)
+{
+
+}
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2/output.php
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/output.php?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/output.php (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/output.php Sun Dec 4 22:21:44 2005
@@ -0,0 +1,16 @@
+<?php
+$writer = new Axis2XMLWriter(NULL,1,0);
+$output = new Axis2OMOutput($writer);
+$ns1= new Axis2OMNamespace("http://test.org","testprefix");
+$element = new Axis2OMElement(NULL,"ThisIsATest",$ns1);
+$attr1 = new Axis2OMAttribute("key","value",NULL);
+$element1 = new Axis2OMElement(NULL,"Test1",NULL);
+$element1->addAttribute($attr1);
+$text = new Axis2OMText(NULL,"This is text");
+$element->addChild($text);
+$element->addChild($element1);
+$element->serialize($output);
+echo $writer->getXML();
+
+
+?>
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2/php_axis2.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/php_axis2.h?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/php_axis2.h (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/php_axis2.h Sun Dec 4 22:21:44 2005
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2004 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: header,v 1.15 2004/01/08 16:46:52 sniper Exp $ */
+
+#ifndef PHP_AXIS2_H
+#define PHP_AXIS2_H
+
+extern zend_module_entry axis2_module_entry;
+#define phpext_axis2_ptr &axis2_module_entry
+
+#ifdef PHP_WIN32
+#define PHP_AXIS2_API __declspec(dllexport)
+#else
+#define PHP_AXIS2_API
+#endif
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+#include "axis2_ce.h"
+#include "axis2_fe.h"
+#include "axis2_common.h"
+
+#include <axis2.h>
+#include <axis2_env.h>
+
+PHP_MINIT_FUNCTION(axis2);
+PHP_MSHUTDOWN_FUNCTION(axis2);
+PHP_RINIT_FUNCTION(axis2);
+PHP_RSHUTDOWN_FUNCTION(axis2);
+PHP_MINFO_FUNCTION(axis2);
+
+PHP_FUNCTION(axis2_helloworld); /* For testing, remove later. */
+
+
+
+typedef struct axis2_object{
+ zend_object std;
+ void *ptr;
+ int obj_type;
+ HashTable *prop_handler;
+ zend_object_handle handle;
+ HashTable *node_list;
+}axis2_object;
+
+typedef axis2_object *axis2_object_ptr;
+
+void php_axis2_objects_free_storage(void *object TSRMLS_DC);
+void php_axis2_destroy_env();
+axis2_env_t *php_axis2_get_env();
+zval *php_axis2_create_om_object(void* obj, int obj_type, zend_class_entry *class_type TSRMLS_DC);
+zval *php_axis2_create_om_node_object(void* obj,int node_type, zend_class_entry *class_type TSRMLS_DC);
+void php_axis2_set_object(void *obj,int obj_type, zval *wrapper_in TSRMLS_DC);
+char* php_axis2_stream_to_buffer(php_stream *stream TSRMLS_DC);
+zend_class_entry* php_axis2_get_class_type(int node_type);
+/*
+ Declare any global variables you may need between the BEGIN
+ and END macros here: */
+
+ZEND_BEGIN_MODULE_GLOBALS(axis2)
+ long global_value;
+ char *global_string;
+ axis2_env_t *env;
+ axis2_allocator_t *allocator;
+ZEND_END_MODULE_GLOBALS(axis2)
+
+
+/* In every utility function you add that needs to use variables
+ in php_axis2_globals, call TSRMLS_FETCH(); after declaring other
+ variables used by that function, or better yet, pass in TSRMLS_CC
+ after the last function argument and declare your utility function
+ with TSRMLS_DC after the last declared argument. Always refer to
+ the globals in your function as AXIS2_G(variable). You are
+ encouraged to rename these macros something shorter, see
+ examples in any other php module directory.
+*/
+
+#ifdef ZTS
+#define AXIS2_G(v) TSRMG(axis2_globals_id, zend_axis2_globals *, v)
+#else
+#define AXIS2_G(v) (axis2_globals.v)
+#endif
+
+#endif /* PHP_AXIS2_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
Added: webservices/axis2/trunk/c/bindings/php/axis2/qname.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/qname.c?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/qname.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/qname.c Sun Dec 4 22:21:44 2005
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_qname.h"
+
+zend_function_entry php_axis2_qname_class_functions[]=
+{
+ PHP_FALIAS(equals , axis2_qname_equals, NULL )
+ PHP_FALIAS(clone , axis2_qname_clone, NULL )
+ PHP_FALIAS(getUri , axis2_qname_get_uri, NULL )
+ PHP_FALIAS(getPrefix , axis2_qname_get_prefix, NULL )
+ PHP_FALIAS(getLocalpart , axis2_qname_get_localpart, NULL )
+ PHP_ME(axis2_qname,__construct, NULL, ZEND_ACC_PUBLIC)
+ {NULL , NULL, NULL}
+};
+/* {{{ proto void Axis2Qname::__construct
+ (string localpart,[string namespaceuri], string prefix)
+*/
+PHP_METHOD(axis2_qname, __construct)
+{
+ axis2_object_ptr intern = NULL;
+ zval *object = NULL;
+ om_object_ptr om_obj = NULL;
+ axis2_env_t *env = NULL;
+ char *lpart = NULL;
+ int lpart_len = 0;
+ char *ns_uri = NULL;
+ int urilen = 0;
+ char *prefix = NULL;
+ int prefixlen = 0;
+ axis2_qname_t *qname = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "Oss!s",&object, axis2_qname_class_entry ,&lpart, &lpart_len, &ns_uri, &urilen,
+ &prefix, &prefixlen) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+
+ env = php_axis2_get_env();
+ intern = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+ om_obj = (om_object_ptr)emalloc(sizeof(om_object));
+ om_obj->obj_type = AXIS2_QNAME;
+
+ qname = axis2_qname_create(&env, lpart, ns_uri, prefix);
+ om_obj->ptr = qname;
+ intern->ptr = om_obj;
+ intern->obj_type = OM_OBJ;
+}
+/* }}} end Axis2Qname::_construct */
+
+/* {{{ proto string getUri */
+PHP_FUNCTION(axis2_qname_get_uri)
+{
+ axis2_object_ptr intern = NULL;
+ zval *object = NULL;
+ om_object_ptr om_obj = NULL;
+ axis2_env_t *env = NULL;
+ axis2_qname_t *qname = NULL;
+ char *uri;
+
+ env = php_axis2_get_env();
+ AXIS2_GET_THIS(object);
+
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+
+ qname = (axis2_qname_t *)(om_obj->ptr);
+
+ if(qname)
+ {
+ uri = AXIS2_QNAME_GET_URI(qname, &env);
+ RETURN_STRING(uri, 1);
+ }
+ RETURN_NULL();
+}
+
+/* }}} end getUri */
+
+/* {{{ proto string getPrefix */
+PHP_FUNCTION(axis2_qname_get_prefix)
+{
+ axis2_object_ptr intern = NULL;
+ zval *object = NULL;
+ om_object_ptr om_obj = NULL;
+ axis2_env_t *env = NULL;
+ axis2_qname_t *qname = NULL;
+ char *prefix;
+
+ env = php_axis2_get_env();
+ AXIS2_GET_THIS(object);
+
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+
+ qname = (axis2_qname_t *)(om_obj->ptr);
+
+ if(qname)
+ {
+ prefix = AXIS2_QNAME_GET_PREFIX(qname, &env);
+ RETURN_STRING(prefix, 1);
+ }
+ RETURN_NULL();
+}
+/* }}} end getPrefix */
+
+/* {{{ proto string getLocalpart */
+PHP_FUNCTION(axis2_qname_get_localpart)
+{
+ axis2_object_ptr intern = NULL;
+ zval *object = NULL;
+ om_object_ptr om_obj = NULL;
+ axis2_env_t *env = NULL;
+ axis2_qname_t *qname = NULL;
+ char *localname;
+
+ env = php_axis2_get_env();
+ AXIS2_GET_THIS(object);
+
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+
+ qname = (axis2_qname_t *)(om_obj->ptr);
+
+ if(qname)
+ {
+ localname = AXIS2_QNAME_GET_PREFIX(qname, &env);
+ RETURN_STRING(localname, 1);
+ }
+ RETURN_NULL();
+}
+
+/* }}} end getLocalpart */
+
+/* {{{ proto void equals */
+PHP_FUNCTION(axis2_qname_equals)
+{
+ axis2_object_ptr intern= NULL;
+ axis2_object_ptr intern_cmp = NULL;
+ zval *object = NULL;
+ zval *object_cmp = NULL;
+ om_object_ptr om_qname = NULL;
+ om_object_ptr om_qname_cmp = NULL;
+ axis2_env_t *env = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_qname_t *qname_cmp = NULL;
+ axis2_bool_t equals = AXIS2_FALSE;
+
+ env = php_axis2_get_env();
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "OO",&object, axis2_qname_class_entry ,
+ &object_cmp, axis2_qname_class_entry) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+
+ AXIS2_GET_OBJ(om_qname, object, om_object_ptr, intern);
+ AXIS2_GET_OBJ(om_qname_cmp, object_cmp, om_object_ptr, intern_cmp);
+
+ qname = (axis2_qname_t *)(om_qname->ptr);
+ qname_cmp = (axis2_qname_t *)(om_qname_cmp->ptr);
+
+ equals = AXIS2_QNAME_EQUALS(qname, &env, qname_cmp);
+
+ if(equals == AXIS2_TRUE)
+ {
+ RETURN_BOOL(1);
+ }
+ if(equals == AXIS2_FALSE)
+ {
+ RETURN_BOOL(0);
+ }
+
+}
+/* }}} end equals */
+
+PHP_FUNCTION(axis2_qname_clone)
+{
+ php_printf("not implemented");
+}
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2/tests/001.phpt
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/tests/001.phpt?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/tests/001.phpt (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/tests/001.phpt Sun Dec 4 22:21:44 2005
@@ -0,0 +1,21 @@
+--TEST--
+Check for axis2 presence
+--SKIPIF--
+<?php if (!extension_loaded("axis2")) print "skip"; ?>
+--FILE--
+<?php
+echo "axis2 extension is available";
+/*
+ you can add regression tests for your extension here
+
+ the output of your test code has to be equal to the
+ text in the --EXPECT-- section below for the tests
+ to pass, differences between the output and the
+ expected text are interpreted as failure
+
+ see php5/README.TESTING for further information on
+ writing regression tests
+*/
+?>
+--EXPECT--
+axis2 extension is available
Added: webservices/axis2/trunk/c/bindings/php/axis2/xml_reader.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/xml_reader.c?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/xml_reader.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/xml_reader.c Sun Dec 4 22:21:44 2005
@@ -0,0 +1,433 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_xml_reader.h"
+
+zend_function_entry php_axis2_xml_reader_class_functions[]=
+{
+ PHP_FALIAS(next, axis2_xml_reader_next, NULL)
+ PHP_FALIAS(getAttributeCount, axis2_xml_reader_get_attribute_count, NULL)
+ PHP_FALIAS(getAttributeName , axis2_xml_reader_get_attribute_name_by_number, NULL)
+ PHP_FALIAS(getAttributePrefix, axis2_xml_reader_get_attribute_prefix_by_number, NULL)
+ PHP_FALIAS(getAttributeNamespace, axis2_xml_reader_get_attribute_namespace_by_number, NULL)
+ PHP_FALIAS(getAttributeValue, axis2_xml_reader_get_attribute_value_by_number, NULL)
+ PHP_FALIAS(getName, axis2_xml_reader_get_name, NULL)
+ PHP_FALIAS(getValue, axis2_xml_reader_get_value, NULL)
+ PHP_FALIAS(getPrefix, axis2_xml_reader_get_prefix, NULL)
+ PHP_FALIAS(getNamespaceCount, axis2_xml_reader_get_namespace_count, NULL)
+ PHP_FALIAS(getNamespaceUri, axis2_xml_reader_get_namespace_uri_by_number, NULL)
+ PHP_FALIAS(getNamespacePrefix, axis2_xml_reader_get_namespace_prefix_by_number, NULL)
+ PHP_FALIAS(getPITarget , axis2_xml_reader_get_pi_target, NULL)
+ PHP_FALIAS(getPIData, axis2_xml_reader_get_pi_data, NULL)
+ PHP_ME(xml_reader, __construct, NULL, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}
+};
+
+PHP_METHOD(xml_reader , __construct)
+{
+ zval *object = NULL;
+ axis2_object_ptr axis2_obj = NULL;
+ om_object_ptr om_obj = NULL;
+ char *path;
+ int length;
+ axis2_env_t *env;
+
+
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, axis2_xml_reader_class_entry, &path, &length) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+
+ om_obj = emalloc(sizeof(om_object));
+ om_obj->ptr = NULL;
+ om_obj->obj_type = AXIS2_XML_READER;
+ om_obj->ptr = axis2_xml_reader_create_for_file(&env, path, NULL);
+ om_obj->ref_count = 1;
+
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+ axis2_obj->ptr = om_obj;
+
+}
+
+PHP_FUNCTION(axis2_xml_reader_next)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ long i = 0;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ i = AXIS2_XML_READER_NEXT(reader, &env);
+ RETURN_LONG(i);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_count)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ int i = 0;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ i = AXIS2_XML_READER_GET_ATTRIBUTE_COUNT(reader, &env);
+ RETURN_LONG(i);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_name_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_name = NULL;
+ char *name;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_name = AXIS2_XML_READER_GET_ATTRIBUTE_NAME_BY_NUMBER(reader, &env, i);
+ if(!attr_name)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ name = estrdup(attr_name);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_name);
+ }
+ RETURN_STRING(name, 0);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_prefix_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_prefix = NULL;
+ char *prefix;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_prefix = AXIS2_XML_READER_GET_ATTRIBUTE_PREFIX_BY_NUMBER(reader, &env, i);
+ if(!attr_prefix)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ prefix = estrdup(attr_prefix);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_prefix);
+ }
+ RETURN_STRING(prefix, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_namespace_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_ns_uri = NULL;
+ char *uri;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_ns_uri = AXIS2_XML_READER_GET_ATTRIBUTE_NAMESPACE_BY_NUMBER(reader, &env, i);
+ if(!attr_ns_uri)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ uri = estrdup(attr_ns_uri);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_ns_uri);
+ }
+ RETURN_STRING(uri, 0);
+}
+PHP_FUNCTION(axis2_xml_reader_get_attribute_value_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *attr_value = NULL;
+ char *value;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ attr_value = AXIS2_XML_READER_GET_ATTRIBUTE_VALUE_BY_NUMBER(reader, &env, i);
+ if(!attr_value)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ value = estrdup(attr_value);
+ AXIS2_XML_READER_XML_FREE(reader, &env, attr_value);
+ }
+ RETURN_STRING(value, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_name)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *name = NULL;
+ char *na = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ name = AXIS2_XML_READER_GET_NAME(reader, &env);
+ if(!name)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ na = estrdup(name);
+ if(name)
+ AXIS2_XML_READER_XML_FREE(reader, &env, name);
+ }
+ RETURN_STRING(na, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_value)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *value = NULL;
+ char *val = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ value = AXIS2_XML_READER_GET_VALUE(reader, &env);
+ if(!value)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ val = estrdup(value);
+ if(value)
+ AXIS2_XML_READER_XML_FREE(reader, &env, value);
+ }
+ RETURN_STRING(val, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_prefix)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *prefix = NULL;
+ char *pre = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ prefix = AXIS2_XML_READER_GET_PREFIX(reader, &env);
+ if(!prefix)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ pre = estrdup(prefix);
+ if(prefix)
+ AXIS2_XML_READER_XML_FREE(reader, &env, prefix);
+ }
+ RETURN_STRING(pre, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_namespace_count)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ long i =0;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ i = AXIS2_XML_READER_GET_NAMESPACE_COUNT(reader, &env);
+ RETURN_LONG(i);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_namespace_uri_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *ns_uri = NULL;
+ char *uri = NULL;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ ns_uri = AXIS2_XML_READER_GET_NAMESPACE_URI_BY_NUMBER(reader, &env, i);
+ if(!ns_uri)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ uri = estrdup(ns_uri);
+ AXIS2_XML_READER_XML_FREE(reader, &env, ns_uri);
+ }
+ RETURN_STRING(uri, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_namespace_prefix_by_number)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *ns_prefix = NULL;
+ char *prefix = NULL;
+ long i = 0;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &obj, axis2_xml_reader_class_entry, &i) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ ns_prefix = AXIS2_XML_READER_GET_NAMESPACE_PREFIX_BY_NUMBER(reader, &env, i);
+ if(!ns_prefix)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ prefix = estrdup(ns_prefix);
+ AXIS2_XML_READER_XML_FREE(reader, &env, ns_prefix);
+ }
+ RETURN_STRING(prefix, 0);
+}
+PHP_FUNCTION(axis2_xml_reader_get_pi_target)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *pi_target = NULL;
+ char *target = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ pi_target = AXIS2_XML_READER_GET_PI_TARGET(reader, &env);
+ if(!pi_target)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ target = estrdup(pi_target);
+ if(pi_target)
+ AXIS2_XML_READER_XML_FREE(reader, &env, pi_target);
+ }
+ RETURN_STRING(target, 0);
+
+}
+PHP_FUNCTION(axis2_xml_reader_get_pi_data)
+{
+ axis2_object_ptr axis2_obj = NULL;
+ zval *obj = NULL;
+ axis2_xml_reader_t *reader = NULL;
+ axis2_env_t *env = NULL;
+ char *pi_data = NULL;
+ char *data = NULL;
+
+ obj = getThis();
+ env = php_axis2_get_env();
+ axis2_obj = (axis2_object_ptr)zend_object_store_get_object(obj TSRMLS_CC);
+ reader =(axis2_xml_reader_t*) (((om_object_ptr)(axis2_obj->ptr))->ptr);
+ pi_data = AXIS2_XML_READER_GET_PI_DATA(reader, &env);
+ if(!pi_data)
+ {
+ RETURN_NULL();
+ }
+ else
+ {
+ data = estrdup(pi_data);
+ if(pi_data)
+ AXIS2_XML_READER_XML_FREE(reader, &env, pi_data);
+ }
+ RETURN_STRING(data, 0);
+}
\ No newline at end of file
Added: webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c?rev=353997&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c Sun Dec 4 22:21:44 2005
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "php.h"
+#include "php_axis2.h"
+#include "axis2_xml_writer.h"
+
+
+zend_function_entry php_axis2_xml_writer_class_functions[]=
+{
+ PHP_FALIAS(writeStartElementWithNamespace, axis2_xml_writer_write_start_element_with_namespace, NULL)
+ PHP_FALIAS(endStartElement, axis2_xml_writer_end_start_element, NULL)
+ PHP_FALIAS(getXML, axis2_xml_writer_get_xml, NULL)
+ PHP_FALIAS(writeStartElement, axis2_xml_writer_write_start_element, NULL)
+ PHP_FALIAS(writeEndElement, axis2_xml_writer_write_end_element, NULL)
+ PHP_ME(axis2_xml_writer, __construct, NULL, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}
+};
+
+
+/**
+ PHP_FALIAS(writeEmptyElement, axis2_xml_writer_write_empty_element, NULL)
+ PHP_FALIAS(writeEmptyElementWithNamespace, axis2_xml_writer_write_empty_element_with_namespace, NULL)
+ PHP_FALIAS(writeEmptyElementWithNamespacePrefix, axis2_xml_writer_write_empty_element_with_namespace_prefix, NULL)
+
+ PHP_FALIAS(writeEndDocument, axis2_xml_writer_write_end_document, NULL)
+ PHP_FALIAS(writeAttribute, axis2_xml_writer_write_attribute, NULL)
+ PHP_FALIAS(writeAttributeWithNamespace, axis2_xml_writer_write_attribute_with_namespace, NULL)
+ PHP_FALIAS(writeAttributeWithNamespacePrefix, axis2_xml_writer_write_attribute_with_namespace_prefix, NULL)
+ PHP_FALIAS(writeNamespace, axis2_xml_writer_write_namespace, NULL)
+ PHP_FALIAS(writeComment, axis2_xml_writer_write_comment, NULL)
+ PHP_FALIAS(writeProcessingInstruction, axis2_xml_writer_write_processing_instruction, NULL)
+ PHP_FALIAS(writeProcessingInstructionData, axis2_xml_writer_write_processing_instruction_data, NULL)
+ PHP_FALIAS(writeStartDocument, axis2_xml_writer_write_start_document, NULL)
+ PHP_FALIAS(writeStartDocumentWithVersion, axis2_xml_writer_write_start_document_with_version, NULL)
+ PHP_FALIAS(writeStartDocumentWithVersionEncoding, axis2_xml_writer_write_start_document_with_version_encoding, NULL)
+
+
+ PHP_FALIAS(writeCharacters, axis2_xml_writer_write_characters, NULL)
+
+
+
+ PHP_FALIAS(writeStartElementNSPrefix, axis2_xml_writer_write_start_element_with_namespace_prefix, NULL)
+
+*/
+
+
+PHP_METHOD(axis2_xml_writer, __construct)
+{
+ axis2_object_ptr intern = NULL;
+ zval *object = NULL;
+ om_object_ptr om_obj = NULL;
+ axis2_env_t *env = NULL;
+ char *encoding = NULL;
+ int enc_len = 0;
+ int pdef = 0;
+ int cmp = 0;
+ axis2_xml_writer_t *writer = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "Os!ll",&object, axis2_xml_writer_class_entry, &encoding, &enc_len,&pdef, &cmp) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ intern = (axis2_object_ptr)zend_object_store_get_object(object TSRMLS_CC);
+ om_obj = (om_object_ptr)emalloc(sizeof(om_object));
+
+ om_obj->obj_type = AXIS2_XML_WRITER;
+
+ om_obj->ptr = NULL;
+
+ writer = axis2_xml_writer_create_for_memory (&env,encoding, pdef, cmp);
+
+ if(!writer)
+ {
+ php_error_docref(NULL TSRMLS_CC, E_OUTOFMEMORY, " writer create failure ");
+ }
+
+ om_obj->ptr = writer;
+ intern->obj_type = OM_OBJ;
+ intern->ptr = om_obj;
+}
+
+PHP_FUNCTION(axis2_xml_writer_write_start_element)
+{
+ axis2_object_ptr intern = NULL;
+ om_object_ptr om_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ char *lname = NULL;
+ int lname_len = 0;
+ axis2_xml_writer_t *writer = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "Os",&object, axis2_xml_writer_class_entry ,&lname, &lname_len) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+ env = php_axis2_get_env();
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+ writer = (axis2_xml_writer_t *)(om_obj->ptr);
+ AXIS2_XML_WRITER_WRITE_START_ELEMENT(writer, &env, lname);
+}
+
+PHP_FUNCTION(axis2_xml_writer_end_start_element)
+{
+ axis2_object_ptr intern = NULL;
+ om_object_ptr om_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ axis2_xml_writer_t *writer = NULL;
+
+ env = php_axis2_get_env();
+ AXIS2_GET_THIS(object);
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+ writer = (axis2_xml_writer_t *)(om_obj->ptr);
+ AXIS2_XML_WRITER_END_START_ELEMENT(writer, &env);
+}
+
+PHP_FUNCTION(axis2_xml_writer_write_end_element)
+{
+ axis2_object_ptr intern = NULL;
+ om_object_ptr om_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ axis2_xml_writer_t *writer = NULL;
+
+ env = php_axis2_get_env();
+ AXIS2_GET_THIS(object);
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+ writer = (axis2_xml_writer_t *)(om_obj->ptr);
+ AXIS2_XML_WRITER_WRITE_END_ELEMENT(writer, &env);
+}
+PHP_FUNCTION(axis2_xml_writer_write_start_element_with_namespace)
+{
+ axis2_object_ptr intern = NULL;
+ om_object_ptr om_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+
+ char *lname = NULL;
+ int lname_len = 0;
+ char *uri = NULL;
+ int uri_len = 0;
+
+ axis2_xml_writer_t *writer = NULL;
+
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ getThis(), "Oss",&object, axis2_xml_writer_class_entry , &lname, &lname_len, &uri, &uri_len) == FAILURE)
+ {
+ php_std_error_handling();
+ return;
+ }
+
+ env = php_axis2_get_env();
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+ writer = (axis2_xml_writer_t *)(om_obj->ptr);
+ AXIS2_XML_WRITER_WRITE_START_ELEMENT_WITH_NAMESPACE(writer, &env, lname, uri);
+
+}
+PHP_FUNCTION(axis2_xml_writer_write_start_element_with_namespace_prefix){}
+
+PHP_FUNCTION(axis2_xml_writer_write_end_document){}
+PHP_FUNCTION(axis2_xml_writer_write_attribute){}
+PHP_FUNCTION(axis2_xml_writer_write_attribute_with_namespace){}
+PHP_FUNCTION(axis2_xml_writer_write_attribute_with_namespace_prefix){}
+PHP_FUNCTION(axis2_xml_writer_write_namespace){}
+PHP_FUNCTION(axis2_xml_writer_write_default_namespace){}
+PHP_FUNCTION(axis2_xml_writer_write_comment){}
+PHP_FUNCTION(axis2_xml_writer_write_processing_instruction){}
+PHP_FUNCTION(axis2_xml_writer_write_processing_instruction_data){}
+PHP_FUNCTION(axis2_xml_writer_write_cdata){}
+PHP_FUNCTION(axis2_xml_writer_write_dtd){}
+PHP_FUNCTION(axis2_xml_writer_write_entity_ref){}
+PHP_FUNCTION(axis2_xml_writer_write_start_document){}
+PHP_FUNCTION(axis2_xml_writer_write_start_document_with_version){}
+PHP_FUNCTION(axis2_xml_writer_write_start_document_with_version_encoding){}
+PHP_FUNCTION(axis2_xml_writer_write_characters){}
+PHP_FUNCTION(axis2_xml_writer_get_prefix){}
+PHP_FUNCTION(axis2_xml_writer_set_prefix){}
+PHP_FUNCTION(axis2_xml_writer_set_default_prefix){}
+PHP_FUNCTION(axis2_xml_writer_write_encoded){}
+
+
+PHP_FUNCTION(axis2_xml_writer_write_empty_element){}
+PHP_FUNCTION(axis2_xml_writer_write_empty_element_with_namespace){}
+PHP_FUNCTION(axis2_xml_writer_write_empty_element_with_namespace_prefix){}
+
+PHP_FUNCTION(axis2_xml_writer_get_xml)
+{
+ axis2_object_ptr intern = NULL;
+ om_object_ptr om_obj = NULL;
+ zval *object = NULL;
+ axis2_env_t *env = NULL;
+ axis2_xml_writer_t *writer = NULL;
+ char *output = NULL;
+
+ env = php_axis2_get_env();
+
+ AXIS2_GET_THIS(object);
+ AXIS2_GET_OBJ(om_obj, object, om_object_ptr, intern);
+
+ writer = (axis2_xml_writer_t *)(om_obj->ptr);
+ output = AXIS2_XML_WRITER_GET_XML(writer, &env);
+ if(output)
+ {
+ RETURN_STRING(output, 1);
+ }
+ RETURN_NULL();
+}
\ No newline at end of file