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 11:15:55 UTC

svn commit: r354035 - in /webservices/axis2/trunk/c/bindings/php/axis2: axis2.c om_attribute.c om_document.c om_element.c om_namespace.c output.php tests/001.phpt tests/build_from_file.php tests/build_programatically.php tests/sample.php xml_writer.c

Author: samisa
Date: Mon Dec  5 02:15:33 2005
New Revision: 354035

URL: http://svn.apache.org/viewcvs?rev=354035&view=rev
Log:
tests added 

Added:
    webservices/axis2/trunk/c/bindings/php/axis2/tests/build_from_file.php
    webservices/axis2/trunk/c/bindings/php/axis2/tests/build_programatically.php
Removed:
    webservices/axis2/trunk/c/bindings/php/axis2/output.php
    webservices/axis2/trunk/c/bindings/php/axis2/tests/001.phpt
    webservices/axis2/trunk/c/bindings/php/axis2/tests/sample.php
Modified:
    webservices/axis2/trunk/c/bindings/php/axis2/axis2.c
    webservices/axis2/trunk/c/bindings/php/axis2/om_attribute.c
    webservices/axis2/trunk/c/bindings/php/axis2/om_document.c
    webservices/axis2/trunk/c/bindings/php/axis2/om_element.c
    webservices/axis2/trunk/c/bindings/php/axis2/om_namespace.c
    webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c

Modified: webservices/axis2/trunk/c/bindings/php/axis2/axis2.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/axis2.c?rev=354035&r1=354034&r2=354035&view=diff
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/axis2.c (original)
+++ webservices/axis2/trunk/c/bindings/php/axis2/axis2.c Mon Dec  5 02:15:33 2005
@@ -187,6 +187,12 @@
     REGISTER_LONG_CONSTANT("AXIS2_XML_READER_CDATA",	        AXIS2_XML_READER_CDATA,		CONST_CS | CONST_PERSISTENT);
     REGISTER_LONG_CONSTANT("AXIS2_XML_READER_DOCUMENT_TYPE",	AXIS2_XML_READER_DOCUMENT_TYPE,		CONST_CS | CONST_PERSISTENT);
     
