axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r413580 - in /webservices/axis2/trunk/c: util/include/ util/src/ util/src/minizip/ xml_schema/include/xml_schema/ xml_schema/src/ xml_schema/test/
Date Mon, 12 Jun 2006 05:01:53 GMT
Author: nandika
Date: Sun Jun 11 22:01:52 2006
New Revision: 413580

URL: http://svn.apache.org/viewvc?rev=413580&view=rev
Log:
compilation problems fixed and new files added

Added:
    webservices/axis2/trunk/c/xml_schema/include/xml_schema/xml_schema_input_source.h
    webservices/axis2/trunk/c/xml_schema/src/xml_schema_input_source.c
Modified:
    webservices/axis2/trunk/c/util/include/axis2_string.h
    webservices/axis2/trunk/c/util/src/minizip/archive_extract.c
    webservices/axis2/trunk/c/util/src/string.c
    webservices/axis2/trunk/c/util/src/uri.c
    webservices/axis2/trunk/c/util/src/url.c
    webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_builder.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_collection.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_includes.h
    webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_url_resolver.h
    webservices/axis2/trunk/c/xml_schema/src/xml_schema_builder.c
    webservices/axis2/trunk/c/xml_schema/src/xml_schema_collection.c
    webservices/axis2/trunk/c/xml_schema/src/xml_schema_url_resolver.c
    webservices/axis2/trunk/c/xml_schema/test/xml_schema_test.c

Modified: webservices/axis2/trunk/c/util/include/axis2_string.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axis2_string.h?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axis2_string.h (original)
+++ webservices/axis2/trunk/c/util/include/axis2_string.h Sun Jun 11 22:01:52 2006
@@ -102,9 +102,8 @@
      * @param ... The strings to concatenate.  The final string must be NULL
      * @return The new string
      */
-    AXIS2_DECLARE_NONSTD(axis2_char_t *) 
-    axis2_strcat(
-            const axis2_env_t *env, ...);
+    AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+    axis2_strcat(const axis2_env_t *env, ...);
         
     AXIS2_EXTERN axis2_char_t * AXIS2_CALL
     axis2_strstr (const axis2_char_t *heystack,
@@ -113,7 +112,7 @@
     AXIS2_EXTERN axis2_char_t * AXIS2_CALL
     axis2_rindex(const axis2_char_t *s, 
                  axis2_char_t c);
-                 
+    /* replaces s1 with s2 */                 
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
     axis2_replace(const axis2_env_t *env,
                   axis2_char_t *str,

Modified: webservices/axis2/trunk/c/util/src/minizip/archive_extract.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/minizip/archive_extract.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/minizip/archive_extract.c (original)
+++ webservices/axis2/trunk/c/util/src/minizip/archive_extract.c Sun Jun 11 22:01:52 2006
@@ -247,6 +247,7 @@
    int opt_extractdir=0;
    const axis2_char_t *dir_name=NULL;
    unzFile uf=NULL;
+   zlib_filefunc_def ffunc;
 
    if (zipfilename == NULL)
       zipfilename = d_name;
@@ -258,13 +259,13 @@
       strncpy(filename_try, zipfilename,MAXFILENAME-1);
       filename_try[ MAXFILENAME ] = '\0';
       
-      axis2_fill_win32_filefunc(&zlib_filefunc_def);
-      uf = AXIS2_UNZOPEN2(zipfilename,zlib_filefunc_def);
+      axis2_fill_win32_filefunc(&ffunc);
+      uf = AXIS2_UNZOPEN2(zipfilename,ffunc);
       if (uf==NULL)
       {
          strcat(filename_try,".zip");
 
-         uf = AXIS2_UNZOPEN2(zipfilename,zlib_filefunc_def);
+         uf = AXIS2_UNZOPEN2(zipfilename,ffunc);
       }
    }
 

Modified: webservices/axis2/trunk/c/util/src/string.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/string.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/string.c (original)
+++ webservices/axis2/trunk/c/util/src/string.c Sun Jun 11 22:01:52 2006
@@ -113,7 +113,7 @@
     return (void *) str;
 }
 
-AXIS2_DECLARE_NONSTD(axis2_char_t *) 
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
 axis2_strcat(
         const axis2_env_t *env, ...)
 {

Modified: webservices/axis2/trunk/c/util/src/uri.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/uri.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/uri.c (original)
+++ webservices/axis2/trunk/c/util/src/uri.c Sun Jun 11 22:01:52 2006
@@ -477,7 +477,7 @@
             v6_offset2 = 2;
             s = AXIS2_MEMCHR(hostinfo, ']', uri - hostinfo);
             if (s == NULL) {
-                return AXIS2_FAILURE;
+                return NULL;
             }
             if (*++s != ':') {
                 s = NULL; /* no port */
@@ -507,7 +507,7 @@
                 goto deal_with_path;
             }
             /* Invalid characters after ':' found */
-            return AXIS2_FAILURE;
+            return NULL;
         }
         uri_impl->port = axis2_uri_port_of_scheme(uri_impl->scheme);
         goto deal_with_path;
