annotate GEMBASSY-1.0.3/gsoap/wsdl/schema.cpp @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2 schema.cpp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4 XSD binding schema implementation
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7 gSOAP XML Web services tools
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8 Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9 This software is released under one of the following licenses:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10 GPL or Genivia's license for commercial use.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
12 GPL license.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
13
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
14 This program is free software; you can redistribute it and/or modify it under
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
15 the terms of the GNU General Public License as published by the Free Software
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
16 Foundation; either version 2 of the License, or (at your option) any later
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
17 version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
18
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
19 This program is distributed in the hope that it will be useful, but WITHOUT ANY
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
20 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
21 PARTICULAR PURPOSE. See the GNU General Public License for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
22
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
23 You should have received a copy of the GNU General Public License along with
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
24 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
25 Place, Suite 330, Boston, MA 02111-1307 USA
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
26
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
27 Author contact information:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
28 engelen@genivia.com / engelen@acm.org
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
29 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
30 A commercial use license is available from Genivia, Inc., contact@genivia.com
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
31 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
33 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
34
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
35 #include "wsdlH.h" // cannot include "schemaH.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
36 #include "includes.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
37
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
38 extern struct Namespace namespaces[];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
39
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
40 extern "C" {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
41 extern int warn_ignore(struct soap*, const char*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
42 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
43
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
44 extern const char *qname_token(const char*, const char*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
45 extern int is_builtin_qname(const char*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
46
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
47 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
48 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
49 // schema
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
50 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
51 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
52
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
53 xs__schema::xs__schema()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
54 { soap = soap_new1(SOAP_XML_TREE | SOAP_C_UTFSTRING);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
55 #ifdef HTTPDA_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
56 soap_register_plugin(soap, http_da);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
57 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
58 #ifdef WITH_OPENSSL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
59 soap_ssl_client_context(soap, SOAP_SSL_NO_AUTHENTICATION, NULL, NULL, NULL, NULL, NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
60 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
61 soap_set_namespaces(soap, namespaces);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
62 soap_default(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
63 soap->fignore = warn_ignore;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
64 soap->encodingStyle = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
65 soap->proxy_host = proxy_host;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
66 soap->proxy_port = proxy_port;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
67 soap->proxy_userid = proxy_userid;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
68 soap->proxy_passwd = proxy_passwd;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
69 targetNamespace = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
70 version = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
71 updated = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
72 location = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
73 redirs = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
74 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
75
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
76 xs__schema::xs__schema(struct soap *copy)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
77 { soap = soap_copy(copy);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
78 soap->socket = SOAP_INVALID_SOCKET;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
79 soap->recvfd = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
80 soap->sendfd = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
81 soap_default(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
82 soap->fignore = warn_ignore;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
83 soap->encodingStyle = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
84 targetNamespace = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
85 version = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
86 updated = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
87 location = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
88 redirs = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
89 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
90
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
91 xs__schema::xs__schema(struct soap *copy, const char *cwd, const char *loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
92 { soap = soap_copy(copy);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
93 soap->socket = SOAP_INVALID_SOCKET;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
94 soap->recvfd = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
95 soap->sendfd = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
96 /* no longer required, since we keep the host name:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
97 strcpy(soap->host, copy->host);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
98 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
99 soap_default(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
100 soap->fignore = warn_ignore;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
101 soap->encodingStyle = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
102 targetNamespace = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
103 version = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
104 updated = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
105 location = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
106 redirs = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
107 read(cwd, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
108 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
109
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
110 xs__schema::~xs__schema()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
111 { }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
112
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
113 int xs__schema::get(struct soap *soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
114 { return preprocess();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
115 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
116
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
117 int xs__schema::preprocess()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
118 { // process xs:include recursively
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
119 // NOTE: includes are context sensitive (take context info), so keep including
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
120 for (vector<xs__include>::iterator in = include.begin(); in != include.end(); ++in)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
121 { (*in).preprocess(*this); // read schema and recurse over <include>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
122 if ((*in).schemaPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
123 insert(*(*in).schemaPtr());
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
124 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
125 for (vector<xs__redefine>::iterator re = redefine.begin(); re != redefine.end(); ++re)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
126 { (*re).preprocess(*this); // read schema and recurse over <redefine>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
127 if ((*re).schemaPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
128 insert(*(*re).schemaPtr());
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
129 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
130 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
131 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
132
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
133 int xs__schema::insert(xs__schema& schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
134 { bool found;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
135 if (targetNamespace && schema.targetNamespace && strcmp(targetNamespace, schema.targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
136 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
137 fprintf(stderr, "Warning: attempt to include schema with mismatching targetNamespace '%s' in schema '%s'\n", schema.targetNamespace, targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
138 if (elementFormDefault != schema.elementFormDefault)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
139 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
140 fprintf(stderr, "Warning: attempt to include schema with mismatching elementFormDefault in schema '%s'\n", targetNamespace?targetNamespace:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
141 if (attributeFormDefault != schema.attributeFormDefault)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
142 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
143 fprintf(stderr, "Warning: attempt to include schema with mismatching attributeFormDefault in schema '%s'\n", targetNamespace?targetNamespace:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
144 // insert imports, but only add imports with new namespace
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
145 for (vector<xs__import>::const_iterator im = schema.import.begin(); im != schema.import.end(); ++im)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
146 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
147 if ((*im).namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
148 { for (vector<xs__import>::const_iterator i = import.begin(); i != import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
149 { if ((*i).namespace_ && !strcmp((*im).namespace_, (*i).namespace_))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
150 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
151 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
152 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
153 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
154 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
155 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
156 import.push_back(*im);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
157 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
158 // insert attributes, but only add attributes with new name (limited conflict check)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
159 for (vector<xs__attribute>::const_iterator at = schema.attribute.begin(); at != schema.attribute.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
160 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
161 if ((*at).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
162 { for (vector<xs__attribute>::const_iterator a = attribute.begin(); a != attribute.end(); ++a)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
163 { if ((*a).name && !strcmp((*at).name, (*a).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
164 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
165 if ((*at).type && (*a).type && strcmp((*at).type, (*a).type))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
166 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
167 fprintf(stderr, "Warning: attempt to redefine attribute '%s' with type '%s' in schema '%s'\n", (*at).name, (*at).type, targetNamespace?targetNamespace:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
168 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
169 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
170 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
171 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
172 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
173 { attribute.push_back(*at);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
174 attribute.back().schemaPtr(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
175 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
176 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
177 // insert elements, but only add elements with new name (limited conflict check)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
178 for (vector<xs__element>::const_iterator el = schema.element.begin(); el != schema.element.end(); ++el)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
179 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
180 if ((*el).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
181 { for (vector<xs__element>::const_iterator e = element.begin(); e != element.end(); ++e)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
182 { if ((*e).name && !strcmp((*el).name, (*e).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
183 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
184 if ((*el).type && (*e).type && strcmp((*el).type, (*e).type))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
185 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
186 fprintf(stderr, "Warning: attempt to redefine element '%s' with type '%s' in schema '%s'\n", (*el).name, (*el).type, targetNamespace?targetNamespace:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
187 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
188 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
189 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
190 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
191 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
192 { element.push_back(*el);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
193 element.back().schemaPtr(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
194 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
195 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
196 // insert groups, but only add groups with new name (no conflict check)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
197 for (vector<xs__group>::const_iterator gp = schema.group.begin(); gp != schema.group.end(); ++gp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
198 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
199 if ((*gp).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
200 { for (vector<xs__group>::const_iterator g = group.begin(); g != group.end(); ++g)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
201 { if ((*g).name && !strcmp((*gp).name, (*g).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
202 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
203 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
204 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
205 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
206 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
207 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
208 { group.push_back(*gp);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
209 group.back().schemaPtr(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
210 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
211 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
212 // insert attributeGroups, but only add attributeGroups with new name (no conflict check)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
213 for (vector<xs__attributeGroup>::const_iterator ag = schema.attributeGroup.begin(); ag != schema.attributeGroup.end(); ++ag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
214 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
215 if ((*ag).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
216 { for (vector<xs__attributeGroup>::const_iterator g = attributeGroup.begin(); g != attributeGroup.end(); ++g)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
217 { if ((*g).name && !strcmp((*ag).name, (*g).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
218 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
219 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
220 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
221 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
222 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
223 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
224 { attributeGroup.push_back(*ag);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
225 attributeGroup.back().schemaPtr(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
226 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
227 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
228 // insert simpleTypes, but only add simpleTypes with new name (no conflict check)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
229 for (vector<xs__simpleType>::const_iterator st = schema.simpleType.begin(); st != schema.simpleType.end(); ++st)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
230 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
231 if ((*st).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
232 { for (vector<xs__simpleType>::const_iterator s = simpleType.begin(); s != simpleType.end(); ++s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
233 { if ((*s).name && !strcmp((*st).name, (*s).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
234 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
235 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
236 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
237 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
238 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
239 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
240 { simpleType.push_back(*st);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
241 simpleType.back().schemaPtr(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
242 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
243 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
244 // insert complexTypes, but only add complexTypes with new name (no conflict check)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
245 for (vector<xs__complexType>::const_iterator ct = schema.complexType.begin(); ct != schema.complexType.end(); ++ct)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
246 { found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
247 if ((*ct).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
248 { for (vector<xs__complexType>::const_iterator c = complexType.begin(); c != complexType.end(); ++c)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
249 { if ((*c).name && !strcmp((*ct).name, (*c).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
250 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
251 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
252 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
253 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
254 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
255 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
256 { complexType.push_back(*ct);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
257 complexType.back().schemaPtr(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
258 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
259 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
260 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
261 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
262
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
263 int xs__schema::traverse()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
264 { if (updated)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
265 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
266 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
267 cerr << " Analyzing schema '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
268 updated = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
269 if (!targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
270 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
271 fprintf(stderr, "Warning: Schema has no targetNamespace\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
272 targetNamespace = soap_strdup(soap, "");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
273 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
274 else if (exturis.find(targetNamespace) != exturis.end())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
275 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
276 fprintf(stderr, "Warning: Built-in schema '%s' content encountered\n", targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
277 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
278 // process import
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
279 for (vector<xs__import>::iterator im = import.begin(); im != import.end(); ++im)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
280 (*im).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
281 // process attributes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
282 for (vector<xs__attribute>::iterator at = attribute.begin(); at != attribute.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
283 (*at).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
284 // process elements
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
285 for (vector<xs__element>::iterator el = element.begin(); el != element.end();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
286 ++el)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
287 (*el).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
288 // process simpleTypes, check conflicts with complexTypes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
289 for (vector<xs__simpleType>::iterator st = simpleType.begin(); st != simpleType.end(); ++st)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
290 { (*st).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
291 if ((*st).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
292 { for (vector<xs__complexType>::iterator ct = complexType.begin(); ct != complexType.end(); ++ct)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
293 if ((*ct).name && !strcmp((*st).name, (*ct).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
294 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
295 fprintf(stderr, "Warning: top-level simpleType name and complexType name '%s' clash in schema '%s'\n", (*st).name, targetNamespace?targetNamespace:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
296 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
297 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
298 // process complexTypes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
299 for (vector<xs__complexType>::iterator ct = complexType.begin(); ct != complexType.end(); ++ct)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
300 (*ct).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
301 // process groups
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
302 for (vector<xs__group>::iterator gp = group.begin(); gp != group.end(); ++gp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
303 (*gp).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
304 // process attributeGroups
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
305 for (vector<xs__attributeGroup>::iterator ag = attributeGroup.begin(); ag != attributeGroup.end(); ++ag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
306 (*ag).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
307 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
308 cerr << " End of schema '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
309 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
310 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
311
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
312 int xs__schema::read(const char *cwd, const char *loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
313 { const char *cwd_temp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
314 if (!cwd)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
315 cwd = cwd_path;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
316 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
317 fprintf(stderr, "\nOpening schema '%s' from '%s'\n", loc?loc:"", cwd?cwd:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
318 if (loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
319 { if (soap->recvfd > 2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
320 { soap_end_recv(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
321 close(soap->recvfd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
322 soap->recvfd = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
323 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
324 else if (soap_valid_socket(soap->socket))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
325 { soap_end_recv(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
326 soap_closesock(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
327 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
328 #ifdef WITH_OPENSSL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
329 if (!strncmp(loc, "http://", 7) || !strncmp(loc, "https://", 8))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
330 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
331 if (!strncmp(loc, "https://", 8))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
332 { fprintf(stderr, "\nCannot connect to https site: no SSL support, please rebuild with SSL (default) or download the files and rerun wsdl2h\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
333 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
334 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
335 else if (!strncmp(loc, "http://", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
336 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
337 { fprintf(stderr, "\nConnecting to '%s' to retrieve schema...\n", loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
338 location = soap_strdup(soap, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
339 if (soap_connect_command(soap, SOAP_GET, location, NULL))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
340 { fprintf(stderr, "\nConnection failed\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
341 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
342 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
343 fprintf(stderr, "Connected, receiving...\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
344 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
345 else if (cwd && (!strncmp(cwd, "http://", 7) || !strncmp(cwd, "https://", 8)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
346 { char *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
347 location = (char*)soap_malloc(soap, strlen(cwd) + strlen(loc) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
348 strcpy(location, cwd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
349 s = strrchr(location, '/');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
350 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
351 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
352 strcat(location, "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
353 strcat(location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
354 fprintf(stderr, "\nConnecting to '%s' to retrieve relative path '%s' schema...\n", location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
355 if (soap_connect_command(soap, SOAP_GET, location, NULL))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
356 { fprintf(stderr, "\nConnection failed\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
357 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
358 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
359 fprintf(stderr, "Connected, receiving...\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
360 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
361 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
362 { soap->recvfd = open(loc, O_RDONLY, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
363 if (soap->recvfd < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
364 { if (cwd)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
365 { char *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
366 location = (char*)soap_malloc(soap, strlen(cwd) + strlen(loc) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
367 strcpy(location, cwd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
368 s = strrchr(location, '/');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
369 #ifdef WIN32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
370 if (!s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
371 s = strrchr(location, '\\');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
372 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
373 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
374 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
375 strcat(location, "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
376 strcat(location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
377 if (!strncmp(location, "file://", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
378 location += 7;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
379 soap->recvfd = open(location, O_RDONLY, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
380 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
381 if (soap->recvfd < 0 && import_path)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
382 { location = (char*)soap_malloc(soap, strlen(import_path) + strlen(loc) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
383 strcpy(location, import_path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
384 strcat(location, "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
385 strcat(location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
386 if (!strncmp(location, "file://", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
387 location += 7;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
388 soap->recvfd = open(location, O_RDONLY, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
389 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
390 if (soap->recvfd < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
391 { fprintf(stderr, "\nCannot open '%s' to retrieve schema\n", loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
392 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
393 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
394 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
395 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
396 location = soap_strdup(soap, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
397 fprintf(stderr, "\nReading schema file '%s'...\n", location);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
398 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
399 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
400 cwd_temp = cwd_path;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
401 cwd_path = location;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
402 if (!soap_begin_recv(soap))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
403 this->soap_in(soap, "xs:schema", NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
404 if ((soap->error >= 301 && soap->error <= 303) || soap->error == 307) // HTTP redirect, socket was closed
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
405 { int r = SOAP_ERR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
406 fprintf(stderr, "Redirected to '%s'...\n", soap->endpoint);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
407 if (redirs++ < 10)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
408 r = read(cwd, soap->endpoint);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
409 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
410 fprintf(stderr, "\nMax redirects exceeded\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
411 redirs--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
412 return r;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
413 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
414 else if (soap->error == 401)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
415 { int r = SOAP_ERR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
416 fprintf(stderr, "Authenticating to '%s' realm '%s'...\n", loc, soap->authrealm);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
417 if (auth_userid && auth_passwd && redirs++ < 1)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
418 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
419 #ifdef HTTPDA_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
420 struct http_da_info info;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
421 http_da_save(soap, &info, soap->authrealm, auth_userid, auth_passwd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
422 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
423 soap->userid = auth_userid;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
424 soap->passwd = auth_passwd;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
425 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
426 r = read(cwd, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
427 #ifdef HTTPDA_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
428 http_da_release(soap, &info);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
429 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
430 redirs--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
431 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
432 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
433 fprintf(stderr, "Authentication failed, use option -r:uid:pwd and (re)build with OpenSSL to enable digest authentication\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
434 return r;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
435 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
436 if (soap->error)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
437 { fprintf(stderr, "\nAn error occurred while parsing schema from '%s'\n", loc?loc:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
438 soap_print_fault(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
439 if (soap->error < 200)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
440 soap_print_fault_location(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
441 fprintf(stderr, "\nIf this schema namespace is considered \"built-in\", then add\n namespaceprefix = <namespaceURI>\nto typemap.dat.\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
442 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
443 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
444 fprintf(stderr, "Done reading '%s'\n", loc?loc:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
445 soap_end_recv(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
446 if (soap->recvfd > 2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
447 { close(soap->recvfd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
448 soap->recvfd = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
449 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
450 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
451 soap_closesock(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
452 cwd_path = cwd_temp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
453 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
454 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
455
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
456 void xs__schema::sourceLocation(const char *loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
457 { location = soap_strdup(soap, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
458 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
459
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
460 const char *xs__schema::sourceLocation()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
461 { return location;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
462 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
463
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
464 int xs__schema::error()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
465 { return soap->error;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
466 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
467
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
468 void xs__schema::print_fault()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
469 { soap_print_fault(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
470 if (soap->error < 200)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
471 soap_print_fault_location(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
472 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
473
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
474 void xs__schema::builtinType(const char *type)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
475 { builtinTypeSet.insert(type);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
476 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
477
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
478 void xs__schema::builtinElement(const char *element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
479 { builtinElementSet.insert(element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
480 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
481
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
482 void xs__schema::builtinAttribute(const char *attribute)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
483 { builtinAttributeSet.insert(attribute);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
484 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
485
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
486 const SetOfString& xs__schema::builtinTypes() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
487 { return builtinTypeSet;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
488 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
489
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
490 const SetOfString& xs__schema::builtinElements() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
491 { return builtinElementSet;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
492 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
493
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
494 const SetOfString& xs__schema::builtinAttributes() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
495 { return builtinAttributeSet;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
496 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
497
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
498 bool xs__schema::empty() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
499 { return include.empty() && redefine.empty() && import.empty() && attribute.empty() && element.empty() && group.empty() && attributeGroup.empty() && simpleType.empty() && complexType.empty();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
500 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
501
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
502 xs__include::xs__include()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
503 { schemaLocation = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
504 schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
505 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
506
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
507 int xs__include::preprocess(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
508 { if (!schemaRef && schemaLocation)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
509 { // only read from include locations not read already, uses static std::map
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
510 static map<const char*, xs__schema*, ltstr> included;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
511 map<const char*, xs__schema*, ltstr>::iterator i = included.end();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
512 if (schema.targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
513 for (i = included.begin(); i != included.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
514 if ((*i).second->targetNamespace
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
515 && !strcmp(schemaLocation, (*i).first)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
516 && !strcmp(schema.targetNamespace, (*i).second->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
517 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
518 if (i == included.end())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
519 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
520 cerr << "Preprocessing schema include '" << (schemaLocation?schemaLocation:"") << "' into schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
521 included[schemaLocation] = schemaRef = new xs__schema(schema.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
522 schemaRef->read(schema.sourceLocation(), schemaLocation);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
523 schemaRef->targetNamespace = schema.targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
524 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
525 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
526 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
527 cerr << "Schema '" << (schemaLocation?schemaLocation:"") << "' already included into schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
528 schemaRef = (*i).second;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
529 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
530 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
531 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
532 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
533
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
534 int xs__include::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
535 { return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
536 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
537
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
538 void xs__include::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
539 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
540 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
541
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
542 xs__schema *xs__include::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
543 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
544 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
545
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
546 xs__redefine::xs__redefine()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
547 { schemaLocation = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
548 schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
549 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
550
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
551 int xs__redefine::preprocess(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
552 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
553 cerr << "Preprocessing schema redefine '" << (schemaLocation?schemaLocation:"") << "' into schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
554 if (!schemaRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
555 { if (schemaLocation)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
556 { schemaRef = new xs__schema(schema.soap, schema.sourceLocation(), schemaLocation);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
557 for (vector<xs__group>::iterator gp = schemaRef->group.begin(); gp != schemaRef->group.end(); ++gp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
558 { if ((*gp).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
559 { for (vector<xs__group>::const_iterator g = group.begin(); g != group.end(); ++g)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
560 { if ((*g).name && !strcmp((*gp).name, (*g).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
561 { *gp = *g;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
562 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
563 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
564 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
565 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
566 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
567 for (vector<xs__attributeGroup>::iterator ag = schemaRef->attributeGroup.begin(); ag != schemaRef->attributeGroup.end(); ++ag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
568 { if ((*ag).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
569 { for (vector<xs__attributeGroup>::const_iterator g = attributeGroup.begin(); g != attributeGroup.end(); ++g)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
570 { if ((*g).name && !strcmp((*ag).name, (*g).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
571 { *ag = *g;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
572 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
573 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
574 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
575 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
576 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
577 for (vector<xs__simpleType>::iterator st = schemaRef->simpleType.begin(); st != schemaRef->simpleType.end(); ++st)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
578 { if ((*st).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
579 { for (vector<xs__simpleType>::const_iterator s = simpleType.begin(); s != simpleType.end(); ++s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
580 { if ((*s).name && !strcmp((*st).name, (*s).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
581 { *st = *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
582 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
583 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
584 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
585 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
586 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
587 for (vector<xs__complexType>::iterator ct = schemaRef->complexType.begin(); ct != schemaRef->complexType.end(); ++ct)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
588 { if ((*ct).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
589 { for (vector<xs__complexType>::const_iterator c = complexType.begin(); c != complexType.end(); ++c)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
590 { if ((*c).name && !strcmp((*ct).name, (*c).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
591 { *ct = *c;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
592 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
593 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
594 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
595 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
596 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
597 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
598 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
599 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
600 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
601
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
602 int xs__redefine::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
603 { return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
604 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
605
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
606 void xs__redefine::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
607 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
608 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
609
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
610 xs__schema *xs__redefine::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
611 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
612 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
613
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
614 xs__import::xs__import()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
615 { namespace_ = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
616 schemaLocation = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
617 schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
618 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
619
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
620 int xs__import::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
621 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
622 cerr << " Analyzing schema import '" << (namespace_?namespace_:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
623 if (!schemaRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
624 { bool found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
625 if (namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
626 { for (SetOfString::const_iterator i = exturis.begin(); i != exturis.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
627 { if (!soap_tag_cmp(namespace_, *i))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
628 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
629 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
630 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
631 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
632 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
633 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
634 fprintf(stderr, "Warning: no namespace in <import>\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
635 if (!found && !iflag) // don't import any of the schemas in the .nsmap table (or when -i option is used)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
636 { const char *s = schemaLocation;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
637 if (!s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
638 s = namespace_;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
639 // only read from import locations not read already, uses static std::map
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
640 static map<const char*, xs__schema*, ltstr> included;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
641 map<const char*, xs__schema*, ltstr>::iterator i = included.find(s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
642 if (i == included.end())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
643 { included[s] = schemaRef = new xs__schema(schema.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
644 schemaRef->read(schema.sourceLocation(), s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
645 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
646 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
647 schemaRef = (*i).second;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
648 if (schemaRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
649 { if (!schemaRef->targetNamespace || !*schemaRef->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
650 schemaRef->targetNamespace = namespace_;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
651 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
652 if (!namespace_ || strcmp(schemaRef->targetNamespace, namespace_))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
653 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
654 fprintf(stderr, "Warning: schema import '%s' with schema targetNamespace '%s' mismatch\n", namespace_?namespace_:"", schemaRef->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
655 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
656 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
657 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
658 if (schemaRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
659 schemaRef->traverse();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
660 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
661 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
662
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
663 void xs__import::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
664 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
665 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
666
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
667 xs__schema *xs__import::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
668 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
669 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
670
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
671 xs__attribute::xs__attribute()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
672 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
673 attributeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
674 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
675 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
676
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
677 int xs__attribute::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
678 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
679 cerr << " Analyzing schema attribute '" << (name?name:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
680 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
681 const char *token = qname_token(ref, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
682 attributeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
683 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
684 { for (vector<xs__attribute>::iterator i = schema.attribute.begin(); i != schema.attribute.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
685 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
686 { attributeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
687 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
688 cerr << " Found attribute '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
689 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
690 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
691 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
692 if (!attributeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
693 { for (vector<xs__import>::iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
694 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
695 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
696 { token = qname_token(ref, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
697 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
698 { for (vector<xs__attribute>::iterator j = s->attribute.begin(); j != s->attribute.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
699 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
700 { attributeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
701 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
702 cerr << " Found attribute '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
703 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
704 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
705 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
706 if (attributeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
707 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
708 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
709 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
710 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
711 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
712 if (simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
713 { simpleType->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
714 simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
715 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
716 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
717 { token = qname_token(type, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
718 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
719 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
720 { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
721 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
722 { simpleTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
723 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
724 cerr << " Found attribute '" << (name?name:"") << "' type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
725 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
726 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
727 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
728 if (!simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
729 { for (vector<xs__import>::iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
730 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
731 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
732 { token = qname_token(type, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
733 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
734 { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
735 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
736 { simpleTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
737 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
738 cerr << " Found attribute '" << (name?name:"") << "' type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
739 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
740 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
741 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
742 if (simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
743 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
744 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
745 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
746 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
747 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
748 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
749 if (!attributeRef && !simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
750 { if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
751 { if (is_builtin_qname(ref))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
752 schema.builtinAttribute(ref);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
753 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
754 cerr << "Warning: could not find attribute '" << (name?name:"") << "' ref '" << ref << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
755 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
756 else if (type)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
757 { if (is_builtin_qname(type))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
758 schema.builtinType(type);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
759 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
760 cerr << "Warning: could not find attribute '" << (name?name:"") << "' type '" << type << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
761 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
762 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
763 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
764 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
765
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
766 void xs__attribute::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
767 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
768 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
769
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
770 xs__schema* xs__attribute::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
771 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
772 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
773
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
774 void xs__attribute::attributePtr(xs__attribute *attribute)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
775 { attributeRef = attribute;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
776 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
777
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
778 void xs__attribute::simpleTypePtr(xs__simpleType *simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
779 { simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
780 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
781
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
782 xs__attribute *xs__attribute::attributePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
783 { return attributeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
784 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
785
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
786 xs__simpleType *xs__attribute::simpleTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
787 { return simpleTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
788 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
789
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
790 xs__element::xs__element()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
791 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
792 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
793 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
794 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
795 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
796
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
797 int xs__element::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
798 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
799 cerr << " Analyzing schema element '" << (name?name:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
800 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
801 const char *token = qname_token(ref, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
802 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
803 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
804 { for (vector<xs__element>::iterator i = schema.element.begin(); i != schema.element.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
805 { if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
806 { elementRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
807 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
808 cerr << " Found element '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
809 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
810 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
811 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
812 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
813 if (!elementRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
814 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
815 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
816 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
817 { token = qname_token(ref, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
818 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
819 { for (vector<xs__element>::iterator j = s->element.begin(); j != s->element.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
820 { if ((*j).name && !strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
821 { elementRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
822 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
823 cerr << " Found element '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
824 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
825 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
826 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
827 if (elementRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
828 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
829 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
830 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
831 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
832 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
833 if (simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
834 { simpleType->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
835 simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
836 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
837 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
838 { token = qname_token(type, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
839 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
840 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
841 { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
842 if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
843 { simpleTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
844 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
845 cerr << " Found element '" << (name?name:"") << "' simpleType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
846 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
847 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
848 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
849 if (!simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
850 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
851 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
852 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
853 { token = qname_token(type, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
854 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
855 { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
856 { if ((*j).name && !strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
857 { simpleTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
858 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
859 cerr << " Found element '" << (name?name:"") << "' simpleType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
860 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
861 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
862 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
863 if (simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
864 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
865 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
866 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
867 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
868 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
869 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
870 if (complexType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
871 { complexType->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
872 complexTypeRef = complexType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
873 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
874 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
875 { token = qname_token(type, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
876 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
877 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
878 { for (vector<xs__complexType>::iterator i = schema.complexType.begin(); i != schema.complexType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
879 if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
880 { complexTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
881 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
882 cerr << " Found element '" << (name?name:"") << "' complexType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
883 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
884 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
885 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
886 if (!complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
887 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
888 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
889 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
890 { token = qname_token(type, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
891 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
892 { for (vector<xs__complexType>::iterator j = s->complexType.begin(); j != s->complexType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
893 { if ((*j).name && !strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
894 { complexTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
895 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
896 cerr << " Found element '" << (name?name:"") << "' complexType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
897 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
898 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
899 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
900 if (complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
901 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
902 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
903 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
904 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
905 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
906 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
907 token = qname_token(substitutionGroup, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
908 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
909 { for (vector<xs__element>::iterator i = schema.element.begin(); i != schema.element.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
910 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
911 { (*i).substitutions.push_back(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
912 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
913 cerr << " Found substitutionGroup element '" << (name?name:"") << "' for abstract element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
914 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
915 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
916 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
917 for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
918 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
919 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
920 { token = qname_token(substitutionGroup, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
921 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
922 { for (vector<xs__element>::iterator j = s->element.begin(); j != s->element.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
923 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
924 { (*j).substitutions.push_back(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
925 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
926 cerr << " Found substitutionGroup element '" << (name?name:"") << "' for abstract element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
927 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
928 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
929 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
930 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
931 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
932 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
933 if (!elementRef && !simpleTypeRef && !complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
934 { if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
935 { if (is_builtin_qname(ref))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
936 schema.builtinElement(ref);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
937 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
938 cerr << "Warning: could not find element '" << (name?name:"") << "' ref '" << ref << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
939 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
940 else if (type)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
941 { if (is_builtin_qname(type))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
942 schema.builtinType(type);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
943 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
944 cerr << "Warning: could not find element '" << (name?name:"") << "' type '" << type << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
945 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
946 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
947 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
948 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
949
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
950 void xs__element::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
951 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
952 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
953
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
954 xs__schema* xs__element::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
955 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
956 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
957
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
958 void xs__element::elementPtr(xs__element *element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
959 { elementRef = element;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
960 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
961
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
962 void xs__element::simpleTypePtr(xs__simpleType *simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
963 { simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
964 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
965
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
966 void xs__element::complexTypePtr(xs__complexType *complexType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
967 { complexTypeRef = complexType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
968 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
969
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
970 xs__element *xs__element::elementPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
971 { return elementRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
972 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
973
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
974 const std::vector<xs__element*>* xs__element::substitutionsPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
975 { return &substitutions;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
976 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
977
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
978 xs__simpleType *xs__element::simpleTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
979 { return simpleTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
980 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
981
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
982 xs__complexType *xs__element::complexTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
983 { return complexTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
984 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
985
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
986 xs__simpleType::xs__simpleType()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
987 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
988 level = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
989 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
990
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
991 int xs__simpleType::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
992 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
993 cerr << " Analyzing schema simpleType '" << (name?name:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
994 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
995 if (list)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
996 list->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
997 else if (restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
998 restriction->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
999 else if (union_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1000 union_->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1001 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1002 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1003
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1004 void xs__simpleType::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1005 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1006 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1007
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1008 xs__schema *xs__simpleType::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1009 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1010 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1011
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1012 int xs__simpleType::baseLevel()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1013 { if (!level)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1014 { if (restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1015 { level = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1016 if (restriction->simpleTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1017 level = restriction->simpleTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1018 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1019 level = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1020 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1021 else if (list && list->restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1022 { level = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1023 if (list->restriction->simpleTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1024 level = list->restriction->simpleTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1025 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1026 level = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1027 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1028 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1029 level = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1030 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1031 else if (level < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1032 { cerr << "Error: cyclic simpleType restriction/extension base dependency in '" << (name?name:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1033 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1034 return level;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1035 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1036
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1037 xs__complexType::xs__complexType()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1038 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1039 level = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1040 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1041
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1042 int xs__complexType::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1043 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1044 cerr << " Analyzing schema complexType '" << (name?name:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1045 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1046 if (simpleContent)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1047 simpleContent->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1048 else if (complexContent)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1049 complexContent->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1050 else if (all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1051 all->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1052 else if (choice)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1053 choice->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1054 else if (sequence)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1055 sequence->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1056 else if (any)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1057 any->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1058 for (vector<xs__attribute>::iterator at = attribute.begin(); at != attribute.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1059 (*at).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1060 for (vector<xs__attributeGroup>::iterator ag = attributeGroup.begin(); ag != attributeGroup.end(); ++ag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1061 (*ag).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1062 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1063 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1064
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1065 void xs__complexType::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1066 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1067 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1068
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1069 xs__schema *xs__complexType::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1070 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1071 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1072
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1073 int xs__complexType::baseLevel()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1074 { if (!level)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1075 { if (simpleContent)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1076 { if (simpleContent->restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1077 { level = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1078 if (simpleContent->restriction->simpleTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1079 level = simpleContent->restriction->simpleTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1080 else if (simpleContent->restriction->complexTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1081 level = simpleContent->restriction->complexTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1082 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1083 level = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1084 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1085 else if (simpleContent->extension)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1086 { level = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1087 if (simpleContent->extension->simpleTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1088 level = simpleContent->extension->simpleTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1089 else if (simpleContent->extension->complexTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1090 level = simpleContent->extension->complexTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1091 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1092 level = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1093 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1094 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1095 else if (complexContent)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1096 { if (complexContent->restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1097 { level = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1098 if (complexContent->restriction->simpleTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1099 level = complexContent->restriction->simpleTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1100 else if (complexContent->restriction->complexTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1101 level = complexContent->restriction->complexTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1102 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1103 level = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1104 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1105 else if (complexContent->extension)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1106 { level = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1107 if (complexContent->extension->simpleTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1108 level = complexContent->extension->simpleTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1109 else if (complexContent->extension->complexTypePtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1110 level = complexContent->extension->complexTypePtr()->baseLevel() + 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1111 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1112 level = 2;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1113 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1114 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1115 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1116 level = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1117 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1118 else if (level < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1119 { cerr << "Error: cyclic complexType restriction/extension base dependency in '" << (name?name:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1120 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1121 return level;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1122 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1123
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1124 int xs__simpleContent::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1125 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1126 cerr << " Analyzing schema simpleContent" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1127 if (extension)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1128 extension->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1129 else if (restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1130 restriction->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1131 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1132 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1133
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1134 int xs__complexContent::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1135 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1136 cerr << " Analyzing schema complexContent" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1137 if (extension)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1138 extension->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1139 else if (restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1140 restriction->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1141 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1142 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1143
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1144 xs__extension::xs__extension()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1145 { simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1146 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1147 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1148
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1149 int xs__extension::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1150 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1151 cerr << " Analyzing schema extension '" << (base?base:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1152 if (group)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1153 group->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1154 else if (all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1155 all->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1156 else if (choice)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1157 choice->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1158 else if (sequence)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1159 sequence->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1160 for (vector<xs__attribute>::iterator at = attribute.begin(); at != attribute.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1161 (*at).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1162 for (vector<xs__attributeGroup>::iterator ag = attributeGroup.begin(); ag != attributeGroup.end(); ++ag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1163 (*ag).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1164 const char *token = qname_token(base, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1165 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1166 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1167 { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1168 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1169 { simpleTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1170 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1171 cerr << " Found extension base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1172 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1173 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1174 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1175 if (!simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1176 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1177 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1178 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1179 { token = qname_token(base, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1180 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1181 { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1182 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1183 { simpleTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1184 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1185 cerr << " Found extension base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1186 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1187 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1188 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1189 if (simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1190 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1191 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1192 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1193 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1194 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1195 token = qname_token(base, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1196 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1197 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1198 { for (vector<xs__complexType>::iterator i = schema.complexType.begin(); i != schema.complexType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1199 if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1200 { complexTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1201 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1202 cerr << " Found extension base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1203 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1204 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1205 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1206 if (!complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1207 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1208 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1209 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1210 { token = qname_token(base, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1211 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1212 { for (vector<xs__complexType>::iterator j = s->complexType.begin(); j != s->complexType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1213 { if ((*j).name && !strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1214 { complexTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1215 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1216 cerr << " Found extension base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1217 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1218 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1219 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1220 if (complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1221 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1222 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1223 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1224 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1225 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1226 if (!simpleTypeRef && !complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1227 { if (base)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1228 { if (is_builtin_qname(base))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1229 schema.builtinType(base);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1230 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1231 cerr << "Warning: could not find extension base type '" << base << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1232 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1233 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1234 cerr << "Extension has no base" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1235 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1236 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1237 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1238
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1239 void xs__extension::simpleTypePtr(xs__simpleType *simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1240 { simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1241 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1242
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1243 void xs__extension::complexTypePtr(xs__complexType *complexType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1244 { complexTypeRef = complexType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1245 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1246
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1247 xs__simpleType *xs__extension::simpleTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1248 { return simpleTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1249 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1250
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1251 xs__complexType *xs__extension::complexTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1252 { return complexTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1253 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1254
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1255 xs__restriction::xs__restriction()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1256 { simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1257 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1258 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1259
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1260 int xs__restriction::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1261 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1262 cerr << " Analyzing schema restriction '" << (base?base:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1263 if (simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1264 simpleType->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1265 if (attributeGroup)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1266 attributeGroup->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1267 if (group)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1268 group->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1269 else if (all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1270 all->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1271 else if (choice)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1272 choice->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1273 else if (sequence)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1274 sequence->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1275 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1276 { for (vector<xs__enumeration>::iterator en = enumeration.begin(); en != enumeration.end(); ++en)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1277 (*en).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1278 for (vector<xs__pattern>::iterator pn = pattern.begin(); pn != pattern.end(); ++pn)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1279 (*pn).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1280 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1281 for (vector<xs__attribute>::iterator at = attribute.begin(); at != attribute.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1282 (*at).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1283 const char *token = qname_token(base, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1284 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1285 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1286 { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1287 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1288 { simpleTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1289 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1290 cerr << " Found restriction base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1291 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1292 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1293 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1294 if (!simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1295 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1296 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1297 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1298 { token = qname_token(base, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1299 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1300 { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1301 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1302 { simpleTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1303 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1304 cerr << " Found restriction base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1305 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1306 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1307 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1308 if (simpleTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1309 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1310 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1311 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1312 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1313 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1314 token = qname_token(base, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1315 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1316 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1317 { for (vector<xs__complexType>::iterator i = schema.complexType.begin(); i != schema.complexType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1318 if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1319 { complexTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1320 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1321 cerr << " Found restriction base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1322 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1323 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1324 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1325 if (!complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1326 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1327 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1328 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1329 { token = qname_token(base, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1330 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1331 { for (vector<xs__complexType>::iterator j = s->complexType.begin(); j != s->complexType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1332 { if ((*j).name && !strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1333 { complexTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1334 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1335 cerr << " Found restriction base type '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1336 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1337 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1338 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1339 if (complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1340 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1341 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1342 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1343 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1344 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1345 if (!simpleTypeRef && !complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1346 { if (base)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1347 { if (is_builtin_qname(base))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1348 schema.builtinType(base);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1349 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1350 cerr << "Warning: could not find restriction base type '" << base << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1351 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1352 else if (!simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1353 cerr << "Restriction has no base" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1354 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1355 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1356 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1357
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1358 void xs__restriction::simpleTypePtr(xs__simpleType *simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1359 { simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1360 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1361
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1362 void xs__restriction::complexTypePtr(xs__complexType *complexType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1363 { complexTypeRef = complexType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1364 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1365
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1366 xs__simpleType *xs__restriction::simpleTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1367 { return simpleTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1368 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1369
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1370 xs__complexType *xs__restriction::complexTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1371 { return complexTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1372 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1373
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1374 xs__list::xs__list()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1375 { itemTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1376 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1377
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1378 int xs__list::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1379 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1380 cerr << " Analyzing schema list" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1381 if (restriction)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1382 restriction->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1383 for (vector<xs__simpleType>::iterator i = simpleType.begin(); i != simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1384 (*i).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1385 itemTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1386 const char *token = qname_token(itemType, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1387 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1388 { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1389 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1390 { itemTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1391 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1392 cerr << " Found list itemType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1393 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1394 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1395 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1396 if (!itemTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1397 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1398 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1399 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1400 { token = qname_token(itemType, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1401 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1402 { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1403 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1404 { itemTypeRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1405 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1406 cerr << " Found list itemType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1407 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1408 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1409 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1410 if (itemTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1411 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1412 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1413 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1414 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1415 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1416 if (itemType && !itemTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1417 { if (is_builtin_qname(itemType))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1418 schema.builtinType(itemType);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1419 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1420 cerr << "Warning: could not find list itemType '" << itemType << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1421 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1422 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1423 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1424
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1425 void xs__list::itemTypePtr(xs__simpleType *simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1426 { itemTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1427 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1428
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1429 xs__simpleType *xs__list::itemTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1430 { return itemTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1431 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1432
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1433 int xs__union::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1434 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1435 cerr << " Analyzing schema union" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1436 for (vector<xs__simpleType>::iterator i = simpleType.begin(); i != simpleType.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1437 (*i).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1438 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1439 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1440
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1441 int xs__all::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1442 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1443 cerr << " Analyzing schema all" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1444 for (vector<xs__element>::iterator i = element.begin(); i != element.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1445 (*i).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1446 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1447 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1448
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1449 int xs__contents::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1450 { switch (__union)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1451 { case SOAP_UNION_xs__union_content_element:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1452 if (__content.element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1453 __content.element->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1454 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1455 case SOAP_UNION_xs__union_content_group:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1456 if (__content.group)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1457 __content.group->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1458 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1459 case SOAP_UNION_xs__union_content_choice:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1460 if (__content.choice)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1461 __content.choice->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1462 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1463 case SOAP_UNION_xs__union_content_sequence:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1464 if (__content.sequence)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1465 __content.sequence->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1466 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1467 case SOAP_UNION_xs__union_content_any:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1468 if (__content.any)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1469 __content.any->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1470 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1471 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1472 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1473 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1474
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1475 xs__seqchoice::xs__seqchoice()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1476 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1477 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1478
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1479 int xs__seqchoice::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1480 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1481 cerr << " Analyzing schema sequence/choice" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1482 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1483 for (vector<xs__contents>::iterator c = __contents.begin(); c != __contents.end(); ++c)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1484 (*c).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1485 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1486 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1487
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1488 void xs__seqchoice::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1489 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1490 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1491
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1492 xs__schema *xs__seqchoice::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1493 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1494 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1495
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1496 xs__attributeGroup::xs__attributeGroup()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1497 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1498 attributeGroupRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1499 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1500
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1501 int xs__attributeGroup::traverse(xs__schema& schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1502 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1503 cerr << " Analyzing schema attributeGroup" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1504 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1505 for (vector<xs__attribute>::iterator at = attribute.begin(); at != attribute.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1506 (*at).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1507 for (vector<xs__attributeGroup>::iterator ag = attributeGroup.begin(); ag != attributeGroup.end(); ++ag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1508 (*ag).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1509 attributeGroupRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1510 if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1511 { const char *token = qname_token(ref, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1512 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1513 { for (vector<xs__attributeGroup>::iterator i = schema.attributeGroup.begin(); i != schema.attributeGroup.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1514 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1515 { attributeGroupRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1516 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1517 cerr << " Found attributeGroup '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1518 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1519 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1520 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1521 if (!attributeGroupRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1522 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1523 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1524 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1525 { token = qname_token(ref, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1526 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1527 { for (vector<xs__attributeGroup>::iterator j = s->attributeGroup.begin(); j != s->attributeGroup.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1528 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1529 { attributeGroupRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1530 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1531 cerr << " Found attribute Group '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1532 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1533 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1534 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1535 if (attributeGroupRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1536 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1537 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1538 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1539 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1540 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1541 if (!attributeGroupRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1542 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1543 cerr << "Warning: could not find attributeGroup '" << (name?name:"") << "' ref '" << (ref?ref:"") << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1544 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1545 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1546 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1547
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1548 void xs__attributeGroup::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1549 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1550 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1551
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1552 void xs__attributeGroup::attributeGroupPtr(xs__attributeGroup *attributeGroup)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1553 { attributeGroupRef = attributeGroup;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1554 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1555
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1556 xs__schema *xs__attributeGroup::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1557 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1558 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1559
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1560 xs__attributeGroup *xs__attributeGroup::attributeGroupPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1561 { return attributeGroupRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1562 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1563
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1564 int xs__any::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1565 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1566 cerr << " Analyzing schema any" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1567 for (vector<xs__element>::iterator i = element.begin(); i != element.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1568 (*i).traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1569 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1570 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1571
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1572 xs__group::xs__group()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1573 { schemaRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1574 groupRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1575 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1576
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1577 int xs__group::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1578 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1579 cerr << " Analyzing schema group" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1580 schemaRef = &schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1581 if (all)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1582 all->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1583 else if (choice)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1584 choice->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1585 else if (sequence)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1586 sequence->traverse(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1587 groupRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1588 if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1589 { const char *token = qname_token(ref, schema.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1590 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1591 { for (vector<xs__group>::iterator i = schema.group.begin(); i != schema.group.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1592 if (!strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1593 { groupRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1594 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1595 cerr << " Found group '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1596 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1597 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1598 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1599 if (!groupRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1600 { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1601 { xs__schema *s = (*i).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1602 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1603 { token = qname_token(ref, s->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1604 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1605 { for (vector<xs__group>::iterator j = s->group.begin(); j != s->group.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1606 { if (!strcmp((*j).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1607 { groupRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1608 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1609 cerr << " Found group '" << (name?name:"") << "' ref '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1610 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1611 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1612 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1613 if (groupRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1614 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1615 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1616 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1617 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1618 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1619 if (!groupRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1620 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1621 cerr << "Warning: could not find group '" << (name?name:"") << "' ref '" << (ref?ref:"") << "' in schema '" << (schema.targetNamespace?schema.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1622 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1623 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1624 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1625
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1626 void xs__group::schemaPtr(xs__schema *schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1627 { schemaRef = schema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1628 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1629
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1630 xs__schema* xs__group::schemaPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1631 { return schemaRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1632 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1633
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1634 void xs__group::groupPtr(xs__group *group)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1635 { groupRef = group;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1636 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1637
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1638 xs__group* xs__group::groupPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1639 { return groupRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1640 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1641
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1642 int xs__enumeration::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1643 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1644 cerr << " Analyzing schema enumeration '" << (value?value:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1645 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1646 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1647
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1648 int xs__pattern::traverse(xs__schema &schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1649 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1650 cerr << " Analyzing schema pattern" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1651 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1652 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1653
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1654 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1655 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1656 // I/O
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1657 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1658 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1659
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1660 ostream &operator<<(ostream &o, const xs__schema &e)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1661 { if (!e.soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1662 { struct soap soap;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1663 soap_init2(&soap, SOAP_IO_DEFAULT, SOAP_XML_TREE | SOAP_C_UTFSTRING);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1664 soap_set_namespaces(&soap, namespaces);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1665 e.soap_serialize(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1666 soap_begin_send(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1667 e.soap_out(&soap, "xs:schema", 0, NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1668 soap_end_send(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1669 soap_end(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1670 soap_done(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1671 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1672 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1673 { ostream *os = e.soap->os;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1674 e.soap->os = &o;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1675 e.soap_serialize(e.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1676 soap_begin_send(e.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1677 e.soap_out(e.soap, "xs:schema", 0, NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1678 soap_end_send(e.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1679 e.soap->os = os;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1680 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1681 return o;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1682 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1683
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1684 istream &operator>>(istream &i, xs__schema &e)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1685 { if (!e.soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1686 { e.soap = soap_new();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1687 soap_set_namespaces(e.soap, namespaces);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1688 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1689 istream *is = e.soap->is;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1690 e.soap->is = &i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1691 if (soap_begin_recv(e.soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1692 || !e.soap_in(e.soap, "xs:schema", NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1693 || soap_end_recv(e.soap))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1694 { // handle error? Note: e.soap->error is set and app should check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1695 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1696 e.soap->is = is;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1697 return i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1698 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1699