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 na...@apache.org on 2006/06/21 09:08:41 UTC

svn commit: r415931 - in /webservices/axis2/trunk/c/xml_schema: include/ samples/ src/

Author: nandika
Date: Wed Jun 21 00:08:40 2006
New Revision: 415931

URL: http://svn.apache.org/viewvc?rev=415931&view=rev
Log:
serialize function added 

Modified:
    webservices/axis2/trunk/c/xml_schema/include/xml_schema.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_annotation.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_any.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_any_attribute.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_app_info.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group_ref.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_builder.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_complex_type.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_processing.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_type.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema_derivation_method.h
    webservices/axis2/trunk/c/xml_schema/samples/test_schema.c
    webservices/axis2/trunk/c/xml_schema/src/xml_schema.c
    webservices/axis2/trunk/c/xml_schema/src/xml_schema_builder.c

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema.h Wed Jun 21 00:08:40 2006
@@ -36,6 +36,13 @@
   * @{
   */
 
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 typedef struct xml_schema xml_schema_t;
 typedef struct xml_schema_ops xml_schema_ops_t;
 struct xml_schema_form;
@@ -48,11 +55,6 @@
 
 #define XML_SCHEMA_NS "http://www.w3.org/2001/XMLSchema"
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 struct xml_schema_ops
 {
    /** 
@@ -237,8 +239,19 @@
     set_schema_ns_prefix)(
             void *schema,
             const axis2_env_t *env,
-            axis2_char_t *ns_prefix);                    
-
+            axis2_char_t *ns_prefix);
+            
+    axis2_char_t* (AXIS2_CALL*
+    serialize)(
+            void *schema,
+            const axis2_env_t *env);
+            
+    axis2_status_t (AXIS2_CALL*
+    set_root_node)(
+            void *schema,
+            const axis2_env_t *env,
+            axiom_node_t *node);            
+            
 };
 
 struct xml_schema
@@ -393,8 +406,14 @@
         (((xml_schema_t *) schema)->ops->\
             set_schema_ns_prefix(schema, env, ns_prefix))
             
-                                        
-                                              
+#define XML_SCHEMA_SERIALIZE(schema, env) \
+        (((xml_schema_t *) schema)->ops->\
+            serialize(schema, env))                                              
+                      
+#define XML_SCHEMA_SET_ROOT_NODE(schema, env, root_node) \
+        (((xml_schema_t *) schema)->ops->\
+            set_root_node(schema, env, root_node))
+                                  
                       
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_annotation.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_annotation.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_annotation.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_annotation.h Wed Jun 21 00:08:40 2006
@@ -32,13 +32,15 @@
   * @{
   */
 
-typedef struct xml_schema_annotation xml_schema_annotation_t;
-typedef struct xml_schema_annotation_ops xml_schema_annotation_ops_t;
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+typedef struct xml_schema_annotation xml_schema_annotation_t;
+typedef struct xml_schema_annotation_ops xml_schema_annotation_ops_t;
+
 
 struct xml_schema_annotation_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_any.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_any.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_any.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_any.h Wed Jun 21 00:08:40 2006
@@ -30,6 +30,12 @@
 #include <xml_schema_particle.h>
 #include <xml_schema_content_processing.h>
 
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /** @defgroup xml_schema_any Xml Schema Any
   * @ingroup xml_schema
   * @{
@@ -39,10 +45,6 @@
 typedef struct xml_schema_any_ops xml_schema_any_ops_t;
 struct xml_schema_content_processing_t;
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 
 struct xml_schema_any_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_any_attribute.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_any_attribute.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_any_attribute.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_any_attribute.h Wed Jun 21 00:08:40 2006
@@ -34,15 +34,17 @@
   * @{
   */
 
-typedef struct xml_schema_any_attribute 
-                    xml_schema_any_attribute_t;
-typedef struct xml_schema_any_attribute_ops 
-                xml_schema_any_attribute_ops_t;
+
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+typedef struct xml_schema_any_attribute 
+                    xml_schema_any_attribute_t;
+typedef struct xml_schema_any_attribute_ops 
+                xml_schema_any_attribute_ops_t;
 
 struct xml_schema_any_attribute_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_app_info.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_app_info.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_app_info.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_app_info.h Wed Jun 21 00:08:40 2006
@@ -34,13 +34,15 @@
   * @{
   */
 
-typedef struct xml_schema_app_info xml_schema_app_info_t;
-typedef struct xml_schema_app_info_ops xml_schema_app_info_ops_t;
+
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+typedef struct xml_schema_app_info xml_schema_app_info_t;
+typedef struct xml_schema_app_info_ops xml_schema_app_info_ops_t;
 
 struct xml_schema_app_info_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute.h Wed Jun 21 00:08:40 2006
@@ -38,15 +38,17 @@
   * @{
   */
 
-typedef struct xml_schema_attribute 
-                    xml_schema_attribute_t;
-typedef struct xml_schema_attribute_ops 
-                xml_schema_attribute_ops_t;
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+
+typedef struct xml_schema_attribute 
+                    xml_schema_attribute_t;
+typedef struct xml_schema_attribute_ops 
+                xml_schema_attribute_ops_t;
 
 struct xml_schema_attribute_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group.h Wed Jun 21 00:08:40 2006
@@ -38,16 +38,19 @@
   * @{
   */
 
-typedef struct xml_schema_attribute_group 
-                    xml_schema_attribute_group_t;
-typedef struct xml_schema_attribute_group_ops 
-                xml_schema_attribute_group_ops_t;
+
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
+typedef struct xml_schema_attribute_group 
+                    xml_schema_attribute_group_t;
+typedef struct xml_schema_attribute_group_ops 
+                xml_schema_attribute_group_ops_t;
+                
+                
 struct xml_schema_attribute_group_ops
 {
     axis2_status_t (AXIS2_CALL *

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group_ref.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group_ref.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group_ref.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_attribute_group_ref.h Wed Jun 21 00:08:40 2006
@@ -38,15 +38,17 @@
   * @{
   */
 
-typedef struct xml_schema_attribute_group_ref 
-                    xml_schema_attribute_group_ref_t;
-typedef struct xml_schema_attribute_group_ref_ops 
-                xml_schema_attribute_group_ref_ops_t;
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+
+typedef struct xml_schema_attribute_group_ref 
+                    xml_schema_attribute_group_ref_t;
+typedef struct xml_schema_attribute_group_ref_ops 
+                xml_schema_attribute_group_ref_ops_t;
 
 struct xml_schema_attribute_group_ref_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_builder.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_builder.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_builder.h Wed Jun 21 00:08:40 2006
@@ -37,6 +37,14 @@
   * @{
   */
 
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+
 typedef struct xml_schema_builder 
                     xml_schema_builder_t;
 typedef struct xml_schema_builder_ops 
@@ -44,10 +52,6 @@
 
 #define XML_SCHEMA_NS "http://www.w3.org/2001/XMLSchema"
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 
 struct xml_schema_builder_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_complex_type.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_complex_type.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_complex_type.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_complex_type.h Wed Jun 21 00:08:40 2006
@@ -33,6 +33,12 @@
 #include <xml_schema_obj_table.h>
 #include <xml_schema_derivation_method.h>
 #include <xml_schema_content_type.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /** @defgroup xml_schema_complex_type Xml Schema Type
   * @ingroup xml_schema
   * @{
@@ -42,10 +48,6 @@
                     xml_schema_complex_type_t;
 typedef struct xml_schema_complex_type_ops 
                     xml_schema_complex_type_ops_t;
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 
 struct xml_schema_complex_type_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_processing.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_processing.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_processing.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_processing.h Wed Jun 21 00:08:40 2006
@@ -32,16 +32,18 @@
   * @{
   */
 
-typedef struct xml_schema_content_processing 
-        xml_schema_content_processing_t;
-        
-typedef struct xml_schema_content_processing_ops 
-        xml_schema_content_processing_ops_t;
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+
+typedef struct xml_schema_content_processing 
+        xml_schema_content_processing_t;
+        
+typedef struct xml_schema_content_processing_ops 
+        xml_schema_content_processing_ops_t;
 
 struct xml_schema_content_processing_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_type.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_type.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_type.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_content_type.h Wed Jun 21 00:08:40 2006
@@ -27,6 +27,13 @@
 
 #include <xml_schema_enum.h>
 
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /** @defgroup xml_schema_content_type Xml Schema Form
   * @ingroup xml_schema
   * @{
@@ -36,11 +43,6 @@
                     xml_schema_content_type_t;
 typedef struct xml_schema_content_type_ops 
                     xml_schema_content_type_ops_t;
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 
 struct xml_schema_content_type_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_derivation_method.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_derivation_method.h?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema_derivation_method.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_derivation_method.h Wed Jun 21 00:08:40 2006
@@ -31,13 +31,17 @@
   * @{
   */
 
-typedef struct xml_schema_derivation_method xml_schema_derivation_method_t;
-typedef struct xml_schema_derivation_method_ops xml_schema_derivation_method_ops_t;
+
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+
+typedef struct xml_schema_derivation_method 
+                xml_schema_derivation_method_t;
+typedef struct xml_schema_derivation_method_ops
+                xml_schema_derivation_method_ops_t;
 
 struct xml_schema_derivation_method_ops
 {

Modified: webservices/axis2/trunk/c/xml_schema/samples/test_schema.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/samples/test_schema.c?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/samples/test_schema.c (original)
+++ webservices/axis2/trunk/c/xml_schema/samples/test_schema.c Wed Jun 21 00:08:40 2006
@@ -49,7 +49,10 @@
     if(NULL != schema)
     {
         printf("\n parsing schema is successful \n");
+        
+        printf("%s", XML_SCHEMA_SERIALIZE(schema, env));
     }                
+    
     
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/xml_schema/src/xml_schema.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/src/xml_schema.c?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/src/xml_schema.c (original)
+++ webservices/axis2/trunk/c/xml_schema/src/xml_schema.c Wed Jun 21 00:08:40 2006
@@ -15,6 +15,7 @@
  */
 
 #include <xml_schema_includes.h>
+#include <axiom_node.h>
 
 #define XML_SCHEMA_DEFAULT_TARGET_NS "DEFAULT"
 
@@ -67,6 +68,8 @@
     axis2_char_t *schema_ns_prefix;
 
     xml_schema_collection_t *parent;
+    
+    axiom_node_t *schema_root_node;
 };
 
 #define AXIS2_INTF_TO_IMPL(schema) \
@@ -260,6 +263,18 @@
         const axis2_env_t *env,
         axis2_char_t *ns_prefix);
         
+axis2_char_t* AXIS2_CALL
+xml_schema_serialize(
+        void *schema,
+        const axis2_env_t *env);  
+        
+axis2_status_t AXIS2_CALL
+xml_schema_set_root_node(
+        void *schema,
+        const axis2_env_t *env,
+        axiom_node_t *root);
+                      
+        
 
 AXIS2_EXTERN xml_schema_t * AXIS2_CALL
 xml_schema_create(const axis2_env_t *env,
@@ -297,6 +312,7 @@
     schema_impl->schema_types = NULL;
     schema_impl->target_namespace = NULL;
     schema_impl->schema_ns_prefix = NULL;
+    schema_impl->schema_root_node = NULL;
     
     if(NULL != namespc)
         schema_impl->target_namespace = AXIS2_STRDUP(namespc, env);
@@ -379,6 +395,10 @@
             xml_schema_add_type;
     schema_impl->schema.ops->set_schema_ns_prefix =
             xml_schema_set_schema_ns_prefix;
+    schema_impl->schema.ops->serialize =
+            xml_schema_serialize;  
+    schema_impl->schema.ops->set_root_node = 
+            xml_schema_set_root_node;                                  
             
             
             
@@ -1243,3 +1263,38 @@
     return AXIS2_FAILURE;
 }
 
+axis2_char_t* AXIS2_CALL
+xml_schema_serialize(
+        void *schema,
+        const axis2_env_t *env)
+{
+    xml_schema_impl_t *sch_impl = NULL;
+    axiom_xml_writer_t *writer = NULL;
+    axiom_output_t *output = NULL;
+        
+    sch_impl = AXIS2_INTF_TO_IMPL(schema);
+    if(sch_impl->schema_root_node)
+    {
+        writer = axiom_xml_writer_create_for_memory(env, NULL, 0, 0 ,
+            AXIS2_XML_PARSER_TYPE_BUFFER);
+        output = axiom_output_create(env, writer);
+        
+        AXIOM_NODE_SERIALIZE(sch_impl->schema_root_node, env, output);
+        return AXIOM_XML_WRITER_GET_XML(writer, env);
+    }
+    return NULL;
+}      
+
+axis2_status_t AXIS2_CALL
+xml_schema_set_root_node(
+        void *schema,
+        const axis2_env_t *env,
+        axiom_node_t *root)
+{
+    xml_schema_impl_t *sch_impl = NULL;
+    if(!root)
+        return AXIS2_FAILURE;
+    sch_impl = AXIS2_INTF_TO_IMPL(schema);
+    sch_impl->schema_root_node = root;
+    return AXIS2_SUCCESS;
+}          
\ No newline at end of file

Modified: webservices/axis2/trunk/c/xml_schema/src/xml_schema_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/src/xml_schema_builder.c?rev=415931&r1=415930&r2=415931&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/src/xml_schema_builder.c (original)
+++ webservices/axis2/trunk/c/xml_schema/src/xml_schema_builder.c Wed Jun 21 00:08:40 2006
@@ -495,6 +495,7 @@
     builder_impl = AXIS2_INTF_TO_IMPL(builder);
     
     set_namespace_attributes( builder, env, builder_impl->schema, ele_node);
+    XML_SCHEMA_SET_ROOT_NODE(builder_impl->schema, env, ele_node);
     
     if(NULL != uri)
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org