@@ -781,11 +781,11 @@
         unsigned flags)
 {
     axis2_uri_impl_t *uri_impl = NULL;
-    
+    axis2_char_t *ret = "";
     AXIS2_ENV_CHECK(env, NULL);
     uri_impl = AXIS2_INTF_TO_IMPL(uri);
 
-    axis2_char_t *ret = "";
+    
 
     /* If suppressing the site part, omit both user name & scheme://hostname */
     if (!(flags & AXIS2_URI_UNP_OMITSITEPART)) 

Modified: webservices/axis2/trunk/c/util/src/url.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/url.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/url.c (original)
+++ webservices/axis2/trunk/c/util/src/url.c Sun Jun 11 22:01:52 2006
@@ -466,7 +466,7 @@
     AXIS2_ENV_CHECK(env, NULL);
 
     url_str = axis2_url_to_external_form(url, env);
-    uri = axis2_uri_parse_string(url_str, env);
+    uri = axis2_uri_parse_string( env, url_str);
     
     return uri;
 }

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_builder.h?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_builder.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_builder.h Sun
Jun 11 22:01:52 2006
@@ -31,6 +31,7 @@
 #include <axis2_om.h>
 #include <axis2_hash.h>
 #include <xml_schema/axis2_xml_schema_collection.h>
+#include <axis2_om_util.h>
 /** @defgroup axis2_xml_schema_builder Xml Schema
   * @ingroup axis2_xml_schema_builder
   * @{

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_collection.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_collection.h?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_collection.h
(original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_collection.h
Sun Jun 11 22:01:52 2006
@@ -66,6 +66,12 @@
             axis2_xml_schema_collection_t* collection,
             const axis2_env_t *env,
             axis2_char_t *base_uri);
+            
+    axis2_char_t* (AXIS2_CALL*
+    get_base_uri)(
+            axis2_xml_schema_collection_t* collection,
+            const axis2_env_t *env);
+                        
                    
     axis2_status_t (AXIS2_CALL * 
     init)(
@@ -106,8 +112,8 @@
             axis2_om_node_t *ele_node,
             axis2_char_t *uri);
             
-    const axis2_hash_t* (AXIS2_CALL *
-    get_xml_schema)(
+    struct axis2_xml_schema* (AXIS2_CALL *
+    get_schema)(
             axis2_xml_schema_collection_t* collection,
             const axis2_env_t *env,
             axis2_char_t *system_id);
@@ -197,9 +203,6 @@
 #define AXIS2_XML_SCHEMA_COLLECTION_FREE(collection, env) \
       ((collection)->ops->free (collection, env))
       
-#define AXIS2_XML_SCHEMA_COLLECTION_SET_BASE_URI(collection, env, base_uri) \
-      ((collection)->ops->set_base_uri (collection, env, base_uri))
-      
 #define AXIS2_XML_SCHEMA_COLLECTION_INIT(collection, env) \
       ((collection)->ops->init(collection, env))
       
@@ -252,7 +255,15 @@
         
 #define AXIS2_XML_SCHEMA_COLLECTION_SET_NAMESPACES(collection, env, ht_ns) \
         ((collection)->ops->set_namespaces(collection, env, ht_ns))               

-                
+        
+#define AXIS2_XML_SCHEMA_COLLECTION_GET_SCHEMA(collection, env, system_id) \
+        ((collection)->ops->get_schema(collection, env, system_id))
+        
+#define AXIS2_XML_SCHEMA_COLLECTION_SET_BASE_URI(collection, env, base_uri) \
+      ((collection)->ops->set_base_uri (collection, env, base_uri))
+      
+#define AXIS2_XML_SCHEMA_COLLECTION_GET_BASE_URI(collection, env) \
+        ((collection)->ops->get_base_uri(collection, env))
         
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_includes.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_includes.h?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_includes.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_includes.h Sun
Jun 11 22:01:52 2006
@@ -58,7 +58,6 @@
 #include "axis2_xml_schema_particle.h"
 #include "axis2_xml_schema_enum.h"
 #include "axis2_xml_schema_content_processing.h"
-#include "axis2_om_util.h"
 #include "axis2_xml_schema_simple_content_restriction.h"
 #include "axis2_xml_schema_documentation.h"
 #include "axis2_xml_schema_data_type.h"
@@ -73,6 +72,7 @@
 #include "axis2_xml_schema_redefine.h"
 #include "axis2_xml_schema_type.h"
 #include "axis2_xml_schema_url_resolver.h"
+#include "xml_schema_input_source.h"
 
 #ifdef _cplusplus
 extern "C"

Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_url_resolver.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_url_resolver.h?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_url_resolver.h
(original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_url_resolver.h
Sun Jun 11 22:01:52 2006
@@ -21,18 +21,24 @@
  * @file axis2_xml_schema_url_resolver.h
  */
 #include <axis2_url.h>
+#include <xml_schema/xml_schema_input_source.h>
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+AXIS2_EXTERN xml_schema_input_source_t* AXIS2_CALL
 axis2_xml_schema_url_resolver_resolve_entity(
         const axis2_env_t *env,
         axis2_char_t *ns,
         axis2_char_t *schema_location,
         axis2_char_t *base_uri);
+        
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+get_file_url(const axis2_env_t *env,
+        axis2_char_t *path);        
         
 /** @} */
 #ifdef __cplusplus

