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/05/25 08:50:26 UTC
svn commit: r409314 - in /webservices/axis2/trunk/c: util/src/
util/src/minizip/ xml_schema/ xml_schema/include/xml_schema/
Author: nandika
Date: Wed May 24 23:50:25 2006
New Revision: 409314
URL: http://svn.apache.org/viewvc?rev=409314&view=rev
Log:
axis2_archive_extract.h added
Added:
webservices/axis2/trunk/c/util/src/minizip/axis2_archive_extract.h
Modified:
webservices/axis2/trunk/c/util/src/dir_handler.c
webservices/axis2/trunk/c/util/src/minizip/archive_extract.c
webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_content.h
webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_type.h
webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_simple_content_restriction.h
webservices/axis2/trunk/c/xml_schema/xml_schema_builder.c
webservices/axis2/trunk/c/xml_schema/xml_schema_facet.c
Modified: webservices/axis2/trunk/c/util/src/dir_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/dir_handler.c?rev=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/dir_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/dir_handler.c Wed May 24 23:50:25 2006
@@ -18,11 +18,12 @@
#include <axis2_file.h>
#include <platforms/axis2_platform_auto_sense.h>
#include <axis2_string.h>
-
#ifndef S_ISDIR
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
+#include <axis2_archive_extract.h>
+
extern int AXIS2_ALPHASORT();
int dir_select(struct dirent *entry);
@@ -210,7 +211,7 @@
file_list = axis2_array_list_create(env, 0);
if (!getcwd(cwd, 500)) exit(1);
chdir(pathname);
- axis2_aar_extract(pathname);
+ axis2_archive_extract();
count = AXIS2_SCANDIR(pathname, &files, dir_select, AXIS2_ALPHASORT);
chdir(cwd);
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=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/minizip/archive_extract.c (original)
+++ webservices/axis2/trunk/c/util/src/minizip/archive_extract.c Wed May 24 23:50:25 2006
@@ -5,144 +5,81 @@
#include <fcntl.h>
#include <unzip.h>
#include <axis2_crypt.h>
+#include <axis2_ioapi.h>
+
+#ifdef WIN32
+#include <axis2_iowin32.h>
+#endif
#define CASESENSITIVITY (0)
#define WRITEBUFFERSIZE (8192)
#define MAXFILENAME (256)
axis2_status_t aar_select();
+int aar_extract(axis2_char_t *d_name);
extern int AXIS2_ALPHASORT();
-
-AXIS2_DECLARE(axis2_status_t *)
-axis2_aar_extract()
-{
- struct dirent **namelist;
- int n;
- axis2_char_t *ptr;
-
- n = scandir(".", &namelist, 0, alphasort);
- if (n < 0)
- return AXIS2_FALSE;
- else
- {
- while(n--)
- {
- if ((strcmp(namelist[n]->d_name, ".")== 0) ||
- (strcmp(namelist[n]->d_name, "..") == 0))
- return (AXIS2_FALSE);
-
- ptr = AXIS2_RINDEX(namelist[n]->d_name, '.');
-
- if ((ptr != NULL) &&
- (((strcmp(ptr, AXIS2_AAR_SUFFIX) == 0)) || (strcmp(ptr, AXIS2_MAR_SUFFIX) == 0)))
- {
- aar_extract(namelist[n]->d_name);
- }
- free(namelist[n]);
- }
- free(namelist);
- }
- return (AXIS2_TRUE);
+int axis2_mkdir(dir_name)
+ const axis2_char_t* dir_name;
+{
+ int value=0;
+ #ifdef WIN32
+ value = mkdir(dir_name);
+ #else
+ value = mkdir (dir_name,0775);
+ #endif
+ return value;
}
-int aar_extract(axis2_char_t *d_name)
+int axis2_create_dir (new_dir)
+ axis2_char_t *new_dir;
{
- const axis2_char_t *zipfilename=NULL;
- const axis2_char_t *filename_to_extract=NULL;
- const axis2_char_t *password=NULL;
- axis2_char_t filename_try[MAXFILENAME+16] = "";
- int opt_do_extract_withoutpath=0;
- int opt_overwrite=0;
- int opt_extractdir=0;
- const axis2_char_t *dir_name=NULL;
- unzFile uf=NULL;
-
- if (zipfilename == NULL)
- zipfilename = d_name;
-
- filename_to_extract = d_name;
- zlib_filefunc_def ffunc;
- if (zipfilename!=NULL)
- {
- strncpy(filename_try, zipfilename,MAXFILENAME-1);
- filename_try[ MAXFILENAME ] = '\0';
-
- axis2_fill_win32_filefunc(&ffunc);
- uf = AXIS2_UNZOPEN2(zipfilename,ffunc);
- if (uf==NULL)
- {
- strcat(filename_try,".zip");
-
- uf = AXIS2_UNZOPEN2(zipfilename,ffunc);
- }
- }
-
- if (uf==NULL)
- return -1;
-
- if (opt_extractdir && chdir(dir_name))
- exit(-1);
+ axis2_char_t *buffer ;
+ axis2_char_t *p;
+ int len = (int)strlen(new_dir);
- return axis2_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
- unzCloseCurrentFile(uf);
+ if (len <= 0)
return 0;
-}
-
-int axis2_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
- unzFile uf;
- const axis2_char_t* filename;
- int opt_extract_without_path;
- int opt_overwrite;
- const axis2_char_t* password;
-{
- if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
- return -1;
- if (axis2_extract_currentfile(uf,&opt_extract_without_path,
- &opt_overwrite,
- password) == UNZ_OK)
- return 0;
- else
- return -1;
-}
+ buffer = (axis2_char_t*)malloc(len+1);
+ strcpy(buffer,new_dir);
-int axis2_extract(uf,opt_extract_without_path,opt_overwrite,password)
- unzFile uf;
- int opt_extract_without_path;
- int opt_overwrite;
- const axis2_char_t* password;
-{
- uLong i;
- unz_global_info gi;
- int err;
+ if (buffer[len-1] == '/')
+ {
+ buffer[len-1] = '\0';
+ }
- err = unzGetGlobalInfo (uf,&gi);
- if (err!=UNZ_OK)
- return -1;
+ if (axis2_mkdir(buffer) == 0)
+ {
+ free(buffer);
+ return 1;
+ }
- for (i=0;i<gi.number_entry;i++)
+ p = buffer+1;
+ while (1)
{
- if (axis2_extract_currentfile(uf,&opt_extract_without_path,
- &opt_overwrite,
- password) != UNZ_OK)
- break;
+ axis2_char_t hold;
- if ((i+1)<gi.number_entry)
+ while(*p && *p != '\\' && *p != '/')
+ p++;
+ hold = *p;
+ *p = 0;
+ if ((axis2_mkdir(buffer) == -1))
{
- err = unzGoToNextFile(uf);
- if (err!=UNZ_OK)
- {
- return -1;
- break;
- }
+ free(buffer);
+ return 0;
}
+ if (hold == 0)
+ break;
+ *p++ = hold;
}
-
- return 0;
+ free(buffer);
+ return 1;
}
+
+
int axis2_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
unzFile uf;
const int* popt_extract_without_path;
@@ -247,62 +184,144 @@
return err;
}
-
-int axis2_create_dir (new_dir)
- axis2_char_t *new_dir;
+int axis2_extract(uf,opt_extract_without_path,opt_overwrite,password)
+ unzFile uf;
+ int opt_extract_without_path;
+ int opt_overwrite;
+ const axis2_char_t* password;
{
- axis2_char_t *buffer ;
- axis2_char_t *p;
- int len = (int)strlen(new_dir);
-
- if (len <= 0)
- return 0;
+ uLong i;
+ unz_global_info gi;
+ int err;
- buffer = (axis2_char_t*)malloc(len+1);
- strcpy(buffer,new_dir);
+ err = unzGetGlobalInfo (uf,&gi);
+ if (err!=UNZ_OK)
+ return -1;
- if (buffer[len-1] == '/')
+ for (i=0;i<gi.number_entry;i++)
{
- buffer[len-1] = '\0';
- }
+ if (axis2_extract_currentfile(uf,&opt_extract_without_path,
+ &opt_overwrite,
+ password) != UNZ_OK)
+ break;
- if (axis2_mkdir(buffer) == 0)
- {
- free(buffer);
- return 1;
+ if ((i+1)<gi.number_entry)
+ {
+ err = unzGoToNextFile(uf);
+ if (err!=UNZ_OK)
+ {
+ return -1;
+ break;
+ }
+ }
}
- p = buffer+1;
- while (1)
- {
- axis2_char_t hold;
+ return 0;
+}
+
+
+int aar_extract(axis2_char_t *d_name)
+{
+ const axis2_char_t *zipfilename=NULL;
+ const axis2_char_t *filename_to_extract=NULL;
+ const axis2_char_t *password=NULL;
+ axis2_char_t filename_try[MAXFILENAME+16] = "";
+ int opt_do_extract_withoutpath=0;
+ int opt_overwrite=0;
+ int opt_extractdir=0;
+ const axis2_char_t *dir_name=NULL;
+ unzFile uf=NULL;
+ zlib_filefunc_def ffunc;
- while(*p && *p != '\\' && *p != '/')
- p++;
- hold = *p;
- *p = 0;
- if ((axis2_mkdir(buffer) == -1))
+ if (zipfilename == NULL)
+ zipfilename = d_name;
+
+ filename_to_extract = d_name;
+
+ if (zipfilename!=NULL)
+ {
+ strncpy(filename_try, zipfilename,MAXFILENAME-1);
+ filename_try[ MAXFILENAME ] = '\0';
+
+ axis2_fill_win32_filefunc(&ffunc);
+ uf = AXIS2_UNZOPEN2(zipfilename,ffunc);
+ if (uf==NULL)
{
- free(buffer);
- return 0;
+ strcat(filename_try,".zip");
+
+ uf = AXIS2_UNZOPEN2(zipfilename,ffunc);
}
- if (hold == 0)
- break;
- *p++ = hold;
}
- free(buffer);
- return 1;
+
+ if (uf==NULL)
+ return -1;
+
+ if (opt_extractdir && chdir(dir_name))
+ exit(-1);
+
+ return axis2_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
+ unzCloseCurrentFile(uf);
+ return 0;
}
-int axis2_mkdir(dir_name)
- const axis2_char_t* dir_name;
+
+
+int axis2_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
+ unzFile uf;
+ const axis2_char_t* filename;
+ int opt_extract_without_path;
+ int opt_overwrite;
+ const axis2_char_t* password;
{
- int value=0;
- #ifdef WIN32
- value = mkdir(dir_name);
- #else
- value = mkdir (dir_name,0775);
- #endif
- return value;
+ if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
+ return -1;
+
+ if (axis2_extract_currentfile(uf,&opt_extract_without_path,
+ &opt_overwrite,
+ password) == UNZ_OK)
+ return 0;
+ else
+ return -1;
+}
+
+
+
+
+
+
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_archive_extract()
+{
+ struct dirent **namelist;
+ int n;
+ axis2_char_t *ptr;
+
+ n = scandir(".", &namelist, 0, alphasort);
+ if (n < 0)
+ return AXIS2_FALSE;
+ else
+ {
+ while(n--)
+ {
+ if ((strcmp(namelist[n]->d_name, ".")== 0) ||
+ (strcmp(namelist[n]->d_name, "..") == 0))
+ return (AXIS2_FALSE);
+
+ ptr = AXIS2_RINDEX(namelist[n]->d_name, '.');
+
+ if ((ptr != NULL) &&
+ (((strcmp(ptr, AXIS2_AAR_SUFFIX) == 0)) || (strcmp(ptr, AXIS2_MAR_SUFFIX) == 0)))
+ {
+ aar_extract(namelist[n]->d_name);
+ }
+ free(namelist[n]);
+ }
+ free(namelist);
+ }
+ return (AXIS2_TRUE);
+
}
+
+
Added: webservices/axis2/trunk/c/util/src/minizip/axis2_archive_extract.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/minizip/axis2_archive_extract.h?rev=409314&view=auto
==============================================================================
--- webservices/axis2/trunk/c/util/src/minizip/axis2_archive_extract.h (added)
+++ webservices/axis2/trunk/c/util/src/minizip/axis2_archive_extract.h Wed May 24 23:50:25 2006
@@ -0,0 +1,33 @@
+/*
+ * 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 AXIS2_ARCHIVE_EXTRACT_H
+#define AXIS2_ARCHIVE_EXTRACT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_archive_extract();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** AXIS2_ARCHIVE_EXTRACT_H */
\ No newline at end of file
Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_content.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_content.h?rev=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_content.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_content.h Wed May 24 23:50:25 2006
@@ -132,9 +132,9 @@
(((axis2_xml_schema_complex_content_t *) complex_content)->ops->\
get_content(complex_content, env))
-#define AXIS2_XML_SCHEMA_COMPLEX_CONTENT_SET_CONTENT(complex_content, env, content, content_type) \
+#define AXIS2_XML_SCHEMA_COMPLEX_CONTENT_SET_CONTENT(complex_content, env, content) \
(((axis2_xml_schema_complex_content_t *) complex_content)->ops->\
- set_content(complex_content, env, content, content_type ))
+ set_content(complex_content, env, content ))
#define AXIS2_XML_SCHEMA_COMPLEX_CONTENT_TO_STRING(complex_content, env, prefix, tab) \
(((axis2_xml_schema_complex_content_t *) complex_content)->ops->\
Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_type.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_type.h?rev=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_type.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_complex_type.h Wed May 24 23:50:25 2006
@@ -257,9 +257,10 @@
(((axis2_xml_schema_complex_type_t *) complex_type)->ops->\
get_content_model(complex_type, env, cnt_mtype))
-#define AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_CONTENT_MODEL(complex_type, env, cnt_model, cnt_mtype) \
+#define AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_CONTENT_MODEL(complex_type, env, cnt_model) \
(((axis2_xml_schema_complex_type_t *) complex_type)->ops->\
- set_content_model(complex_type, env, cnt_model, cnt_mtype))
+ set_content_model(complex_type, env, cnt_model))
+
#define AXIS2_XML_SCHEMA_COMPLEX_TYPE_GET_CONTENT_TYPE(complex_type, env) \
(((axis2_xml_schema_complex_type_t *) complex_type)->ops->\
get_content_type(complex_type, env))
@@ -293,7 +294,8 @@
get_particle(complex_type, env))
#define AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_PARTICLE(complex_type, env, particle) \
- ((complex_type)->ops->set_particle(complex_type, env, particle))
+ (((axis2_xml_schema_complex_type_t *)complex_type)->ops->\
+ set_particle(complex_type, env, particle))
#define AXIS2_XML_SCHEMA_COMPLEX_TYPE_TO_STRING(complex_type, env, prefix, tab) \
(((axis2_xml_schema_complex_type_t *) complex_type)->ops->\
Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_simple_content_restriction.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_simple_content_restriction.h?rev=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_simple_content_restriction.h (original)
+++ webservices/axis2/trunk/c/xml_schema/include/xml_schema/axis2_xml_schema_simple_content_restriction.h Wed May 24 23:50:25 2006
@@ -38,8 +38,6 @@
* @{
*/
-
-
#ifdef __cplusplus
extern "C"
{
@@ -142,7 +140,7 @@
(((axis2_xml_schema_simple_content_restriction_t *)sim_content_res)->ops->\
get_any_attribute(sim_content_res, env))
-#define AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET__ANY_ATTRIBUTE(sim_content_res,\
+#define AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_ANY_ATTRIBUTE(sim_content_res,\
env, any_attr)\
(((axis2_xml_schema_simple_content_restriction_t *)sim_content_res)->ops->\
set_content(sim_content_res, env, any_attr ))
@@ -155,13 +153,11 @@
(((axis2_xml_schema_simple_content_restriction_t *)sim_content_res)->ops->\
get_base_type_name(sim_content_res, env))
-#define AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_BASE_TYPE_NAME\
- (sim_content_res, env, base_type_name) \
+#define AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_BASE_TYPE_NAME(sim_content_res, env, base_type_name) \
(((axis2_xml_schema_simple_content_restriction_t *)sim_content_res)->ops->\
set_base_type_name(sim_content_res, env, base_type_name))
-#define AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_BASE_TYPE\
- (sim_content_res, env, base_type) \
+#define AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_BASE_TYPE(sim_content_res, env, base_type) \
(((axis2_xml_schema_simple_content_restriction_t *)sim_content_res)->ops->\
set_base_type(sim_content_res, env, base_type))
Modified: webservices/axis2/trunk/c/xml_schema/xml_schema_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/xml_schema_builder.c?rev=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/xml_schema_builder.c (original)
+++ webservices/axis2/trunk/c/xml_schema/xml_schema_builder.c Wed May 24 23:50:25 2006
@@ -990,21 +990,239 @@
axis2_xml_schema_builder_t *builder,
axis2_env_t **env,
axis2_om_node_t *complex_node,
- axis2_om_node_t *schema_node){}
+ axis2_om_node_t *schema_node)
+{
+ void *cmp_type = NULL;
+
+ axis2_om_element_t *cmp_ele = NULL;
+
+ axis2_om_element_t *ele1 = NULL;
+ axis2_om_node_t *node1 = NULL;
+ axis2_char_t *attr_value = NULL;
+
+ axis2_xml_schema_builder_impl_t *builder_impl = NULL;
+ builder_impl = AXIS2_INTF_TO_IMPL(builder);
+
+ cmp_type = axis2_xml_schema_complex_type_create(env, builder_impl->schema);
+
+ cmp_ele = (axis2_om_element_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(complex_node, env);
+
+ attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(cmp_ele, env, "name");
+
+ if(NULL != attr_value)
+ {
+ AXIS2_XML_SCHEMA_TYPE_SET_NAME(cmp_type, env, attr_value);
+ attr_value = NULL;
+ }
+
+ ele1 = axis2_om_util_get_first_child_element_with_uri(complex_node , env,
+ AXIS2_XML_SCHEMA_NS, &node1);
+ while(NULL != ele1)
+ {
+ axis2_char_t *localname = NULL;
+ localname = AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1, env);
+
+ if(AXIS2_STRCMP(localname, "sequence") == 0)
+ {
+ void *sequence = NULL;
+
+ sequence = handle_sequence(builder, env,
+ node1, schema_node);
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_PARTICLE(cmp_type, env, sequence);
+
+ }
+ else if(AXIS2_STRCMP(localname, "choice") == 0)
+ {
+ void *choice = NULL;
+
+ choice = handle_choice(builder, env,
+ node1, schema_node);
+
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_PARTICLE(cmp_type, env, choice);
+ }
+ else if(AXIS2_STRCMP(localname, "all") == 0)
+ {
+ void *all = NULL;
+ all = handle_all(builder, env, node1, schema_node);
+
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_PARTICLE(cmp_type, env, all);
+ }
+ else if(AXIS2_STRCMP(localname, "attribute") == 0)
+ {
+ void *attribute = NULL;
+ axis2_xml_schema_obj_collection_t *attributes = NULL;
+ attribute = handle_attribute(builder, env, node1, schema_node);
+ attributes = AXIS2_XML_SCHEMA_COMPLEX_TYPE_GET_ATTRIBUTES(cmp_type, env);
+ AXIS2_XML_SCHEMA_OBJ_COLLECTION_ADD(attributes, env, attribute);
+ }
+ else if(AXIS2_STRCMP(localname, "attributeGroup") == 0)
+ {
+ void *attr_grp = NULL;
+ axis2_xml_schema_obj_collection_t *attributes = NULL;
+ attr_grp = handle_attribute_group(builder, env, node1, schema_node);
+ attributes = AXIS2_XML_SCHEMA_COMPLEX_TYPE_GET_ATTRIBUTES(cmp_type, env);
+ AXIS2_XML_SCHEMA_OBJ_COLLECTION_ADD(attributes, env, attribute);
+ }
+ else if(AXIS2_STRCMP(localname, "group") == 0)
+ {
+ void *grp = NULL;
+ void *cmp_type_particle = NULL;
+ void *grp_particle = NULL;
+ grp = handle_group(builder, env, node1, schema_node);
+ grp_particle = AXIS2_XML_SCHEMA_GROUP_GET_PARTICLE(grp, env);
+ if(NULL == grp_particle)
+ {
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_PARTICLE(cmp_type, env, grp);
+ }
+ else
+ {
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_PARTICLE(cmp_type, env, grp_particle);
+ }
+ }
+ else if(AXIS2_STRCMP(localname, "simpleContent") == 0)
+ {
+ void *sim_cnt = NULL;
+ sim_cnt = handle_simple_content(builder, node1, schema_node);
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_CONTENT_MODEL(cmp_type, env, sim_cnt);
+ }
+ else if(AXIS2_STRCMP(localname, "complexContent") == 0)
+ {
+ void *cmp_cnt = NULL;
+ cmp_cnt = handle_complex_content(builder, env, node1, schema_node);
+ AXIS2_XML_SCHEMA_COMPLEX_TYPE_SET_CONTENT_MODEL(cmp_cnt, env,
+ }
+
+
+ ele1 = axis2_om_util_get_next_sibling_element_with_uri(node1, env,
+ AXIS2_XML_SCHEMA_NS, &node1);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
static axis2_xml_schema_simple_content_t*
handle_simple_content(
axis2_xml_schema_builder_t *builder,
axis2_env_t **env,
axis2_om_node_t *simple_node,
- axis2_om_node_t *schema_node){}
+ axis2_om_node_t *schema_node)
+{
+
+ void *sim_cnt = NULL;
+ axis2_om_element_t *sim_cnt_ele = NULL;
+
+ axis2_om_element_t *ele1 = NULL;
+ axis2_om_node_t *node1 = NULL;
+
+ sim_cnt = axis2_xml_schema_simple_content_create(env);
+
+ sim_cnt_ele = (axis2_om_element_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(simple_node, env);
+
+ ele1 = axis2_om_util_get_first_child_element_with_uri(simple_node , env,
+ AXIS2_XML_SCHEMA_NS, &node1);
+
+ while(NULL != ele1)
+ {
+ axis2_char_t *localname = NULL;
+ localname = AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1, env);
+
+ if(AXIS2_STRCMP(localname, "restriction") == 0)
+ {
+ void *sim_res = NULL;
+
+ sim_res = handle_simple_content_restriction(builder, env,
+ node1, schema_node);
+
+ AXIS2_XML_SCHEMA_SIMPLE_CONTENT_SET_CONTENT(sim_cnt, env, sim_res);
+ }
+ else if(AXIS2_STRCMP(localname, "extension") == 0)
+ {
+ void *sim_ext = NULL;
+
+ sim_ext = handle_simple_content_extension(builder, env,
+ node1, schema_node);
+
+ AXIS2_XML_SCHEMA_SIMPLE_CONTENT_SET_CONTENT(sim_cnt, env, sim_ext);
+ }
+ else if(AXIS2_STRCMP(localname, "annotation") == 0)
+ {
+ void *annotation = NULL;
+ annotation = handle_annotation_with_element(builder, env, node1);
+ AXIS2_XML_SCHEMA_ANNOTATED_SET_ANNOTATION(sim_cnt, env, annotation);
+ }
+
+ ele1 = axis2_om_util_get_next_sibling_element_with_uri(node1, env,
+ AXIS2_XML_SCHEMA_NS, &node1);
+ }
+ return sim_cnt;
+}
static axis2_xml_schema_complex_content_t*
handle_complex_content(
axis2_xml_schema_builder_t *builder,
axis2_env_t **env,
axis2_om_node_t *complex_node,
- axis2_om_node_t *schema_node){}
+ axis2_om_node_t *schema_node)
+{
+ void *cmp_cnt = NULL;
+ axis2_om_element_t *cmp_cnt_ele = NULL;
+
+ axis2_om_element_t *ele1 = NULL;
+ axis2_om_node_t *node1 = NULL;
+
+ cmp_cnt = axis2_xml_schema_complex_content_create(env);
+
+ cmp_cnt_ele = (axis2_om_element_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(complex_node, env);
+
+ ele1 = axis2_om_util_get_first_child_element_with_uri(complex_node , env,
+ AXIS2_XML_SCHEMA_NS, &node1);
+
+ while(NULL != ele1)
+ {
+ axis2_char_t *localname = NULL;
+ localname = AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1, env);
+
+ if(AXIS2_STRCMP(localname, "restriction") == 0)
+ {
+ void *cmp_res = NULL;
+
+ cmp_res = handle_complex_content_restriction(builder, env,
+ node1, schema_node);
+
+ AXIS2_XML_SCHEMA_COMPLEX_CONTENT_SET_CONTENT(cmp_cnt, env, cmp_res);
+ }
+ else if(AXIS2_STRCMP(localname, "extension") == 0)
+ {
+ void *cmp_ext = NULL;
+
+ cmp_ext = handle_complex_content_extension(builder, env,
+ node1, schema_node);
+
+ AXIS2_XML_SCHEMA_COMPLEX_CONTENT_SET_CONTENT(cmp_cnt, env, cmp_ext);
+ }
+ else if(AXIS2_STRCMP(localname, "annotation") == 0)
+ {
+ void *annotation = NULL;
+ annotation = handle_annotation_with_element(builder, env, node1);
+ AXIS2_XML_SCHEMA_ANNOTATED_SET_ANNOTATION(cmp_cnt, env, annotation);
+ }
+
+ ele1 = axis2_om_util_get_next_sibling_element_with_uri(node1, env,
+ AXIS2_XML_SCHEMA_NS, &node1);
+ }
+ return cmp_cnt;
+}
static axis2_xml_schema_simple_content_restriction_t*
handle_simple_content_restriction(
@@ -1013,9 +1231,9 @@
axis2_om_node_t *res_node,
axis2_om_node_t *schema_node)
{
- void *cmp_cnt_ext = NULL;
+ void *sim_cnt_res = NULL;
- axis2_om_element_t *ext_ele = NULL;
+ axis2_om_element_t *res_ele = NULL;
axis2_char_t *attr_value = NULL;
axis2_om_element_t *ele1 = NULL;
@@ -1023,12 +1241,14 @@
axis2_xml_schema_builder_impl_t *builder_impl = NULL;
- ext_ele = (axis2_om_element_t*)
+ res_ele = (axis2_om_element_t*)
AXIS2_OM_NODE_GET_DATA_ELEMENT(res_node, env);
+ sim_cnt_res = axis2_xml_schema_simple_content_restriction_create(env);
+
builder_impl = AXIS2_INTF_TO_IMPL(builder);
- attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(ext_ele, env, "base");
+ attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(res_ele, env, "base");
if(NULL != attr_value)
{
axis2_char_t *ns_from_ele = "";
@@ -1062,48 +1282,73 @@
qn = axis2_qname_create(env, name, result, NULL);
- AXIS2_XML_SCHEMA_SIMPLE_CONTENT_EXTENSION_SET_BASE_TYPE_NAME(cmp_cnt_ext, env, qn);
-
+ AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_BASE_TYPE_NAME(sim_cnt_res, env, qn);
+ attr_value = NULL;
+ }
+
+ attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(res_ele, env, "id");
+ if(NULL != attr_value)
+ {
+ AXIS2_XML_SCHEMA_ANNOTATED_SET_ID(sim_cnt_res, env, attr_value);
}
-
ele1 = axis2_om_util_get_first_child_element_with_uri(res_node, env, AXIS2_XML_SCHEMA_NS, &node1);
if(NULL != ele1)
{
axis2_char_t *localname = NULL;
localname = AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1, env);
-
if(AXIS2_STRCMP(localname, "attribute") == 0)
{
void *attribute = NULL;
axis2_xml_schema_obj_collection_t *attributes = NULL;
attribute = handle_attribute(builder, env, node1, schema_node);
- attributes = AXIS2_XML_SCHEMA_SIMPLE_CONTENT_EXTENSION_GET_ATTRIBUTES(cmp_cnt_ext, env);
+ attributes = AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_GET_ATTRIBUTES(sim_cnt_res, env);
AXIS2_XML_SCHEMA_OBJ_COLLECTION_ADD(attributes, env, attribute);
}
-
else if(AXIS2_STRCMP(localname, "attributeGroup") == 0)
{
void *attr_grp_ref = NULL;
axis2_xml_schema_obj_collection_t *attributes = NULL;
attr_grp_ref = handle_attribute_group_ref(builder, env, node1, schema_node);
- attributes = AXIS2_XML_SCHEMA_SIMPLE_CONTENT_EXTENSION_GET_ATTRIBUTES(cmp_cnt_ext, env);
+ attributes = AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_GET_ATTRIBUTES(sim_cnt_res, env);
AXIS2_XML_SCHEMA_OBJ_COLLECTION_ADD(attributes, env, attr_grp_ref);
}
- else if(AXIS2_STRCMP(localname, "anyAttribute") == 0)
+ else if(AXIS2_STRCMP(localname, "simpleType") == 0)
{
- void *any_attr = NULL;
- any_attr = handle_any_attribute(builder, env, node1, schema_node);
- AXIS2_XML_SCHEMA_SIMPLE_CONTENT_EXTENSION_SET_ANY_ATTRIBUTE(cmp_cnt_ext, env, any_attr);
+ void *simple_type = NULL;
+ simple_type = handle_simple_type(builder, env, node1, schema_node);
+ AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_SET_BASE_TYPE(sim_cnt_res, env, simple_type);
}
else if(AXIS2_STRCMP(localname, "annotation") == 0)
{
void *annotation = NULL;
annotation = handle_annotation_with_element(builder, env, node1);
- AXIS2_XML_SCHEMA_ANNOTATED_SET_ANNOTATION(cmp_cnt_ext, env, annotation);
+ AXIS2_XML_SCHEMA_ANNOTATED_SET_ANNOTATION(sim_cnt_res, env, annotation);
+ }
+ else
+ {
+ void *facet = NULL;
+ axis2_xml_schema_obj_collection_t *facets = NULL;
+ axis2_om_element_t *child_ele = NULL;
+ axis2_om_node_t *child_node = NULL;
+ facet = axis2_xml_schema_facet_construct(env, node1);
+
+ child_ele = axis2_om_util_get_first_child_element_with_uri_localname(ele1, env,
+ node1, "annotation", AXIS2_XML_SCHEMA_NS, &child_node);
+ while(NULL != child_ele)
+ {
+ void *annotation = NULL;
+ annotation = handle_annotation_with_element(builder, env, child_node);
+ AXIS2_XML_SCHEMA_ANNOTATED_SET_ANNOTATION(facet, env, annotation);
+ child_ele = axis2_om_util_get_next_sibling_element_with_uri_localname(child_ele,
+ env, child_node, "annotation", AXIS2_XML_SCHEMA_NS, &child_node);
+ }
+
+ facets = AXIS2_XML_SCHEMA_SIMPLE_CONTENT_RESTRICTION_GET_FACETS(sim_cnt_res, env);
+ AXIS2_XML_SCHEMA_OBJ_COLLECTION_ADD(facets, env, facet);
}
}
- return cmp_cnt_ext;
+ return sim_cnt_res;
}
@@ -1127,6 +1372,8 @@
ext_ele = (axis2_om_element_t*)
AXIS2_OM_NODE_GET_DATA_ELEMENT(ext_node, env);
+ sim_cnt_ext = axis2_xml_schema_simple_content_extension_create(env);
+
builder_impl = AXIS2_INTF_TO_IMPL(builder);
attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(ext_ele, env, "base");
@@ -1227,6 +1474,8 @@
res_ele = (axis2_om_element_t*)
AXIS2_OM_NODE_GET_DATA_ELEMENT(res_node, env);
+ cmp_cnt_res = axis2_xml_schema_complex_content_create(env);
+
builder_impl = AXIS2_INTF_TO_IMPL(builder);
attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(res_ele, env, "base");
@@ -1342,6 +1591,8 @@
ext_ele = (axis2_om_element_t*)
AXIS2_OM_NODE_GET_DATA_ELEMENT(ext_node, env);
+
+ cmp_cnt_ext = axis2_xml_schema_complex_content_extension_create(env);
builder_impl = AXIS2_INTF_TO_IMPL(builder);
Modified: webservices/axis2/trunk/c/xml_schema/xml_schema_facet.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/xml_schema_facet.c?rev=409314&r1=409313&r2=409314&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xml_schema/xml_schema_facet.c (original)
+++ webservices/axis2/trunk/c/xml_schema/xml_schema_facet.c Wed May 24 23:50:25 2006
@@ -324,10 +324,86 @@
axis2_om_node_t *node)
{
axis2_om_element_t *om_ele = NULL;
+ axis2_char_t *localname = NULL;
+ axis2_char_t *attr_value = NULL;
+ axis2_bool_t is_fixed = AXIS2_FALSE;
+ axis2_char_t *value = NULL;
+
+ void *facet = NULL;
+ int facet_type;
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, node, NULL);
- /** TODO */
+ if(AXIS2_OM_NODE_GET_NODE_TYPE(node, env) == AXIS2_OM_ELEMENT)
+ return NULL;
+ om_ele = AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
+ localname = AXIS2_OM_ELEMENT_GET_LOCALNAME(om_ele, env);
+
+ if(AXIS2_STRCMP(localname,"enumeration") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_ENUMARATION_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"maxExclusive") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_MAX_EXCLUSIVE_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"maxInclusive") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_MAX_INCLUSIVE_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"minExclusive") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_MIN_EXCLUSIVE_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"maxInclusive") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_MIN_INCLUSIVE_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"pattern") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_PATTERN_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"whiteSpace") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_WHITE_SPACE_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"fractionDigits") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_FRACTION_DIGITS_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"length") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_LENGTH_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"maxLength") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_MAX_LENGTH_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"minLength") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_MIN_LENGTH_FACET;
+ }
+ else if(AXIS2_STRCMP(localname,"totalDigits") == 0)
+ {
+ facet_type = AXIS2_XML_SCHEMA_TATAL_DIGITS_FACET;
+ }
+ else
+ return NULL;
+
+ attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(om_ele, env, "fixed");
+ if(NULL != attr_value && AXIS2_STRCMP(attr_value, "fixed") == 0)
+ is_fixed = AXIS2_TRUE;
+
+ attr_value = NULL;
+ attr_value = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(om_ele, env, "value");
+ if(NULL != attr_value)
+ value = attr_value;
+ else
+ return NULL;
+
+ facet = axis2_xml_schema_facet_create(env, value, is_fixed, facet_type);
+ if(NULL != facet)
+ return facet;
return NULL;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org