+    REGISTER_LONG_CONSTANT("AXIS2_OM_ELEMENT",	OM_ELEMENT,		CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("AXIS2_OM_TEXT",	    OM_TEXT,		CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("AXIS2_OM_PI",	    OM_PI,		CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("AXIS2_OM_DOCTYPE",	OM_DOCTYPE,		CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("AXIS2_OM_COMMENT",	OM_COMMENT,		CONST_CS | CONST_PERSISTENT);
+    REGISTER_LONG_CONSTANT("AXIS2_OM_DOCUMENT",	OM_DOCUMENT,		CONST_CS | CONST_PERSISTENT);
     	
 	
 	return SUCCESS;

Modified: webservices/axis2/trunk/c/bindings/php/axis2/om_attribute.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_attribute.c?rev=354035&r1=354034&r2=354035&view=diff
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_attribute.c (original)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_attribute.c Mon Dec  5 02:15:33 2005
@@ -95,7 +95,8 @@
     if(attr)
     {
        lname = AXIS2_OM_ATTRIBUTE_GET_LOCALNAME(attr, &env);
-       RETURN_STRING(lname, 1);     
+       if(lname)
+            RETURN_STRING(lname, 1);     
     }
     RETURN_NULL();
 }

Modified: webservices/axis2/trunk/c/bindings/php/axis2/om_document.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_document.c?rev=354035&r1=354034&r2=354035&view=diff
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_document.c (original)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_document.c Mon Dec  5 02:15:33 2005
@@ -171,7 +171,7 @@
 
 PHP_FUNCTION(axis2_om_document_set_root_element)
 {
-    php_printf("not implemented yet");
+    
 }
 PHP_FUNCTION(axis2_om_document_build_all)
 {

Modified: webservices/axis2/trunk/c/bindings/php/axis2/om_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_element.c?rev=354035&r1=354034&r2=354035&view=diff
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_element.c (original)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_element.c Mon Dec  5 02:15:33 2005
@@ -307,16 +307,16 @@
 
 
 PHP_FUNCTION(axis2_om_element_serialize)
-{
-
-}
+{}
 
 
 PHP_FUNCTION(axis2_om_element_find_namespace)
 {}
+
 PHP_FUNCTION(axis2_om_element_declare_namespace)
 {}
 
 PHP_FUNCTION(axis2_om_element_find_namespace_with_qname)
 {}
+
 PHP_FUNCTION(axis2_om_element_find_declared_namespace){}

Modified: webservices/axis2/trunk/c/bindings/php/axis2/om_namespace.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/om_namespace.c?rev=354035&r1=354034&r2=354035&view=diff
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/om_namespace.c (original)
+++ webservices/axis2/trunk/c/bindings/php/axis2/om_namespace.c Mon Dec  5 02:15:33 2005
@@ -132,7 +132,8 @@
     if(ns)
     {
        uri = AXIS2_OM_NAMESPACE_GET_URI(ns, &env);
-       RETURN_STRING(uri, 1);     
+       if(uri)
+            RETURN_STRING(uri, 1);     
     }
     RETURN_NULL();
 }
@@ -145,7 +146,7 @@
     om_object_ptr om_obj = NULL;
     axis2_env_t *env = NULL;
     axis2_om_namespace_t *ns = NULL;
-    char *prefix;
+    char *prefix = NULL;
     
     env = php_axis2_get_env();
     AXIS2_GET_THIS(object);
@@ -157,7 +158,8 @@
     if(ns)
     {
        prefix = AXIS2_OM_NAMESPACE_GET_PREFIX(ns, &env);
-       RETURN_STRING(prefix, 1);     
+       if(prefix)
+            RETURN_STRING(prefix, 1);     
     }
     RETURN_NULL();
 }

Added: webservices/axis2/trunk/c/bindings/php/axis2/tests/build_from_file.php
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/tests/build_from_file.php?rev=354035&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/tests/build_from_file.php (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/tests/build_from_file.php Mon Dec  5 02:15:33 2005
@@ -0,0 +1,68 @@
+<!--
+/*
+ *   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
+$reader  = new Axis2XMLReader("test.xml");
+$builder = new Axis2OMBuilder($reader);
+$doc     = new Axis2OMDocument(NULL,$builder);
+$root    = $doc->getRootElement();
+if($root)
+{
+	echo "\n\n\nlocalname \t";
+	echo $root->getLocalname();
+	$ns = $root->getNamespace();
+	echo "\n";
+	if($ns)
+	{
+		echo "uri \n";
+		echo $ns->getUri();
+		echo "\n";
+		echo $ns->getPrefix();
+		echo "\n";
+	}
+}
+
+$node = $doc->buildNext();
+do{
+	if($node == NULL)
+		break;	
+	
+	if($node->getNodeType() == AXIS2_OM_ELEMENT)
+	{
+		echo $node->getLocalname();
+		echo "\n";
+		
+	}
+	if($node->getNodeType() == AXIS2_OM_TEXT)
+	{
+		echo "text value  \t";
+		echo $node->getValue();
+		echo "\n";
+	}
+	
+	$node = $doc->buildNext();
+		
+ }while($node);
+
+$writer = new Axis2XMLWriter(NULL, 1, 0);
+$output = new Axis2OMOutput($writer);
+$root->serialize($output);
+echo "\n\n__________serialized output of xml file \n\n";
+echo $writer->getXML();
+echo "\n\n";
+?>
\ No newline at end of file

Added: webservices/axis2/trunk/c/bindings/php/axis2/tests/build_programatically.php
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/bindings/php/axis2/tests/build_programatically.php?rev=354035&view=auto
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/tests/build_programatically.php (added)
+++ webservices/axis2/trunk/c/bindings/php/axis2/tests/build_programatically.php Mon Dec  5 02:15:33 2005
@@ -0,0 +1,36 @@
+<!--
+/*
+ *   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
+
+$ns1 = new Axis2OMNamespace("http://ws.apache.org","axiom");
+$ns2 = new Axis2OMNamespace("urn:ISBN:0-395-74341-6","isbn");
+
+$ele1  = new Axis2OMElement(NULL,"book",$ns1);
+$ele2  = new Axis2OMElement($ele1,"title",$ns1);
+$text1 = new Axis2OMText($ele2, "Axis2/C OM HOWTO");
+$ele4  = new Axis2OMElement($ele1, "number", $ns2);
+$text  = new Axis2OMText($ele4,"1748491379");
+
+ 
+$writer = new Axis2XMLWriter(NULL,1,0);
+$output = new Axis2OMOutput($writer);
+$ele1->serialize($output);
+echo $writer->getXML();
+?>
\ No newline at end of file

Modified: 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=354035&r1=354034&r2=354035&view=diff
==============================================================================
--- webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c (original)
+++ webservices/axis2/trunk/c/bindings/php/axis2/xml_writer.c Mon Dec  5 02:15:33 2005
@@ -197,8 +197,6 @@
 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){}