Added: webservices/axis2/trunk/c/xml_schema/include/xml_schema/xml_schema_input_source.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/xml_schema_input_source.h?rev=413580&view=auto
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/xml_schema_input_source.h (added)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/xml_schema_input_source.h Sun
Jun 11 22:01:52 2006
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+ 
+#ifndef XML_SCHEMA_INPUT_SOURCE_H 
+#define XML_SCHEMA_INPUT_SOURCE_H
+ 
+/**
+ * @file axis2_xml_schema_input_source.h
+ */ 
+
+/** @defgroup axis2_xml_schema
+  * @ingroup axis2_xml_schema
+  * @{
+  */ 
+
+typedef struct xml_schema_input_source 
+                xml_schema_input_source_t;
+                
+typedef struct xml_schema_input_source_ops
+                xml_schema_input_source_ops_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct xml_schema_input_source_ops
+{
+    axis2_char_t* (AXIS2_CALL *
+    get_system_id)(
+            xml_schema_input_source_t *source,
+            const axis2_env_t *env);
+                   
+    axis2_status_t (AXIS2_CALL *                   
+    set_system_id)(
+            xml_schema_input_source_t *source,
+            const axis2_env_t *env,
+            const axis2_char_t *system_id);
+            
+    axis2_char_t* (AXIS2_CALL*
+    get_public_id)(
+            xml_schema_input_source_t *source,
+            const axis2_env_t *env);
+            
+    axis2_status_t (AXIS2_CALL*
+    set_public_id)(
+            xml_schema_input_source_t *source,
+            const axis2_env_t *env,
+            const axis2_char_t *public_id);
+            
+    axis2_status_t (AXIS2_CALL*
+    set_encoding)(
+            xml_schema_input_source_t *source,
+            const axis2_env_t *env,
+            const axis2_char_t *encoding);
+            
+    axis2_char_t * (AXIS2_CALL*
+    get_encoding)(
+            xml_schema_input_source_t *source,
+            const axis2_env_t *env);
+                                        
+    axis2_status_t (AXIS2_CALL *
+    free)(xml_schema_input_source_t *source,
+          const axis2_env_t *env);
+};
+
+struct xml_schema_input_source
+{
+    xml_schema_input_source_ops_t *ops;
+};
+
+AXIS2_EXTERN xml_schema_input_source_t* AXIS2_CALL
+xml_schema_input_source_create(const axis2_env_t *env);
+
+AXIS2_EXTERN xml_schema_input_source_t* AXIS2_CALL
+xml_schema_input_source_create_with_system_id(
+        const axis2_env_t *env,
+        const axis2_char_t *id);
+                                        
+/************ Macros ************************************/
+
+#define XML_SCHEMA_INPUT_SOURCE_FREE(source, env) \
+        ((source)->ops->free(source, env))
+        
+#define XML_SCHEMA_INPUT_SOURCE_SET_PUBLIC_ID(source, env, id) \
+        ((source)->ops->set_public_id(source, env, id))
+        
+#define XML_SCHEMA_INPUT_SOURCE_GET_PUBLIC_ID(source, env) \
+        ((source)->ops->get_public_id(source, env)) 
+        
+#define XML_SCHEMA_INPUT_SOURCE_SET_SYSTEM_ID(source, env, id) \
+        ((source)->ops->set_system_id(source, env, id))
+        
+#define XML_SCHEMA_INPUT_SOURCE_GET_SYSTEM_ID(source, env) \
+        ((source)->ops->get_system_id(source, env))
+        
+#define XML_SCHEMA_INPUT_SOURCE_SET_ENCODING(source, env, encoding) \
+        ((source)->ops->set_encoding(source, env, encoding))
+        
+#define XML_SCHEMA_INPUT_SOURCE_GET_ENCODING(source, env) \
+        ((source)->ops->get_encoding(source, env))
+        
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif /* XML_SCHEMA_INPUT_SOURCE_H */
+

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=413580&r1=413579&r2=413580&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 Sun Jun 11 22:01:52 2006
@@ -26,8 +26,6 @@
 {
     axis2_xml_schema_builder_t builder;
 
-    axis2_om_document_t *om_doc;
-    
     axis2_om_node_t *root_node;
     
     void *schema;
@@ -36,6 +34,10 @@
     
     int gen_no;
 
+    axis2_array_list_t *document_list;
+    
+    axis2_om_node_t *schema_element;
+    
 }axis2_xml_schema_builder_impl_t;
 
 #define AXIS2_INTF_TO_IMPL(builder) \
@@ -361,14 +363,14 @@
     
     builder_impl->collection = NULL;
     
-    builder_impl->om_doc = NULL;
-    
     builder_impl->root_node = NULL;
     
     builder_impl->schema = NULL;
     
     builder_impl->gen_no = 0;
     
+    builder_impl->document_list = NULL;
+    
     
     builder_impl->schema = axis2_xml_schema_create(env, NULL, sch_collection);
     if(!builder_impl->schema)
@@ -387,6 +389,8 @@
         axis2_xml_schema_builder_free(&(builder_impl->builder), env);
         return NULL;
     }            
+    
+    builder_impl->document_list = axis2_array_list_create(env, 2);
 
     builder_impl->builder.ops->free =
         axis2_xml_schema_builder_free;
@@ -408,21 +412,20 @@
         axis2_char_t *uri)
 {
     axis2_xml_schema_builder_impl_t *builder_impl = NULL;
+    axis2_om_node_t *root_node = NULL;
     
     AXIS2_PARAM_CHECK(env->error, om_doc, NULL);
     
     builder_impl = AXIS2_INTF_TO_IMPL(builder);
+
+    AXIS2_ARRAY_LIST_ADD(builder_impl->document_list, env, om_doc);
+        
+    root_node = AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(om_doc, env);            
     
-    builder_impl->om_doc = om_doc;
-    
-    builder_impl->root_node = 
-        AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(om_doc, env);            
-    
-    if(!builder_impl->root_node)
+    if(!root_node)
         return NULL;        
     
-    return handle_xml_schema_element(builder, env, 
-        builder_impl->root_node, uri);
+    return handle_xml_schema_element(builder, env, root_node, uri);
 }
         
 axis2_xml_schema_t* AXIS2_CALL
@@ -3118,7 +3121,6 @@
     int min_occurs = 0;
     
     
-    axis2_char_t *ele_n = NULL; /* to be removed */
     
     AXIS2_PARAM_CHECK(env->error, ele_node, NULL);
 
@@ -3131,8 +3133,6 @@
     element_name = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(om_ele, env,
             "name");
       
-    ele_n = AXIS2_OM_ELEMENT_GET_LOCALNAME(om_ele, env);
-          
     if(NULL != element_name)
     {
         AXIS2_XML_SCHEMA_ELEMENT_SET_NAME(sch_ele, env, element_name);
@@ -3735,18 +3735,6 @@
     
     source_uri = AXIS2_XML_SCHEMA_OBJ_GET_SOURCE_URI(builder_impl->schema, env);
     
-    /***************************************************/
-    ht_sch2schemas = AXIS2_XML_SCHEMA_COLLECTION_GET_SYSTEMID2_SCHEMAS(
-        builder_impl->collection, env);
-    
-    key_uri = axis2_xml_schema_url_resolver_resolve_entity(
-        env, NULL, sch_location, source_uri);            
-    if(NULL != ht_sch2schemas)
-    {
-        axis2_hash_set(ht_sch2schemas, key_uri, 
-            AXIS2_HASH_KEY_STRING, builder_impl->schema);
-    }                
-    /***************************************************/
     if(NULL != source_uri)
     {
         sch_location = AXIS2_XML_SCHEMA_EXTERNAL_GET_SCHEMA_LOCATION(include, env);
@@ -3970,7 +3958,7 @@
         axis2_char_t *atr_val = NULL;
         atr_val = AXIS2_STRDUP(attr_value, env);
         
-        return (axis2_char_t*)AXIS2_STRTRIM(atr_val, NULL);
+        return (axis2_char_t*)AXIS2_STRTRIM(env, atr_val, NULL);
     }        
     return AXIS2_XML_SCHEMA_CONST_NONE;
 }
@@ -4028,8 +4016,16 @@
         axis2_char_t *target_namespace,
         axis2_char_t *schema_location)
 {
+    axis2_char_t *base_uri = NULL;
+    axis2_xml_schema_builder_impl_t *builder_impl = NULL;
+    
+    builder_impl = AXIS2_INTF_TO_IMPL(builder);
+    
+    base_uri = AXIS2_XML_SCHEMA_COLLECTION_GET_BASE_URI(
+        builder_impl->collection, env);
+    
     return resolve_xml_schema_with_uri(builder,env, 
-            target_namespace, schema_location,  NULL);
+            target_namespace, schema_location,  base_uri);
 }     
 
 
@@ -4045,37 +4041,49 @@
     axis2_om_document_t *om_doc = NULL;
     axis2_om_stax_builder_t *om_builder = NULL;
     axis2_char_t *filename = NULL;
-/*  axis2_hash_t *sysid2schemas = NULL; 
-    axis2_xml_schema_t *schema = NULL;  */      
-        
+    axis2_hash_t *sysid2schemas = NULL; 
+    axis2_xml_schema_t *schema = NULL;
     axis2_xml_schema_builder_impl_t *sch_builder_impl = NULL;
+    xml_schema_input_source_t *input_source = NULL;
+    axis2_char_t *system_id = NULL;
+
     sch_builder_impl = AXIS2_INTF_TO_IMPL(builder);
-    filename = axis2_xml_schema_url_resolver_resolve_entity(env, 
+
+    input_source = axis2_xml_schema_url_resolver_resolve_entity(env, 
         target_namespace, schema_location, base_uri);
-    /*        
+
     if(!sch_builder_impl->collection)
         return NULL;                
-    sysid2schemas = AXIS2_XML_SCHEMA_COLLECTION_GET_SYSTEMID2_SCHEMAS(
-        sch_builder_impl->collection, env);
-        
-    if(!sysid2schemas)
+
+    if(NULL != input_source)
+    {
+        system_id = XML_SCHEMA_INPUT_SOURCE_GET_SYSTEM_ID(input_source, env);
+        if(NULL != system_id)
+        {
+            schema = AXIS2_XML_SCHEMA_COLLECTION_GET_SCHEMA(
+                sch_builder_impl->collection, env, system_id);
+        }
+    }
+    else
+    {
         return NULL;
-    if(NULL != base_uri)        
-        schema = axis2_hash_get(sysid2schemas, filename, AXIS2_HASH_KEY_STRING);
-   
+    }
     if(NULL != schema)
     {
         return schema;
-    }        
-    */
-    xml_reader = axis2_xml_reader_create_for_file(env, filename, NULL);
+    }
+
+    xml_reader = axis2_xml_reader_create_for_file(env, system_id, NULL);
     if(!xml_reader)
         return NULL;        
     om_builder = axis2_om_stax_builder_create(env, xml_reader);
     if(!om_builder)
         return NULL;
+
     om_doc = axis2_om_document_create(env, NULL, om_builder);
+
     AXIS2_OM_DOCUMENT_BUILD_ALL(om_doc, env);
+
     return AXIS2_XML_SCHEMA_COLLECTION_READ_DOCUMENT_WITH_URI(
         sch_builder_impl->collection , env, om_doc, base_uri);        
 }

Modified: webservices/axis2/trunk/c/xml_schema/src/xml_schema_collection.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/src/xml_schema_collection.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/src/xml_schema_collection.c (original)
+++ webservices/axis2/trunk/c/xml_schema/src/xml_schema_collection.c Sun Jun 11 22:01:52 2006
@@ -38,6 +38,8 @@
     
     axis2_hash_t *unresolved_types;
     
+    axis2_array_list_t *builder_list;
+    
 };
 
 #define AXIS2_INTF_TO_IMPL(collection) \
@@ -54,6 +56,11 @@
         axis2_xml_schema_collection_t* collection,
         const axis2_env_t *env,
         axis2_char_t *base_uri);
+        
+axis2_char_t* AXIS2_CALL
+axis2_xml_schema_collection_get_base_uri(
+        axis2_xml_schema_collection_t* collection,
+        const axis2_env_t *env);        
                    
 axis2_status_t AXIS2_CALL
 axis2_xml_schema_collection_init(
@@ -159,7 +166,13 @@
 axis2_hash_t* AXIS2_CALL
 axis2_xml_schema_collection_get_namespaces(
         axis2_xml_schema_collection_t *collection,
-        const axis2_env_t *env);                
+        const axis2_env_t *env);  
+        
+axis2_xml_schema_t* AXIS2_CALL 
+axis2_xml_schema_collection_get_schema(
+        axis2_xml_schema_collection_t *collection,
+        const axis2_env_t *env,
+        axis2_char_t *system_id);                                  
         
 
 AXIS2_EXTERN axis2_xml_schema_collection_t * AXIS2_CALL
@@ -183,6 +196,7 @@
     collection_impl->xsd = NULL;
     collection_impl->systemid2_schemas = NULL;
     collection_impl->schemas = NULL;
+    collection_impl->builder_list = NULL;
     
     collection_impl->collection.ops = AXIS2_MALLOC(env->allocator, 
                     sizeof(axis2_xml_schema_collection_ops_t)); 
@@ -194,11 +208,15 @@
         return NULL;
     }
     
-    
     collection_impl->collection.ops->free = 
             axis2_xml_schema_collection_free;
+    
     collection_impl->collection.ops->set_base_uri = 
             axis2_xml_schema_collection_set_base_uri;
+            
+    collection_impl->collection.ops->get_base_uri =
+            axis2_xml_schema_collection_get_base_uri;
+                        
     collection_impl->collection.ops->init = 
             axis2_xml_schema_collection_init;
             
@@ -243,6 +261,10 @@
             
     collection_impl->collection.ops->get_namespaces = 
             axis2_xml_schema_collection_get_namespaces;
+            
+    collection_impl->collection.ops->get_schema =
+            axis2_xml_schema_collection_get_schema;            
+            
 
     collection_impl->xsd = axis2_xml_schema_create(
         env, AXIS2_XML_SCHEMA_NS ,&(collection_impl->collection));
@@ -258,6 +280,7 @@
     collection_impl->systemid2_schemas   = axis2_hash_make(env);
     collection_impl->schemas             = axis2_array_list_create(env, 10);
     collection_impl->unresolved_types    = axis2_hash_make(env);
+    collection_impl->builder_list        = axis2_array_list_create(env, 2);
     
     if(!collection_impl->namespaces || !collection_impl->in_scope_namespaces ||
             !collection_impl->systemid2_schemas || !collection_impl->schemas ||
@@ -303,7 +326,9 @@
     if(NULL != collec_impl->base_uri)
     {
         AXIS2_FREE(env->allocator, collec_impl->base_uri);
+        collec_impl->base_uri = NULL;
     }
+    collec_impl->base_uri = AXIS2_STRDUP(base_uri, env);
     return AXIS2_SUCCESS;
 }
 
@@ -481,10 +506,15 @@
         axis2_char_t *uri)
 {
     axis2_xml_schema_builder_t *sch_builder = NULL;
+    axis2_xml_schema_collection_impl_t *collection_impl = NULL;
+    
     AXIS2_PARAM_CHECK(env->error, node, NULL);
     sch_builder = axis2_xml_schema_builder_create(env, collection);
     if(!sch_builder)
         return NULL;
+
+    AXIS2_ARRAY_LIST_ADD(collection_impl->builder_list, env, sch_builder);
+
     return AXIS2_XML_SCHEMA_BUILDER_BUILD_WITH_ROOT_NODE(sch_builder, env, node, uri);
 }
 
@@ -504,7 +534,7 @@
     uri = AXIS2_QNAME_GET_URI(qname, env);
 
     if(NULL != collec_impl->namespaces)
-        schema = axis2_hash_get(collec_impl->namespaces, uri, AXIS2_HASH_KEY_STRING);
             
+        schema = axis2_hash_get(collec_impl->namespaces, uri, AXIS2_HASH_KEY_STRING);
  
 
     if(!schema)
         return NULL;
@@ -719,3 +749,26 @@
     collection_impl = AXIS2_INTF_TO_IMPL(collection);
     return collection_impl->namespaces;
 }                  
+
+axis2_xml_schema_t* AXIS2_CALL 
+axis2_xml_schema_collection_get_schema(
+        axis2_xml_schema_collection_t *collection,
+        const axis2_env_t *env,
+        axis2_char_t *system_id)
+{
+    axis2_xml_schema_collection_impl_t *collection_impl = NULL;
+    AXIS2_PARAM_CHECK(env->error, system_id, NULL);
+    collection_impl = AXIS2_INTF_TO_IMPL(collection);
+    return axis2_hash_get(collection_impl->systemid2_schemas,
+        system_id, AXIS2_HASH_KEY_STRING);
+}        
+
+axis2_char_t* AXIS2_CALL
+axis2_xml_schema_collection_get_base_uri(
+        axis2_xml_schema_collection_t* collection,
+        const axis2_env_t *env)
+{
+    axis2_xml_schema_collection_impl_t *collection_impl = NULL;
+    collection_impl = AXIS2_INTF_TO_IMPL(collection);
+    return collection_impl->base_uri;
+}        

Added: webservices/axis2/trunk/c/xml_schema/src/xml_schema_input_source.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/src/xml_schema_input_source.c?rev=413580&view=auto
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/src/xml_schema_input_source.c (added)
+++ webservices/axis2/trunk/c/xml_schema/src/xml_schema_input_source.c Sun Jun 11 22:01:52
2006
@@ -0,0 +1,246 @@
+/*
+ * 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 <xml_schema/axis2_xml_schema_includes.h>
+ #include <axis2_env.h>
+ 
+ typedef struct xml_schema_input_source_impl 
+                    xml_schema_input_source_impl_t;
+ 
+ struct xml_schema_input_source_impl
+ {
+    xml_schema_input_source_t input_source;
+    
+    axis2_char_t *encoing;
+ 
+    axis2_char_t *system_id;
+    
+    axis2_char_t *public_id;
+ };
+ 
+#define AXIS2_INTF_TO_IMPL(source) \
+        ((xml_schema_input_source_impl_t*)source)
+        
+axis2_char_t* AXIS2_CALL
+xml_schema_input_source_get_system_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env);
+                
+axis2_status_t AXIS2_CALL                  
+xml_schema_input_source_set_system_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env,
+        const axis2_char_t *system_id);
+        
+axis2_char_t* AXIS2_CALL
+xml_schema_input_source_get_public_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env);
+        
+axis2_status_t AXIS2_CALL
+xml_schema_input_source_set_public_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env,
+        const axis2_char_t *public_id);
+        
+axis2_status_t AXIS2_CALL
+xml_schema_input_source_set_encoding(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env,
+        const axis2_char_t *encoding);
+        
+axis2_char_t * AXIS2_CALL
+xml_schema_input_source_get_encoding(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env);
+                                    
+axis2_status_t AXIS2_CALL
+xml_schema_input_source_free
+        (xml_schema_input_source_t *source,
+        const axis2_env_t *env); 
+
+
+AXIS2_EXTERN xml_schema_input_source_t* AXIS2_CALL
+xml_schema_input_source_create(const axis2_env_t *env)
+{
+    xml_schema_input_source_impl_t *input_source_impl = NULL;
+    
+    input_source_impl = (xml_schema_input_source_impl_t *)
+        AXIS2_MALLOC(env->allocator, sizeof(xml_schema_input_source_impl_t));
+        
+    if(!input_source_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+    }        
+    
+    input_source_impl->input_source.ops = NULL;
+    input_source_impl->public_id = NULL;
+    input_source_impl->system_id = NULL;
+    input_source_impl->encoing = NULL;
+    
+    input_source_impl->input_source.ops = (xml_schema_input_source_ops_t*)
+        AXIS2_MALLOC(env->allocator, sizeof(xml_schema_input_source_ops_t));
+    if(!input_source_impl->input_source.ops)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_FREE(env->allocator, input_source_impl);
+        return NULL;
+    }        
+
+    input_source_impl->input_source.ops->get_system_id =
+        xml_schema_input_source_get_system_id;
+    input_source_impl->input_source.ops->set_system_id =
+        xml_schema_input_source_set_system_id;
+    input_source_impl->input_source.ops->get_public_id =
+        xml_schema_input_source_get_public_id;
+    input_source_impl->input_source.ops->set_public_id =
+        xml_schema_input_source_set_public_id;
+    input_source_impl->input_source.ops->set_encoding =
+        xml_schema_input_source_set_encoding;
+    input_source_impl->input_source.ops->get_encoding =
+        xml_schema_input_source_get_encoding;                                
+    input_source_impl->input_source.ops->free =
+        xml_schema_input_source_free;                
+        
+    return &(input_source_impl->input_source);
+}
+
+AXIS2_EXTERN xml_schema_input_source_t* AXIS2_CALL
+xml_schema_input_source_create_with_system_id(
+        const axis2_env_t *env,
+        const axis2_char_t *id)
+{
+    xml_schema_input_source_impl_t *input_source_impl = NULL;
+    xml_schema_input_source_t *input_source = NULL;
+    
+    input_source = xml_schema_input_source_create(env);
+    
+    input_source_impl = AXIS2_INTF_TO_IMPL(input_source);
+        
+    input_source_impl->system_id = AXIS2_STRDUP(id, env);
+    return &(input_source_impl->input_source);
+} 
+
+axis2_status_t AXIS2_CALL
+xml_schema_input_source_free
+        (xml_schema_input_source_t *source,
+        const axis2_env_t *env)
+{
+    xml_schema_input_source_impl_t *input_source_impl = NULL;
+    input_source_impl = AXIS2_INTF_TO_IMPL(source);
+    if(NULL != input_source_impl->public_id)
+    {
+        AXIS2_FREE(env->allocator, input_source_impl->public_id);
+        input_source_impl->public_id = NULL;
+    }
+    if(NULL != input_source_impl->encoing)
+    {
+        AXIS2_FREE(env->allocator, input_source_impl->encoing);
+        input_source_impl->encoing = NULL;
+    }    
+    if(NULL != input_source_impl->system_id)
+    {
+        AXIS2_FREE(env->allocator, input_source_impl->system_id);
+        input_source_impl->system_id = NULL;
+    }
+    return AXIS2_FAILURE;
+}       
+
+axis2_char_t* AXIS2_CALL
+xml_schema_input_source_get_system_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env)
+{
+    xml_schema_input_source_impl_t *input_source = NULL;
+    
+    input_source = AXIS2_INTF_TO_IMPL(source);
+    return input_source->system_id;
+}
+                
+axis2_status_t AXIS2_CALL                  
+xml_schema_input_source_set_system_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env,
+        const axis2_char_t *system_id)
+{
+    xml_schema_input_source_impl_t *input_source = NULL;
+    input_source = AXIS2_INTF_TO_IMPL(source);
+    if(NULL != input_source->system_id)
+    {
+        AXIS2_FREE(env->allocator, input_source->system_id);
+        input_source->system_id = NULL;
+    }
+    input_source->system_id = AXIS2_STRDUP(system_id, env);
+    return AXIS2_SUCCESS;
+}
+        
+axis2_char_t* AXIS2_CALL
+xml_schema_input_source_get_public_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env)
+{
+    xml_schema_input_source_impl_t *input_source = NULL;
+    input_source = AXIS2_INTF_TO_IMPL(source);
+    return input_source->public_id; 
+}
+        
+axis2_status_t AXIS2_CALL
+xml_schema_input_source_set_public_id(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env,
+        const axis2_char_t *public_id)
+{
+    xml_schema_input_source_impl_t *input_source = NULL;
+    input_source = AXIS2_INTF_TO_IMPL(source);
+    if(NULL != input_source->public_id)
+    {
+        AXIS2_FREE(env->allocator, input_source->public_id);
+        input_source->public_id = NULL;
+    }
+    input_source->public_id = AXIS2_STRDUP(public_id, env);
+    return AXIS2_SUCCESS;
+}
+        
+axis2_status_t AXIS2_CALL
+xml_schema_input_source_set_encoding(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env,
+        const axis2_char_t *encoding)
+{
+    xml_schema_input_source_impl_t *input_source = NULL;
+    input_source = AXIS2_INTF_TO_IMPL(source);
+    if(NULL != input_source->encoing)
+    {
+        AXIS2_FREE(env->allocator, input_source->encoing);
+        input_source->encoing = NULL;
+    }
+    input_source->encoing = AXIS2_STRDUP(encoding, env);
+    return AXIS2_SUCCESS;
+}
+        
+axis2_char_t * AXIS2_CALL
+xml_schema_input_source_get_encoding(
+        xml_schema_input_source_t *source,
+        const axis2_env_t *env)
+{
+    xml_schema_input_source_impl_t *input_source_impl = NULL;
+    input_source_impl = AXIS2_INTF_TO_IMPL(source);
+    return input_source_impl->encoing;
+}
+                                    
+
+
+

Modified: webservices/axis2/trunk/c/xml_schema/src/xml_schema_url_resolver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/src/xml_schema_url_resolver.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/src/xml_schema_url_resolver.c (original)
+++ webservices/axis2/trunk/c/xml_schema/src/xml_schema_url_resolver.c Sun Jun 11 22:01:52
2006
@@ -19,36 +19,55 @@
 #include <axis2_file_handler.h>
 #include <platforms/axis2_platform_auto_sense.h>
 
-#ifndef S_ISDIR
-#   define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
-#endif
-
-
 static axis2_bool_t 
 is_absolute_url(const axis2_char_t *url);
 
-static axis2_char_t*
-get_url(const axis2_env_t *env,
-        axis2_char_t *path,
-        axis2_char_t *spec);
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+get_file_url(const axis2_env_t *env,
+        axis2_char_t *path);
+
+AXIS2_EXTERN xml_schema_input_source_t* AXIS2_CALL
 axis2_xml_schema_url_resolver_resolve_entity(
         const axis2_env_t *env,
         axis2_char_t *ns,
         axis2_char_t *schema_location,
         axis2_char_t *base_uri)
 {
-    if(!base_uri)
-        return schema_location;
-        
-    if(!is_absolute_url(schema_location))
+    axis2_uri_t *uri1 = NULL;
+    axis2_uri_t *uri2 = NULL;
+    
+    if(NULL != base_uri && NULL != schema_location)
     {
-        axis2_char_t *path = NULL;
-        path = get_url(env, base_uri, schema_location);        
-        return path;
-    }
-    return schema_location;
+        axis2_uri_t *uri1 = NULL;
+        axis2_uri_t *uri2 = NULL;
+        axis2_char_t *abs_path = NULL;
+        axis2_char_t *ref = NULL;
+        /*
+        if(axis2_file_handler_access(base_uri, AXIS2_F_OK))
+        {
+             abs_path = AXIS2_GETCWD(base_uri);
+            uri1 = axis2_uri_parse_string(env, get_file_url(env, bas));
+
+        }
+        */        
+        abs_path = get_file_url(env, base_uri);
+        
+        uri1 = axis2_uri_parse_string(env, abs_path);
+                                
+        if(NULL != uri1)
+        {
+            uri2 = axis2_uri_parse_relative(env, uri1, schema_location);
+            if(NULL != uri2)
+            {
+                ref = AXIS2_URI_TO_STRING(uri2, env, 1);
+                /* AXIS2_URI_FREE(uri2, env);  */
+                return xml_schema_input_source_create_with_system_id(env, ref);
+            }
+        }
+        return NULL;                    
+    }        
+    return xml_schema_input_source_create_with_system_id(env, schema_location);
 }        
 
 static axis2_bool_t 
@@ -62,48 +81,27 @@
     return AXIS2_FALSE;
 }
 
-static axis2_char_t*
-get_url(const axis2_env_t *env,
-        axis2_char_t *path,
-        axis2_char_t *spec)
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+get_file_url(const axis2_env_t *env,
+        axis2_char_t *path)
 {
     axis2_char_t *modified_path = NULL;
     axis2_char_t *final_path = NULL;
-       
-    if(NULL != path)
-    {
-        modified_path = AXIS2_STRDUP(spec, env);
-    }
-    /** create a path */
-    modified_path = AXIS2_REPLACE(env, modified_path, '\\','/');
-    
+    if(!path)
+        return NULL;
+    modified_path = AXIS2_STRDUP(path, env);
+    AXIS2_REPLACE(env, modified_path, '\\', '/');
     if(strncmp(modified_path, "/", 1) == 0)
     {
-        final_path = AXIS2_STRACAT(path, modified_path, env);
+        final_path = AXIS2_STRACAT("file://", modified_path, env);
     }
     else
     {
-        axis2_char_t *temp_path = NULL;
-        temp_path = AXIS2_STRACAT(path, "/",env);
-        final_path = AXIS2_STRACAT(temp_path, modified_path, env);
-        AXIS2_FREE(env->allocator, modified_path);
+        final_path = AXIS2_STRACAT("file:///", modified_path, env);
     }
-        
-    if(NULL != final_path)
-    {       
-        if(strncmp(final_path,"file:///", 8) == 0)
-        {
-            axis2_char_t *real_path = NULL;
-            axis2_char_t *start = NULL;
-            start = final_path+8*sizeof(axis2_char_t);
-            real_path = AXIS2_STRDUP(start, env);
-            AXIS2_FREE(env->allocator, final_path);
-            if(axis2_file_handler_access(real_path, AXIS2_F_OK))
-                return real_path;
-        } 
-        else
-            if(axis2_file_handler_access(final_path, AXIS2_F_OK))
-                return final_path;
-    }
-    return NULL;
-}        
+    if(NULL != modified_path)
+    {
+        AXIS2_FREE(env->allocator, modified_path);
+    }                
+    return final_path;        
+}

Modified: webservices/axis2/trunk/c/xml_schema/test/xml_schema_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/test/xml_schema_test.c?rev=413580&r1=413579&r2=413580&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/test/xml_schema_test.c (original)
+++ webservices/axis2/trunk/c/xml_schema/test/xml_schema_test.c Sun Jun 11 22:01:52 2006
@@ -55,8 +55,9 @@
     SUITE_ADD_TEST(suite, test_simple_restriction);
     SUITE_ADD_TEST(suite, test_unqualified_schemas);
     SUITE_ADD_TEST(suite, test_local_unnamed_simple_type);
-    
-/*  
+    SUITE_ADD_TEST(suite, test_schema_import1);
+    
+/*
     SUITE_ADD_TEST(suite, test_circular_schema); 
     SUITE_ADD_TEST(suite, test_two_schmes);
 */    



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


Mime
View raw message