1 | /*
|
---|
2 | * Copyright 2003,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | // ---------------------------------------------------------------------------
|
---|
18 | // Includes
|
---|
19 | // ---------------------------------------------------------------------------
|
---|
20 | #include "PSVIWriterHandlers.hpp"
|
---|
21 | #include "PSVIUni.hpp"
|
---|
22 | #include <xercesc/util/XMLUni.hpp>
|
---|
23 | #include <xercesc/util/XMLUniDefs.hpp>
|
---|
24 | #include <xercesc/util/XMLString.hpp>
|
---|
25 | #include <xercesc/sax/SAXParseException.hpp>
|
---|
26 | #include <xercesc/sax/SAXException.hpp>
|
---|
27 | #include <xercesc/dom/DOMAttr.hpp>
|
---|
28 | #include <xercesc/dom/DOMDocument.hpp>
|
---|
29 | #include <xercesc/dom/DOMNode.hpp>
|
---|
30 | #include <xercesc/dom/DOMNodeList.hpp>
|
---|
31 | #include <xercesc/dom/DOMTypeInfo.hpp>
|
---|
32 | #include <xercesc/dom/DOMImplementationRegistry.hpp>
|
---|
33 | #include <xercesc/dom/DOMImplementation.hpp>
|
---|
34 | #include <xercesc/framework/psvi/XSValue.hpp>
|
---|
35 |
|
---|
36 | #include <string.h>
|
---|
37 | #include <stdio.h>
|
---|
38 |
|
---|
39 | XERCES_CPP_NAMESPACE_USE
|
---|
40 |
|
---|
41 | static const XMLCh fgSpace[] = { chSpace, chNull };
|
---|
42 | static const XMLCh fgRoot[] = { chLatin_r, chLatin_o, chLatin_o, chLatin_t, chNull };
|
---|
43 | static const XMLCh fgChar[] = { chSpace, chLatin_C, chLatin_h, chLatin_a, chLatin_r, chNull }; // char
|
---|
44 | static const XMLCh fgLine[] = { chSpace, chLatin_L, chLatin_i, chLatin_n, chLatin_e, chNull }; // line
|
---|
45 | static const XMLCh fgError[] = { chLatin_E, chLatin_r, chLatin_r, chLatin_o, chLatin_r, chNull }; //Error
|
---|
46 | static const XMLCh fgAtFile[] = { // at file
|
---|
47 | chSpace, chLatin_a, chLatin_t, chSpace, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chNull
|
---|
48 | };
|
---|
49 | static const XMLCh fgFatalError[] = { //Fatal Error
|
---|
50 | chLatin_F, chLatin_a, chLatin_t, chLatin_a, chLatin_l, chSpace,
|
---|
51 | chLatin_E, chLatin_r, chLatin_r, chLatin_o, chLatin_r, chNull
|
---|
52 | };
|
---|
53 | static const XMLCh fgMessage[] = { //Message
|
---|
54 | chLatin_M, chLatin_e, chLatin_s, chLatin_s, chLatin_a, chLatin_g, chLatin_e, chNull
|
---|
55 | };
|
---|
56 | static const XMLCh fgXsiNil[] = { //xsi:nil
|
---|
57 | chLatin_x, chLatin_s, chLatin_i, chColon, chLatin_n, chLatin_i, chLatin_l, chNull
|
---|
58 | };
|
---|
59 | static const XMLCh fgWarning[] = { //Warning
|
---|
60 | chLatin_W, chLatin_a, chLatin_r, chLatin_n, chLatin_i, chLatin_n, chLatin_g, chNull
|
---|
61 | };
|
---|
62 | static const XMLCh gXmlnsColonXsi[] = { //xmlns:xsi
|
---|
63 | chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chColon, chLatin_x, chLatin_s,
|
---|
64 | chLatin_i, chNull
|
---|
65 | };
|
---|
66 | static const XMLCh gXmlnsColonPsv[] = { //xmlns:psv
|
---|
67 | chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chColon, chLatin_p, chLatin_s,
|
---|
68 | chLatin_v, chNull
|
---|
69 | };
|
---|
70 |
|
---|
71 | static const XMLCh gRef[] = { chLatin_r, chLatin_e, chLatin_f, chNull }; // ref
|
---|
72 | static const XMLCh gId[] = { chLatin_i, chLatin_d, chNull }; // id
|
---|
73 |
|
---|
74 | static const XMLCh gEqualsQuote[] = { chEqual, chDoubleQuote, chNull };
|
---|
75 | static const XMLCh gAngleSlash[] = { chOpenAngle, chForwardSlash, chNull };
|
---|
76 | static const XMLCh gAngleFeed[] = { chCloseAngle, chLF, chNull };
|
---|
77 | static const XMLCh gSlashAngleFeed[] = { chForwardSlash, chCloseAngle, chLF, chNull };
|
---|
78 | static const XMLCh gQuoteAngleFeed[] = { chDoubleQuote, chCloseAngle, chLF, chNull };
|
---|
79 |
|
---|
80 | static const XMLCh gActualValue[] = { chLatin_a, chLatin_c, chLatin_t, chLatin_u, chLatin_a,
|
---|
81 | chLatin_l, chLatin_V, chLatin_a, chLatin_l, chLatin_u,
|
---|
82 | chLatin_e, chNull };
|
---|
83 |
|
---|
84 | static const XMLCh gDataType[] = { chLatin_d, chLatin_a, chLatin_t, chLatin_a, chLatin_T,
|
---|
85 | chLatin_y, chLatin_p, chLatin_e, chNull };
|
---|
86 | static const XMLCh gDataValue[] = { chLatin_d, chLatin_a, chLatin_t, chLatin_a, chLatin_V,
|
---|
87 | chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull };
|
---|
88 | static const XMLCh gCommentStart[] = { chOpenAngle, chBang, chDash, chDash, chLF, chNull};
|
---|
89 | static const XMLCh gCommentEnd[] = { chDash, chDash, chCloseAngle, chLF, chNull};
|
---|
90 |
|
---|
91 | static const XMLCh gPartialElementPSVI[] =
|
---|
92 | { chLatin_p, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_t, chLatin_i, chLatin_a, chLatin_l,
|
---|
93 | chLatin_E, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t,
|
---|
94 | chLatin_P, chLatin_S, chLatin_V, chLatin_I, chNull };
|
---|
95 |
|
---|
96 | // ---------------------------------------------------------------------------
|
---|
97 | // PSVIWriterHandlers: Constructors and Destructor
|
---|
98 | // ---------------------------------------------------------------------------
|
---|
99 | PSVIWriterHandlers::PSVIWriterHandlers(XMLFormatter* outputFormatter, XMLFormatter* errorFormatter) :
|
---|
100 | PSVIHandler(), DefaultHandler() {
|
---|
101 | fFormatter = outputFormatter;
|
---|
102 | fErrorFormatter = (errorFormatter != NULL) ? errorFormatter : outputFormatter;
|
---|
103 |
|
---|
104 | fAttrList = new StringList(8, false);
|
---|
105 | fTempResult = new XMLCh[51];
|
---|
106 | fIndentChars = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate(101*sizeof(XMLCh));
|
---|
107 | fBaseUri = 0;
|
---|
108 |
|
---|
109 | XMLString::copyString(fIndentChars, XMLUni::fgZeroLenString);
|
---|
110 |
|
---|
111 | fIndent = 0;
|
---|
112 | fIndentCap = 100;
|
---|
113 | fAnonNum = 1000;
|
---|
114 |
|
---|
115 | fIdMap = new RefHashTableOf<XMLCh>(101, false);
|
---|
116 | fDefinedIds = new RefVectorOf<XSObject>(25, false);
|
---|
117 | fIdNames = new RefArrayVectorOf<XMLCh>(25, true);
|
---|
118 | fObjectLocations = new RefArrayVectorOf<XMLCh>(25, true);
|
---|
119 |
|
---|
120 | fPrefixMap = new RefHashTableOf<XMLCh>(5, false);
|
---|
121 | fNamespaces = new RefArrayVectorOf<XMLCh>(5, false);
|
---|
122 |
|
---|
123 | fNSAttributes = new ValueVectorOf<unsigned int>(15);
|
---|
124 | fElementChildren = new ValueStackOf<bool>(20);
|
---|
125 |
|
---|
126 |
|
---|
127 | fAttributesInfo = new RefVectorOf<AttrInfo>(8, true);
|
---|
128 | }
|
---|
129 |
|
---|
130 | PSVIWriterHandlers::~PSVIWriterHandlers() {
|
---|
131 | if (fBaseUri != NULL)
|
---|
132 | XMLString::release(&fBaseUri);
|
---|
133 | delete fAttrList;
|
---|
134 | delete[] fTempResult;
|
---|
135 | XMLPlatformUtils::fgMemoryManager->deallocate(fIndentChars);
|
---|
136 |
|
---|
137 | delete fIdMap;
|
---|
138 | delete fDefinedIds;
|
---|
139 | delete fIdNames;
|
---|
140 | delete fObjectLocations;
|
---|
141 |
|
---|
142 | delete fPrefixMap;
|
---|
143 | delete fNamespaces;
|
---|
144 |
|
---|
145 | delete fNSAttributes;
|
---|
146 | delete fElementChildren;
|
---|
147 |
|
---|
148 | delete fAttributesInfo;
|
---|
149 |
|
---|
150 | }
|
---|
151 |
|
---|
152 | // -----------------------------------------------------------------------
|
---|
153 | // Convenience Utility
|
---|
154 | // -----------------------------------------------------------------------
|
---|
155 |
|
---|
156 | void PSVIWriterHandlers::resetPSVIFormatter(XMLFormatter* outputFormatter) {
|
---|
157 | fFormatter = outputFormatter;
|
---|
158 | }
|
---|
159 |
|
---|
160 | void PSVIWriterHandlers::resetDocument() {
|
---|
161 |
|
---|
162 | fIndent = 0;
|
---|
163 | fAnonNum = 1000;
|
---|
164 | XMLString::copyString(fIndentChars, XMLUni::fgZeroLenString);
|
---|
165 |
|
---|
166 | if (fBaseUri != NULL)
|
---|
167 | XMLString::release(&fBaseUri);
|
---|
168 |
|
---|
169 | fIdMap->removeAll();
|
---|
170 | fDefinedIds->removeAllElements();
|
---|
171 | fIdNames->removeAllElements();
|
---|
172 | fObjectLocations->removeAllElements();
|
---|
173 |
|
---|
174 | fPrefixMap->removeAll();
|
---|
175 | fNamespaces->removeAllElements();
|
---|
176 |
|
---|
177 | fElementChildren->removeAllElements();
|
---|
178 | }
|
---|
179 |
|
---|
180 | // ---------------------------------------------------------------------------
|
---|
181 | // PSVIWriterHandlers: Implementation of the SAX DocumentHandler interface
|
---|
182 | // ---------------------------------------------------------------------------
|
---|
183 | void PSVIWriterHandlers::startElement( const XMLCh* const uri,
|
---|
184 | const XMLCh* const localname,
|
---|
185 | const XMLCh* const qname,
|
---|
186 | const Attributes& attrs) {
|
---|
187 | fAttributesInfo->removeAllElements();
|
---|
188 | for (unsigned int i=0; i<attrs.getLength(); i++) {
|
---|
189 | fAttributesInfo->addElement(
|
---|
190 | new AttrInfo(
|
---|
191 | attrs.getURI(i),
|
---|
192 | attrs.getLocalName(i),
|
---|
193 | attrs.getType(i),
|
---|
194 | attrs.getValue(i)
|
---|
195 | )
|
---|
196 | );
|
---|
197 | }
|
---|
198 | }
|
---|
199 |
|
---|
200 | void PSVIWriterHandlers::endElement( const XMLCh* const uri,
|
---|
201 | const XMLCh* const localname,
|
---|
202 | const XMLCh* const qname) {
|
---|
203 | }
|
---|
204 |
|
---|
205 | void PSVIWriterHandlers::startDocument() {
|
---|
206 | fAttrList->removeAllElements();
|
---|
207 | fAttrList->addElement((XMLCh*)gXmlnsColonXsi);
|
---|
208 | fAttrList->addElement((XMLCh*)PSVIUni::fgNamespaceInstance);
|
---|
209 | fAttrList->addElement((XMLCh*)gXmlnsColonPsv);
|
---|
210 | fAttrList->addElement((XMLCh*)PSVIUni::fgNamespacePsvi);
|
---|
211 | fAttrList->addElement((XMLCh*)XMLUni::fgXMLNSString);
|
---|
212 | fAttrList->addElement((XMLCh*)PSVIUni::fgNamespaceInfoset);
|
---|
213 |
|
---|
214 | writeOpen(PSVIUni::fgDocument, fAttrList);
|
---|
215 | incIndent();
|
---|
216 | sendElementValue(PSVIUni::fgCharacterEncodingScheme, fFormatter->getEncodingName());
|
---|
217 | sendElementEmpty(PSVIUni::fgStandalone);
|
---|
218 | sendElementValue(PSVIUni::fgVersion, PSVIUni::fgOnePointZero);
|
---|
219 |
|
---|
220 | fElementChildren->push(false);
|
---|
221 | }
|
---|
222 |
|
---|
223 | void PSVIWriterHandlers::endDocument() {
|
---|
224 | processChildrenEnd();
|
---|
225 | sendElementEmpty(PSVIUni::fgDocumentElement);
|
---|
226 | writeEmpty(PSVIUni::fgNotations);
|
---|
227 | writeEmpty(PSVIUni::fgUnparsedEntities);
|
---|
228 | sendElementValue(PSVIUni::fgBaseURI, fBaseUri);
|
---|
229 | sendElementValue(PSVIUni::fgAllDeclarationsProcessed, PSVIUni::fgTrue);
|
---|
230 | sendUnindentedElement(PSVIUni::fgDocument);
|
---|
231 | resetDocument();
|
---|
232 | }
|
---|
233 |
|
---|
234 | void PSVIWriterHandlers::characters( const XMLCh* const chars,
|
---|
235 | const unsigned int length) {
|
---|
236 | processChildren();
|
---|
237 | sendIndentedElement(PSVIUni::fgCharacter);
|
---|
238 | sendElementValue(PSVIUni::fgTextContent, chars);
|
---|
239 | sendUnindentedElement(PSVIUni::fgCharacter);
|
---|
240 | }
|
---|
241 |
|
---|
242 | void PSVIWriterHandlers::ignorableWhitespace( const XMLCh* const chars,
|
---|
243 | const unsigned int length) {
|
---|
244 | //ignore it
|
---|
245 | }
|
---|
246 |
|
---|
247 | void PSVIWriterHandlers::comment(const XMLCh* const chars, const unsigned int length) {
|
---|
248 | processChildren();
|
---|
249 | sendIndentedElement(PSVIUni::fgComment);
|
---|
250 | sendElementValue(PSVIUni::fgContent, chars);
|
---|
251 | sendUnindentedElement(PSVIUni::fgComment);
|
---|
252 | }
|
---|
253 |
|
---|
254 | void PSVIWriterHandlers::processingInstruction( const XMLCh* const target,
|
---|
255 | const XMLCh* const data) {
|
---|
256 | processChildren();
|
---|
257 | sendIndentedElement(PSVIUni::fgProcessingInstruction);
|
---|
258 | sendElementValue(PSVIUni::fgTarget, target);
|
---|
259 | sendElementValue(PSVIUni::fgContent, data);
|
---|
260 | sendUnindentedElement(PSVIUni::fgProcessingInstruction);
|
---|
261 | }
|
---|
262 |
|
---|
263 | void PSVIWriterHandlers::startPrefixMapping(const XMLCh* const prefix, const XMLCh* const uri) {
|
---|
264 | if (!fPrefixMap->containsKey(uri)) {
|
---|
265 | XMLCh* permaUri = XMLString::replicate((XMLCh*)uri);
|
---|
266 | XMLCh* permaPrefix = XMLString::replicate((XMLCh*)prefix);
|
---|
267 | fNamespaces->addElement(permaUri);
|
---|
268 | fPrefixMap->put(permaUri, permaPrefix);
|
---|
269 | }
|
---|
270 | }
|
---|
271 |
|
---|
272 | void PSVIWriterHandlers::endPrefixMapping(const XMLCh* const prefix) {
|
---|
273 | for (unsigned int i=0; i < fNamespaces->size(); i++) {
|
---|
274 | if (XMLString::equals(fPrefixMap->get(fNamespaces->elementAt(i)), prefix)) {
|
---|
275 | XMLCh* uri = fNamespaces->elementAt(i);
|
---|
276 | XMLCh* pre = fPrefixMap->get(uri);
|
---|
277 | fPrefixMap->removeKey(uri);
|
---|
278 | fNamespaces->removeElementAt(i);
|
---|
279 | XMLString::release(&uri);
|
---|
280 | XMLString::release(&pre);
|
---|
281 | break;
|
---|
282 | }
|
---|
283 | }
|
---|
284 | }
|
---|
285 |
|
---|
286 | InputSource* PSVIWriterHandlers::resolveEntity(XMLResourceIdentifier* resourceIdentifier) {
|
---|
287 | if (fBaseUri != NULL)
|
---|
288 | XMLString::release(&fBaseUri);
|
---|
289 | fBaseUri = XMLString::replicate(resourceIdentifier->getBaseURI());
|
---|
290 | return 0;
|
---|
291 | }
|
---|
292 |
|
---|
293 | InputSource* PSVIWriterHandlers::resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId) {
|
---|
294 | return 0;
|
---|
295 | }
|
---|
296 |
|
---|
297 | // ---------------------------------------------------------------------------
|
---|
298 | // PSVIWriterHandlers: Overrides of the SAX ErrorHandler interface
|
---|
299 | // ---------------------------------------------------------------------------
|
---|
300 | void PSVIWriterHandlers::error(const SAXParseException& e) {
|
---|
301 | XMLCh* temp1 = new XMLCh[10];
|
---|
302 | XMLCh* temp2 = new XMLCh[10];
|
---|
303 | XMLString::binToText(e.getLineNumber(), temp1, 9, 10);
|
---|
304 | XMLString::binToText(e.getColumnNumber(), temp2, 9, 10);
|
---|
305 | *fErrorFormatter << fgError << fgAtFile << chSpace << e.getSystemId()
|
---|
306 | << chComma << fgLine << chSpace << temp1
|
---|
307 | << chComma << fgChar << chSpace << temp2
|
---|
308 | << chLF << fgMessage << chColon << e.getMessage() << chLF;
|
---|
309 | delete[] temp1;
|
---|
310 | delete[] temp2;
|
---|
311 | }
|
---|
312 |
|
---|
313 | void PSVIWriterHandlers::fatalError(const SAXParseException& e) {
|
---|
314 | XMLCh* temp1 = new XMLCh[10];
|
---|
315 | XMLCh* temp2 = new XMLCh[10];
|
---|
316 | XMLString::binToText(e.getLineNumber(), temp1, 9, 10);
|
---|
317 | XMLString::binToText(e.getColumnNumber(), temp2, 9, 10);
|
---|
318 | *fErrorFormatter << fgFatalError << fgAtFile << chSpace << e.getSystemId()
|
---|
319 | << chComma << fgLine << chSpace << temp1
|
---|
320 | << chComma << fgChar << chSpace << temp2
|
---|
321 | << chLF << fgMessage << chColon << e.getMessage() << chLF;
|
---|
322 | delete[] temp1;
|
---|
323 | delete[] temp2;
|
---|
324 | resetDocument();
|
---|
325 | }
|
---|
326 |
|
---|
327 | void PSVIWriterHandlers::warning(const SAXParseException& e) {
|
---|
328 | XMLCh* temp1 = new XMLCh[10];
|
---|
329 | XMLCh* temp2 = new XMLCh[10];
|
---|
330 | XMLString::binToText(e.getLineNumber(), temp1, 9, 10);
|
---|
331 | XMLString::binToText(e.getColumnNumber(), temp2, 9, 10);
|
---|
332 | *fErrorFormatter << fgWarning << fgAtFile << chSpace << e.getSystemId()
|
---|
333 | << chComma << fgLine << chSpace << temp1
|
---|
334 | << chComma << fgChar << chSpace << temp2
|
---|
335 | << chLF << fgMessage << chColon << e.getMessage() << chLF;
|
---|
336 | delete[] temp1;
|
---|
337 | delete[] temp2;
|
---|
338 | }
|
---|
339 |
|
---|
340 | void PSVIWriterHandlers::resetErrors()
|
---|
341 | {
|
---|
342 | }
|
---|
343 |
|
---|
344 | // ---------------------------------------------------------------------------
|
---|
345 | // PSVIWriterHandlers: Overrides of the PSVIHandler interface
|
---|
346 | // ---------------------------------------------------------------------------
|
---|
347 |
|
---|
348 | void PSVIWriterHandlers::handleAttributesPSVI( const XMLCh* const localName,
|
---|
349 | const XMLCh* const uri,
|
---|
350 | PSVIAttributeList* psviAttributes ) {
|
---|
351 |
|
---|
352 | processChildren();
|
---|
353 | fElementChildren->push(false);
|
---|
354 | sendIndentedElement(PSVIUni::fgElement);
|
---|
355 | sendElementValue(PSVIUni::fgNamespaceName, uri);
|
---|
356 | sendElementValue(PSVIUni::fgLocalName, localName);
|
---|
357 | sendElementValue(PSVIUni::fgPrefix, fPrefixMap->get(uri));
|
---|
358 | processAttributes(psviAttributes, fAttributesInfo);
|
---|
359 | processInScopeNamespaces();
|
---|
360 | sendElementValue(PSVIUni::fgBaseURI, fBaseUri);
|
---|
361 | }
|
---|
362 |
|
---|
363 | void PSVIWriterHandlers::handleElementPSVI( const XMLCh* const localName,
|
---|
364 | const XMLCh* const uri,
|
---|
365 | PSVIElement* elementInfo ) {
|
---|
366 |
|
---|
367 | processActualValue(elementInfo);
|
---|
368 | processChildrenEnd();
|
---|
369 | processSchemaInformation(elementInfo->getSchemaInformation());
|
---|
370 | sendElementValue( PSVIUni::fgValidationAttempted,
|
---|
371 | translateValidationAttempted(elementInfo->getValidationAttempted()));
|
---|
372 | sendElementValue(PSVIUni::fgValidationContext, elementInfo->getValidationContext());
|
---|
373 | sendElementValue(PSVIUni::fgValidity, translateValidity(elementInfo->getValidity()));
|
---|
374 | //REVISIT errorCodes not supported
|
---|
375 | //processSchemaErrorCode(elementInfo->getErrorCodes());
|
---|
376 | sendElementEmpty(PSVIUni::fgSchemaErrorCode);
|
---|
377 | sendElementValue(PSVIUni::fgSchemaNormalizedValue, elementInfo->getSchemaNormalizedValue());
|
---|
378 | sendElementValue(PSVIUni::fgCanonicalRepresentation, elementInfo->getCanonicalRepresentation());
|
---|
379 | sendElementValue(PSVIUni::fgSchemaSpecified,
|
---|
380 | (elementInfo->getIsSchemaSpecified() ? PSVIUni::fgSchema : PSVIUni::fgInfoset));
|
---|
381 | sendElementValue(PSVIUni::fgSchemaDefault, elementInfo->getSchemaDefault());
|
---|
382 | processTypeDefinitionRef(PSVIUni::fgTypeDefinition, elementInfo->getTypeDefinition());
|
---|
383 | processTypeDefinitionRef(PSVIUni::fgMemberTypeDefinition, elementInfo->getMemberTypeDefinition());
|
---|
384 | sendElementEmpty(PSVIUni::fgNil);
|
---|
385 | processElementDeclarationRef(PSVIUni::fgDeclaration, elementInfo->getElementDeclaration());
|
---|
386 | sendReference(PSVIUni::fgNotation, elementInfo->getNotationDeclaration());
|
---|
387 | sendElementEmpty(PSVIUni::fgIdIdrefTable);
|
---|
388 | sendElementEmpty(PSVIUni::fgIdentityConstraintTable);
|
---|
389 | sendUnindentedElement(PSVIUni::fgElement);
|
---|
390 |
|
---|
391 | }
|
---|
392 |
|
---|
393 | /***
|
---|
394 | *
|
---|
395 | * <partialElementPSVI>
|
---|
396 | * getValidity()
|
---|
397 | * getValidationAttemped()
|
---|
398 | * getValidationContext()
|
---|
399 | * getIsSchemaSpecified()
|
---|
400 | * getElementDeclaration()
|
---|
401 | * getTypeDefinition()
|
---|
402 | * getMemberTypeDefinition()
|
---|
403 | * getSchemaInformation()
|
---|
404 | * getSchemaDefault()
|
---|
405 | * getSchemaNormalizedValue()
|
---|
406 | * getCanonicalRepresentation()
|
---|
407 | * getNotationDeclaration()
|
---|
408 | * </partialElementPSVI>
|
---|
409 | *
|
---|
410 | ***/
|
---|
411 | void
|
---|
412 | PSVIWriterHandlers::handlePartialElementPSVI( const XMLCh* const localName,
|
---|
413 | const XMLCh* const uri,
|
---|
414 | PSVIElement* elementInfo )
|
---|
415 | {
|
---|
416 |
|
---|
417 | writeString(gCommentStart);
|
---|
418 | incIndent();
|
---|
419 | writeOpen(gPartialElementPSVI);
|
---|
420 | incIndent();
|
---|
421 |
|
---|
422 | processSchemaInformation(elementInfo->getSchemaInformation());
|
---|
423 | sendElementValue(PSVIUni::fgValidationAttempted
|
---|
424 | , translateValidationAttempted(elementInfo->getValidationAttempted()));
|
---|
425 | sendElementValue(PSVIUni::fgValidationContext
|
---|
426 | , elementInfo->getValidationContext());
|
---|
427 | sendElementValue(PSVIUni::fgValidity
|
---|
428 | , translateValidity(elementInfo->getValidity()));
|
---|
429 | sendElementValue(PSVIUni::fgSchemaNormalizedValue
|
---|
430 | , elementInfo->getSchemaNormalizedValue());
|
---|
431 | sendElementValue(PSVIUni::fgCanonicalRepresentation
|
---|
432 | , elementInfo->getCanonicalRepresentation());
|
---|
433 | sendElementValue(PSVIUni::fgSchemaSpecified
|
---|
434 | , (elementInfo->getIsSchemaSpecified() ? PSVIUni::fgSchema : PSVIUni::fgInfoset));
|
---|
435 | sendElementValue(PSVIUni::fgSchemaDefault
|
---|
436 | , elementInfo->getSchemaDefault());
|
---|
437 | processTypeDefinitionRef(PSVIUni::fgTypeDefinition
|
---|
438 | , elementInfo->getTypeDefinition());
|
---|
439 | processTypeDefinitionRef(PSVIUni::fgMemberTypeDefinition
|
---|
440 | , elementInfo->getMemberTypeDefinition());
|
---|
441 | processElementDeclarationRef(PSVIUni::fgDeclaration
|
---|
442 | , elementInfo->getElementDeclaration());
|
---|
443 | sendReference(PSVIUni::fgNotation
|
---|
444 | , elementInfo->getNotationDeclaration());
|
---|
445 |
|
---|
446 | decIndent();
|
---|
447 | writeClose(gPartialElementPSVI);
|
---|
448 | decIndent();
|
---|
449 | writeString(gCommentEnd);
|
---|
450 |
|
---|
451 | }
|
---|
452 |
|
---|
453 | // ---------------------------------------------------------------------------
|
---|
454 | // Private methods
|
---|
455 | // ---------------------------------------------------------------------------
|
---|
456 |
|
---|
457 | void PSVIWriterHandlers::processAttributes(PSVIAttributeList* psviAttributes, const RefVectorOf<AttrInfo>* attributesInfo) {
|
---|
458 | fNSAttributes->removeAllElements(); //will store the indecies of namespace attributes
|
---|
459 | bool firstFlag = true;
|
---|
460 | for (unsigned int i = 0; i < attributesInfo->size(); i++) {
|
---|
461 | if (attributesInfo->elementAt(i)->getUri() == XMLUni::fgXMLNSURIName) {
|
---|
462 | fNSAttributes->addElement(i);
|
---|
463 | } else {
|
---|
464 | if (firstFlag) {
|
---|
465 | sendIndentedElement(PSVIUni::fgAttributes);
|
---|
466 | firstFlag = false;
|
---|
467 | }
|
---|
468 | const XMLCh* localName = attributesInfo->elementAt(i)->getLocalName();
|
---|
469 | const XMLCh* namespaceUri = attributesInfo->elementAt(i)->getUri();
|
---|
470 | sendIndentedElement(PSVIUni::fgAttribute);
|
---|
471 | sendElementValue(PSVIUni::fgNamespaceName, namespaceUri);
|
---|
472 | sendElementValue(PSVIUni::fgLocalName, localName);
|
---|
473 | sendElementValue(PSVIUni::fgPrefix, fPrefixMap->get(attributesInfo->elementAt(i)->getUri()));
|
---|
474 | sendElementValue(PSVIUni::fgNormalizedValue, attributesInfo->elementAt(i)->getValue());
|
---|
475 | if (psviAttributes!=NULL && psviAttributes->getAttributePSVIAtIndex(i)!=NULL) {
|
---|
476 | sendElementValue(PSVIUni::fgSpecified,
|
---|
477 | translateBool(!(psviAttributes->getAttributePSVIAtIndex(i)->getIsSchemaSpecified())));
|
---|
478 | } else //the desired value is !schemaSpecified
|
---|
479 | sendElementValue(PSVIUni::fgSpecified, PSVIUni::fgUnknown);
|
---|
480 | sendElementValue(PSVIUni::fgAttributeType, attributesInfo->elementAt(i)->getType());
|
---|
481 | sendElementEmpty(PSVIUni::fgReferences);
|
---|
482 | PSVIAttribute* psviAttr = psviAttributes->getAttributePSVIByName(localName, namespaceUri);
|
---|
483 | processAttributePSVI(psviAttr);
|
---|
484 | sendUnindentedElement(PSVIUni::fgAttribute);
|
---|
485 | }
|
---|
486 | }
|
---|
487 | if (firstFlag)
|
---|
488 | writeEmpty(PSVIUni::fgAttributes);
|
---|
489 | else
|
---|
490 | sendUnindentedElement(PSVIUni::fgAttributes);
|
---|
491 | processNamespaceAttributes(psviAttributes, attributesInfo);
|
---|
492 | }
|
---|
493 |
|
---|
494 | void PSVIWriterHandlers::processNamespaceAttributes(PSVIAttributeList* psviAttributes, const RefVectorOf<AttrInfo>* attributes) {
|
---|
495 | if (fNSAttributes->size()==0) {
|
---|
496 | writeEmpty(PSVIUni::fgNamespaceAttributes);
|
---|
497 | } else {
|
---|
498 | sendIndentedElement(PSVIUni::fgNamespaceAttributes);
|
---|
499 | int ind;
|
---|
500 | for (unsigned int count = 0; count < fNSAttributes->size(); count++) {
|
---|
501 | ind = fNSAttributes->elementAt(count);
|
---|
502 | sendIndentedElement(PSVIUni::fgAttribute);
|
---|
503 | sendElementValue(PSVIUni::fgNamespaceName, XMLUni::fgXMLNSURIName);
|
---|
504 | sendElementValue(PSVIUni::fgLocalName, attributes->elementAt(ind)->getLocalName());
|
---|
505 | sendElementValue(PSVIUni::fgPrefix, XMLUni::fgXMLNSString);
|
---|
506 | sendElementValue(PSVIUni::fgNormalizedValue, attributes->elementAt(ind)->getValue());
|
---|
507 | if (psviAttributes!=NULL) {
|
---|
508 | sendElementValue(PSVIUni::fgSpecified,
|
---|
509 | translateBool(
|
---|
510 | psviAttributes->getAttributePSVIByName(
|
---|
511 | attributes->elementAt(ind)->getLocalName(),
|
---|
512 | attributes->elementAt(ind)->getUri()
|
---|
513 | )->getIsSchemaSpecified()
|
---|
514 | )
|
---|
515 | );
|
---|
516 | } else
|
---|
517 | sendElementValue(PSVIUni::fgSpecified, PSVIUni::fgUnknown);
|
---|
518 | sendElementValue(PSVIUni::fgAttributeType, attributes->elementAt(ind)->getType());
|
---|
519 | // this property isn't relevent to PSVI
|
---|
520 | sendElementEmpty(PSVIUni::fgReferences);
|
---|
521 | sendUnindentedElement(PSVIUni::fgAttribute);
|
---|
522 | }
|
---|
523 | sendUnindentedElement(PSVIUni::fgNamespaceAttributes);
|
---|
524 | }
|
---|
525 | }
|
---|
526 |
|
---|
527 | void PSVIWriterHandlers::processAttributePSVI(PSVIAttribute* attrPSVI) {
|
---|
528 | if (attrPSVI != NULL) {
|
---|
529 | sendElementValue(PSVIUni::fgValidationAttempted,
|
---|
530 | translateValidationAttempted(attrPSVI->getValidationAttempted()));
|
---|
531 | sendElementValue(PSVIUni::fgValidationContext, attrPSVI->getValidationContext());
|
---|
532 | sendElementValue(PSVIUni::fgValidity, translateValidity(attrPSVI->getValidity()));
|
---|
533 | //REVISIT errorCodes not supported
|
---|
534 | //processSchemaErrorCode(attrPSVI->getErrorCodes());
|
---|
535 | sendElementEmpty(PSVIUni::fgSchemaErrorCode);
|
---|
536 | sendElementValue(PSVIUni::fgSchemaNormalizedValue, attrPSVI->getSchemaNormalizedValue());
|
---|
537 | sendElementValue(PSVIUni::fgSchemaSpecified,
|
---|
538 | (attrPSVI->getIsSchemaSpecified() ? PSVIUni::fgSchema : PSVIUni::fgInfoset));
|
---|
539 | sendElementValue(PSVIUni::fgSchemaDefault, attrPSVI->getSchemaDefault());
|
---|
540 | processTypeDefinitionRef(PSVIUni::fgTypeDefinition, attrPSVI->getTypeDefinition());
|
---|
541 | processTypeDefinitionOrRef(PSVIUni::fgMemberTypeDefinition, attrPSVI->getMemberTypeDefinition());
|
---|
542 | processAttributeDeclarationRef(PSVIUni::fgDeclaration, attrPSVI->getAttributeDeclaration());
|
---|
543 |
|
---|
544 | processActualValue(attrPSVI);
|
---|
545 | }
|
---|
546 | }
|
---|
547 |
|
---|
548 | void PSVIWriterHandlers::processInScopeNamespaces() {
|
---|
549 | sendIndentedElement(PSVIUni::fgInScopeNamespaces);
|
---|
550 | sendIndentedElement(PSVIUni::fgNamespace);
|
---|
551 | sendElementValue(PSVIUni::fgPrefix, PSVIUni::fgXml);
|
---|
552 | sendElementValue(PSVIUni::fgNamespaceName, XMLUni::fgXMLURIName);
|
---|
553 | sendUnindentedElement(PSVIUni::fgNamespace);
|
---|
554 | for (unsigned int i=0; i<fNamespaces->size(); i++) {
|
---|
555 | sendIndentedElement(PSVIUni::fgNamespace);
|
---|
556 | sendElementValue(PSVIUni::fgPrefix, fPrefixMap->get(fNamespaces->elementAt(i)));
|
---|
557 | sendElementValue(PSVIUni::fgNamespaceName, fNamespaces->elementAt(i));
|
---|
558 | sendUnindentedElement(PSVIUni::fgNamespace);
|
---|
559 | }
|
---|
560 | sendUnindentedElement(PSVIUni::fgInScopeNamespaces);
|
---|
561 | }
|
---|
562 |
|
---|
563 | void PSVIWriterHandlers::processSchemaInformation(XSModel* model) {
|
---|
564 | if (fElementChildren->size()!=1 || model==NULL) {
|
---|
565 | sendElementEmpty(PSVIUni::fgSchemaInformation);
|
---|
566 | } else {
|
---|
567 | sendIndentedElement(PSVIUni::fgSchemaInformation);
|
---|
568 | XSNamespaceItemList* namespaceItems = model->getNamespaceItems();
|
---|
569 | for (unsigned int i=0; i < namespaceItems->size(); i++) {
|
---|
570 | processNamespaceItem(namespaceItems->elementAt(i));
|
---|
571 | }
|
---|
572 | sendUnindentedElement(PSVIUni::fgSchemaInformation);
|
---|
573 | }
|
---|
574 | }
|
---|
575 |
|
---|
576 | void PSVIWriterHandlers::processNamespaceItem(XSNamespaceItem* namespaceItem) {
|
---|
577 | if (!XMLString::equals(namespaceItem->getSchemaNamespace(), PSVIUni::fgNamespaceXmlSchema)) {
|
---|
578 | sendIndentedElement(PSVIUni::fgNamespaceSchemaInformation);
|
---|
579 | sendElementValue(PSVIUni::fgSchemaNamespace, namespaceItem->getSchemaNamespace());
|
---|
580 | processSchemaComponents(namespaceItem);
|
---|
581 | processSchemaDocuments(namespaceItem);
|
---|
582 | processSchemaAnnotations(namespaceItem->getAnnotations());
|
---|
583 | sendUnindentedElement(PSVIUni::fgNamespaceSchemaInformation);
|
---|
584 | }
|
---|
585 | }
|
---|
586 |
|
---|
587 | void PSVIWriterHandlers::processSchemaComponents(XSNamespaceItem* namespaceItem) {
|
---|
588 | sendIndentedElement(PSVIUni::fgSchemaComponents);
|
---|
589 | XSNamedMap<XSTypeDefinition>* types = (XSNamedMap<XSTypeDefinition>*)(namespaceItem->getComponents(XSConstants::TYPE_DEFINITION));
|
---|
590 | for (unsigned int typeCount = 0; typeCount < types->getLength(); typeCount++) {
|
---|
591 | processTypeDefinition(types->item(typeCount));
|
---|
592 | }
|
---|
593 | XSNamedMap<XSAttributeDeclaration>* attributes = (XSNamedMap<XSAttributeDeclaration>*)namespaceItem->getComponents(XSConstants::ATTRIBUTE_DECLARATION);
|
---|
594 | for (unsigned int attrCount = 0; attrCount < attributes->getLength(); attrCount++) {
|
---|
595 | processAttributeDeclaration(attributes->item(attrCount));
|
---|
596 | }
|
---|
597 | XSNamedMap<XSElementDeclaration>* elements = (XSNamedMap<XSElementDeclaration>*)namespaceItem->getComponents(XSConstants::ELEMENT_DECLARATION);
|
---|
598 | for (unsigned int elemCount = 0; elemCount < elements->getLength(); elemCount++) {
|
---|
599 | processElementDeclaration(elements->item(elemCount));
|
---|
600 | }
|
---|
601 | XSNamedMap<XSAttributeGroupDefinition>* attrGroups = (XSNamedMap<XSAttributeGroupDefinition>*)namespaceItem->getComponents(XSConstants::ATTRIBUTE_GROUP_DEFINITION);
|
---|
602 | for (unsigned int attrGroupCount = 0; attrGroupCount < attrGroups->getLength(); attrGroupCount++) {
|
---|
603 | processAttributeGroupDefinition(attrGroups->item(attrGroupCount));
|
---|
604 | }
|
---|
605 | XSNamedMap<XSModelGroupDefinition>* modelGroups = (XSNamedMap<XSModelGroupDefinition>*)namespaceItem->getComponents(XSConstants::MODEL_GROUP_DEFINITION);
|
---|
606 | for (unsigned int modelGroupCount = 0; modelGroupCount < modelGroups->getLength(); modelGroupCount++) {
|
---|
607 | processModelGroupDefinition(modelGroups->item(modelGroupCount));
|
---|
608 | }
|
---|
609 | XSNamedMap<XSNotationDeclaration>* notations = (XSNamedMap<XSNotationDeclaration>*)namespaceItem->getComponents(XSConstants::NOTATION_DECLARATION);
|
---|
610 | for (unsigned int notationCount = 0; notationCount < notations->getLength(); notationCount++) {
|
---|
611 | processNotationDeclaration(notations->item(notationCount));
|
---|
612 | }
|
---|
613 | sendUnindentedElement(PSVIUni::fgSchemaComponents);
|
---|
614 | }
|
---|
615 |
|
---|
616 | void PSVIWriterHandlers::processSchemaDocuments(XSNamespaceItem* namespaceItem) {
|
---|
617 | StringList* locations = namespaceItem->getDocumentLocations();
|
---|
618 | if (locations==NULL) {
|
---|
619 | sendElementEmpty(PSVIUni::fgSchemaDocuments);
|
---|
620 | }
|
---|
621 | sendIndentedElement(PSVIUni::fgSchemaDocuments);
|
---|
622 | for (unsigned int i = 0; i < locations->size(); i++) {
|
---|
623 | sendIndentedElement(PSVIUni::fgSchemaDocument);
|
---|
624 | sendElementValue(PSVIUni::fgDocumentLocation, locations->elementAt(i));
|
---|
625 | sendElementEmpty(PSVIUni::fgPsvDocument); //supposed to point to a document element, but we dont deal with them
|
---|
626 | sendUnindentedElement(PSVIUni::fgSchemaDocument);
|
---|
627 | }
|
---|
628 | sendUnindentedElement(PSVIUni::fgSchemaDocuments);
|
---|
629 | }
|
---|
630 |
|
---|
631 | void PSVIWriterHandlers::processSchemaAnnotations(XSAnnotationList* annotations) {
|
---|
632 | if (annotations == NULL || annotations->size()==0) {
|
---|
633 | sendElementEmpty(PSVIUni::fgSchemaAnnotations);
|
---|
634 | } else {
|
---|
635 | sendIndentedElement(PSVIUni::fgSchemaAnnotations);
|
---|
636 | for (unsigned int i = 0; i < annotations->size(); i++) {
|
---|
637 | processAnnotation(annotations->elementAt(i));
|
---|
638 | }
|
---|
639 | sendUnindentedElement(PSVIUni::fgSchemaAnnotations);
|
---|
640 | }
|
---|
641 | }
|
---|
642 |
|
---|
643 | void PSVIWriterHandlers::processSchemaErrorCode(StringList* errors) {
|
---|
644 | //REVISIT
|
---|
645 | //ErrorCodes not yet supported
|
---|
646 | }
|
---|
647 |
|
---|
648 | void PSVIWriterHandlers::processTypeDefinition(XSTypeDefinition* type) {
|
---|
649 | if (type->getTypeCategory() == XSTypeDefinition::COMPLEX_TYPE) {
|
---|
650 | processComplexTypeDefinition((XSComplexTypeDefinition*)type);
|
---|
651 | } else { //XSTypeDefinition::SIMPLE_TYPE
|
---|
652 | processSimpleTypeDefinition((XSSimpleTypeDefinition*)type);
|
---|
653 | }
|
---|
654 | }
|
---|
655 |
|
---|
656 | void PSVIWriterHandlers::processComplexTypeDefinition(XSComplexTypeDefinition* complexType) {
|
---|
657 | sendIndentedElementWithID(PSVIUni::fgComplexTypeDefinition, (XSObject*) complexType);
|
---|
658 | if (complexType->getAnonymous())
|
---|
659 | sendElementEmpty(PSVIUni::fgName);
|
---|
660 | else sendElementValue(PSVIUni::fgName, complexType->getName());
|
---|
661 | sendElementValue(PSVIUni::fgTargetNamespace, complexType->getNamespace());
|
---|
662 | processTypeDefinitionOrRef(PSVIUni::fgBaseTypeDefinition, complexType->getBaseType());
|
---|
663 | sendElementValue(PSVIUni::fgDerivationMethod,
|
---|
664 | translateDerivationMethod(complexType->getDerivationMethod()));
|
---|
665 | sendElementValue(PSVIUni::fgFinal, translateBlockOrFinal(complexType->getFinal()));
|
---|
666 | sendElementValue(PSVIUni::fgAbstract, translateBool(complexType->getAbstract()));
|
---|
667 | processAttributeUses(complexType->getAttributeUses());
|
---|
668 | processAttributeWildcard(complexType->getAttributeWildcard());
|
---|
669 |
|
---|
670 | sendIndentedElement(PSVIUni::fgContentType);
|
---|
671 | sendElementValue(PSVIUni::fgVariety, translateComplexContentType(complexType->getContentType()));
|
---|
672 | if (complexType->getSimpleType()==NULL) {
|
---|
673 | sendElementEmpty(PSVIUni::fgSimpleTypeDefinition);
|
---|
674 | } else {
|
---|
675 | processSimpleTypeDefinitionOrRef(complexType->getSimpleType());
|
---|
676 | }
|
---|
677 | processParticle(complexType->getParticle());
|
---|
678 | sendUnindentedElement(PSVIUni::fgContentType);
|
---|
679 | sendElementValue(PSVIUni::fgProhibitedSubstitutions,
|
---|
680 | translateBlockOrFinal(complexType->getProhibitedSubstitutions()));
|
---|
681 | processAnnotations(complexType->getAnnotations());
|
---|
682 | sendUnindentedElement(PSVIUni::fgComplexTypeDefinition);
|
---|
683 | }
|
---|
684 |
|
---|
685 | void PSVIWriterHandlers::processSimpleTypeDefinition(XSSimpleTypeDefinition* simpleType) {
|
---|
686 | sendIndentedElementWithID(PSVIUni::fgSimpleTypeDefinition, (XSObject*) simpleType);
|
---|
687 | if (simpleType->getAnonymous())
|
---|
688 | sendElementEmpty(PSVIUni::fgName);
|
---|
689 | else sendElementValue(PSVIUni::fgName, simpleType->getName());
|
---|
690 | sendElementValue(PSVIUni::fgTargetNamespace, simpleType->getNamespace());
|
---|
691 | processTypeDefinitionOrRef(PSVIUni::fgBaseTypeDefinition, simpleType->getBaseType());
|
---|
692 | processTypeDefinitionOrRef(PSVIUni::fgPrimitiveTypeDefinition, simpleType->getPrimitiveType());
|
---|
693 | processFacets(simpleType->getFacets(), simpleType->getMultiValueFacets());
|
---|
694 | processFundamentalFacets(simpleType);
|
---|
695 | sendElementValue(PSVIUni::fgFinal, translateBlockOrFinal(simpleType->getFinal()));
|
---|
696 | sendElementValue(PSVIUni::fgVariety, translateSimpleTypeVariety(simpleType->getVariety()));
|
---|
697 | processTypeDefinitionOrRef(PSVIUni::fgItemTypeDefinition, simpleType->getItemType());
|
---|
698 | processMemberTypeDefinitions(simpleType->getMemberTypes());
|
---|
699 | processAnnotations(simpleType->getAnnotations());
|
---|
700 | sendUnindentedElement(PSVIUni::fgSimpleTypeDefinition);
|
---|
701 | }
|
---|
702 |
|
---|
703 | void PSVIWriterHandlers::processModelGroupDefinition(XSModelGroupDefinition* modelGroup) {
|
---|
704 | if (modelGroup == NULL) {
|
---|
705 | sendElementEmpty(PSVIUni::fgModelGroupDefinition);
|
---|
706 | } else {
|
---|
707 | sendIndentedElementWithID(PSVIUni::fgModelGroupDefinition, (XSObject*) modelGroup);
|
---|
708 | sendElementValue(PSVIUni::fgName, modelGroup->getName());
|
---|
709 | sendElementValue(PSVIUni::fgTargetNamespace, modelGroup->getNamespace());
|
---|
710 | processModelGroup(modelGroup->getModelGroup());
|
---|
711 | processAnnotation(modelGroup->getAnnotation());
|
---|
712 | sendUnindentedElement(PSVIUni::fgModelGroupDefinition);
|
---|
713 | }
|
---|
714 | }
|
---|
715 |
|
---|
716 | void PSVIWriterHandlers::processAttributeGroupDefinition(XSAttributeGroupDefinition* attributeGroup) {
|
---|
717 | if (attributeGroup == NULL) {
|
---|
718 | sendElementEmpty(PSVIUni::fgAttributeGroupDefinition);
|
---|
719 | } else {
|
---|
720 | sendIndentedElementWithID(PSVIUni::fgAttributeGroupDefinition, (XSObject*) attributeGroup);
|
---|
721 | sendElementValue(PSVIUni::fgName, attributeGroup->getName());
|
---|
722 | sendElementValue(PSVIUni::fgTargetNamespace, attributeGroup->getNamespace());
|
---|
723 | processAttributeUses(attributeGroup->getAttributeUses());
|
---|
724 | processAttributeWildcard(attributeGroup->getAttributeWildcard());
|
---|
725 | processAnnotation(attributeGroup->getAnnotation());
|
---|
726 | sendUnindentedElement(PSVIUni::fgAttributeGroupDefinition);
|
---|
727 | }
|
---|
728 | }
|
---|
729 |
|
---|
730 | void PSVIWriterHandlers::processElementDeclaration(XSElementDeclaration* element) {
|
---|
731 | if (element == NULL) {
|
---|
732 | sendElementEmpty(PSVIUni::fgElementDeclaration);
|
---|
733 | } else {
|
---|
734 | sendIndentedElementWithID(PSVIUni::fgElementDeclaration, (XSObject*) element);
|
---|
735 | sendElementValue(PSVIUni::fgName, element->getName());
|
---|
736 | sendElementValue(PSVIUni::fgTargetNamespace, element->getNamespace());
|
---|
737 | processTypeDefinitionOrRef(PSVIUni::fgTypeDefinition, element->getTypeDefinition());
|
---|
738 | processScope(element->getEnclosingCTDefinition(), element->getScope());
|
---|
739 | processValueConstraint(element->getConstraintType(), element->getConstraintValue());
|
---|
740 | sendElementValue(PSVIUni::fgNillable, translateBool(element->getNillable()));
|
---|
741 | processIdentityConstraintDefinition(element->getIdentityConstraints());
|
---|
742 | processElementDeclarationRef(PSVIUni::fgSubstitutionGroupAffiliation,
|
---|
743 | element->getSubstitutionGroupAffiliation());
|
---|
744 | sendElementValue(PSVIUni::fgSubstitutionGroupExclusions,
|
---|
745 | translateBlockOrFinal(element->getSubstitutionGroupExclusions()));
|
---|
746 | sendElementValue(PSVIUni::fgDisallowedSubstitutions,
|
---|
747 | translateBlockOrFinal(element->getDisallowedSubstitutions()));
|
---|
748 | sendElementValue(PSVIUni::fgAbstract, translateBool(element->getAbstract()));
|
---|
749 | processAnnotation(element->getAnnotation());
|
---|
750 | sendUnindentedElement(PSVIUni::fgElementDeclaration);
|
---|
751 | }
|
---|
752 | }
|
---|
753 |
|
---|
754 | void PSVIWriterHandlers::processAttributeDeclaration(XSAttributeDeclaration* attribute) {
|
---|
755 | if (attribute == NULL) {
|
---|
756 | sendElementEmpty(PSVIUni::fgAttributeDeclaration);
|
---|
757 | } else {
|
---|
758 | sendIndentedElementWithID(PSVIUni::fgAttributeDeclaration, (XSObject*) attribute);
|
---|
759 | sendElementValue(PSVIUni::fgName, attribute->getName());
|
---|
760 | sendElementValue(PSVIUni::fgTargetNamespace, attribute->getNamespace());
|
---|
761 | sendIndentedElement(PSVIUni::fgTypeDefinition);
|
---|
762 | processSimpleTypeDefinitionOrRef(attribute->getTypeDefinition());
|
---|
763 | sendUnindentedElement(PSVIUni::fgTypeDefinition);
|
---|
764 | processScope(attribute->getEnclosingCTDefinition(), attribute->getScope());
|
---|
765 | processValueConstraint(attribute->getConstraintType(), attribute->getConstraintValue());
|
---|
766 | processAnnotation(attribute->getAnnotation());
|
---|
767 | sendUnindentedElement(PSVIUni::fgAttributeDeclaration);
|
---|
768 | }
|
---|
769 | }
|
---|
770 |
|
---|
771 | void PSVIWriterHandlers::processNotationDeclaration(XSNotationDeclaration* notation) {
|
---|
772 | if (notation == NULL) {
|
---|
773 | sendElementEmpty(PSVIUni::fgNotationDeclaration);
|
---|
774 | } else {
|
---|
775 | sendIndentedElementWithID(PSVIUni::fgNotationDeclaration, (XSObject*) notation);
|
---|
776 | sendElementValue(PSVIUni::fgName, notation->getName());
|
---|
777 | sendElementValue(PSVIUni::fgTargetNamespace, notation->getNamespace());
|
---|
778 | sendElementValue(PSVIUni::fgSystemIdentifier, notation->getSystemId());
|
---|
779 | sendElementValue(PSVIUni::fgPublicIdentifier, notation->getPublicId());
|
---|
780 | processAnnotation(notation->getAnnotation());
|
---|
781 | sendUnindentedElement(PSVIUni::fgNotationDeclaration);
|
---|
782 | }
|
---|
783 | }
|
---|
784 |
|
---|
785 | void PSVIWriterHandlers::processAnnotations(XSAnnotationList* annotations) {
|
---|
786 | if (annotations == NULL) {
|
---|
787 | sendElementEmpty(PSVIUni::fgAnnotations);
|
---|
788 | } else {
|
---|
789 | sendIndentedElement(PSVIUni::fgAnnotations);
|
---|
790 | for (unsigned int i = 0; i < annotations->size(); i++) {
|
---|
791 | processAnnotation(annotations->elementAt(i));
|
---|
792 | }
|
---|
793 | sendUnindentedElement(PSVIUni::fgAnnotations);
|
---|
794 | }
|
---|
795 | }
|
---|
796 |
|
---|
797 | void PSVIWriterHandlers::processAttributeUses(XSAttributeUseList* attributeUses) {
|
---|
798 | if (attributeUses == NULL) {
|
---|
799 | sendElementEmpty(PSVIUni::fgAttributeUses);
|
---|
800 | } else {
|
---|
801 | sendIndentedElement(PSVIUni::fgAttributeUses);
|
---|
802 | XSAttributeUse* attrUse;
|
---|
803 | for (unsigned int i=0; i < attributeUses->size(); i++) {
|
---|
804 | attrUse = attributeUses->elementAt(i);
|
---|
805 | sendIndentedElement(PSVIUni::fgAttributeUse);
|
---|
806 | sendElementValue(PSVIUni::fgRequired, translateBool(attrUse->getRequired()));
|
---|
807 | processAttributeDeclarationOrRef(attrUse->getAttrDeclaration());
|
---|
808 | processValueConstraint(attrUse->getConstraintType(), attrUse->getConstraintValue());
|
---|
809 | sendUnindentedElement(PSVIUni::fgAttributeUse);
|
---|
810 | }
|
---|
811 | sendUnindentedElement(PSVIUni::fgAttributeUses);
|
---|
812 | }
|
---|
813 | }
|
---|
814 |
|
---|
815 | void PSVIWriterHandlers::processFacets(XSFacetList* facets, XSMultiValueFacetList* multiFacets) {
|
---|
816 | if (facets == NULL && multiFacets == NULL) {
|
---|
817 | sendElementEmpty(PSVIUni::fgFacets);
|
---|
818 | } else {
|
---|
819 | sendIndentedElement(PSVIUni::fgFacets);
|
---|
820 | if (facets != NULL) {
|
---|
821 | for (unsigned int facetCount = 0; facetCount < facets->size(); facetCount++) {
|
---|
822 | XSFacet* facet = facets->elementAt(facetCount);
|
---|
823 | sendIndentedElement(translateFacet(facet->getFacetKind()));
|
---|
824 | sendElementValue(PSVIUni::fgValue, facet->getLexicalFacetValue());
|
---|
825 | sendElementValue(PSVIUni::fgFixed, translateBool(facet->isFixed()));
|
---|
826 | processAnnotation(facet->getAnnotation());
|
---|
827 | sendUnindentedElement(translateFacet(facet->getFacetKind()));
|
---|
828 | }
|
---|
829 | }
|
---|
830 | if (multiFacets != NULL) {
|
---|
831 | for (unsigned int multiFacetCount = 0; multiFacetCount < multiFacets->size(); multiFacetCount++) {
|
---|
832 | XSMultiValueFacet* multiFacet = multiFacets->elementAt(multiFacetCount);
|
---|
833 | sendIndentedElement(translateFacet(multiFacet->getFacetKind()));
|
---|
834 | StringList* values = multiFacet->getLexicalFacetValues();
|
---|
835 | for (unsigned int i=0; i < values->size(); i++) {
|
---|
836 | sendElementValue(PSVIUni::fgValue, values->elementAt(i));
|
---|
837 | }
|
---|
838 | sendElementValue(PSVIUni::fgFixed, translateBool(multiFacet->isFixed()));
|
---|
839 | processAnnotations(multiFacet->getAnnotations());
|
---|
840 | sendUnindentedElement(translateFacet(multiFacet->getFacetKind()));
|
---|
841 | }
|
---|
842 | }
|
---|
843 | sendUnindentedElement(PSVIUni::fgFacets);
|
---|
844 | }
|
---|
845 | }
|
---|
846 |
|
---|
847 | void PSVIWriterHandlers::processFundamentalFacets(XSSimpleTypeDefinition* type) {
|
---|
848 | sendIndentedElement(PSVIUni::fgFundamentalFacets);
|
---|
849 | sendIndentedElement(PSVIUni::fgOrdered);
|
---|
850 | sendElementValue(PSVIUni::fgValue, translateOrderedFacet(type->getOrdered()));
|
---|
851 | sendUnindentedElement(PSVIUni::fgOrdered);
|
---|
852 | sendIndentedElement(PSVIUni::fgBounded);
|
---|
853 | sendElementValue(PSVIUni::fgValue, translateBool(type->getBounded()));
|
---|
854 | sendUnindentedElement(PSVIUni::fgBounded);
|
---|
855 | sendIndentedElement(PSVIUni::fgCardinality);
|
---|
856 | sendElementValue(PSVIUni::fgValue, translateBool(type->getFinite()));
|
---|
857 | sendUnindentedElement(PSVIUni::fgCardinality);
|
---|
858 | sendIndentedElement(PSVIUni::fgNumeric);
|
---|
859 | sendElementValue(PSVIUni::fgValue, translateBool(type->getNumeric()));
|
---|
860 | sendUnindentedElement(PSVIUni::fgNumeric);
|
---|
861 | sendUnindentedElement(PSVIUni::fgFundamentalFacets);
|
---|
862 | }
|
---|
863 |
|
---|
864 | void PSVIWriterHandlers::processMemberTypeDefinitions(XSSimpleTypeDefinitionList* memberTypes) {
|
---|
865 | if (memberTypes == NULL) {
|
---|
866 | sendElementEmpty(PSVIUni::fgMemberTypeDefinitions);
|
---|
867 | } else {
|
---|
868 | sendIndentedElement(PSVIUni::fgMemberTypeDefinitions);
|
---|
869 | for (unsigned int i = 0; i < memberTypes->size(); i++) {
|
---|
870 | processTypeDefinitionOrRef(PSVIUni::fgMemberTypeDefinition, (XSTypeDefinition*)memberTypes->elementAt(i));
|
---|
871 | }
|
---|
872 | sendUnindentedElement(PSVIUni::fgMemberTypeDefinitions);
|
---|
873 | }
|
---|
874 | }
|
---|
875 |
|
---|
876 | void PSVIWriterHandlers::processAnnotation(XSAnnotation* annotation) {
|
---|
877 | if (annotation == NULL) {
|
---|
878 | sendElementEmpty(PSVIUni::fgAnnotation);
|
---|
879 | } else {
|
---|
880 | XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* document = DOMImplementationRegistry::getDOMImplementation(XMLUni::fgZeroLenString)->
|
---|
881 | createDocument();
|
---|
882 | annotation->writeAnnotation((DOMNode*)document, XSAnnotation::W3C_DOM_DOCUMENT);
|
---|
883 | DOMElement* elem = document->getDocumentElement();
|
---|
884 | sendIndentedElement(PSVIUni::fgAnnotation);
|
---|
885 | processDOMElement(PSVIUni::fgApplicationInformation, elem, PSVIUni::fgAppinfo);
|
---|
886 | processDOMElement(PSVIUni::fgUserInformation, elem, PSVIUni::fgDocumentation);
|
---|
887 | processDOMAttributes(elem->getAttributes());
|
---|
888 | sendUnindentedElement(PSVIUni::fgAnnotation);
|
---|
889 | document->release();
|
---|
890 | }
|
---|
891 | }
|
---|
892 |
|
---|
893 | void PSVIWriterHandlers::processDOMElement(const XMLCh* const encloseName, DOMElement* rootElem, const XMLCh* const elementName) {
|
---|
894 | DOMNodeList* elems = rootElem->getElementsByTagNameNS(SchemaSymbols::fgURI_SCHEMAFORSCHEMA, elementName);
|
---|
895 | if (elems->getLength()==0) {
|
---|
896 | sendElementEmpty(encloseName);
|
---|
897 | } else {
|
---|
898 | sendIndentedElement(encloseName);
|
---|
899 | for (unsigned int i=0; i < elems->getLength(); i++) {
|
---|
900 | DOMElement* elem = (DOMElement*)elems->item(i);
|
---|
901 | sendIndentedElement(PSVIUni::fgElement);
|
---|
902 | sendElementValue(PSVIUni::fgNamespaceName, elem->getNamespaceURI());
|
---|
903 | sendElementValue(PSVIUni::fgLocalName, elem->getLocalName());
|
---|
904 | sendElementValue(PSVIUni::fgPrefix, elem->getPrefix());
|
---|
905 | sendIndentedElement(PSVIUni::fgChildren);
|
---|
906 | sendIndentedElement(PSVIUni::fgCharacter);
|
---|
907 | sendElementValue(PSVIUni::fgTextContent, elem->getTextContent());
|
---|
908 | sendUnindentedElement(PSVIUni::fgCharacter);
|
---|
909 | sendUnindentedElement(PSVIUni::fgChildren);
|
---|
910 | processDOMAttributes(elem->getAttributes());
|
---|
911 | sendUnindentedElement(PSVIUni::fgElement);
|
---|
912 | }
|
---|
913 | sendUnindentedElement(encloseName);
|
---|
914 | }
|
---|
915 | }
|
---|
916 |
|
---|
917 | void PSVIWriterHandlers::processDOMAttributes(DOMNamedNodeMap* attrs) {
|
---|
918 | fNSAttributes->removeAllElements();
|
---|
919 | bool firstFlag = true;
|
---|
920 | for (unsigned int count=0; count < attrs->getLength(); count++) {
|
---|
921 | DOMAttr* attr = (DOMAttr*)attrs->item(count);
|
---|
922 | if (XMLString::equals(attr->getNamespaceURI(), XMLUni::fgXMLNSURIName)) {
|
---|
923 | fNSAttributes->addElement(count);
|
---|
924 | } else {
|
---|
925 | if (firstFlag) {
|
---|
926 | sendIndentedElement(PSVIUni::fgAttributes);
|
---|
927 | firstFlag = false;
|
---|
928 | }
|
---|
929 | sendIndentedElement(PSVIUni::fgAttribute);
|
---|
930 | sendElementValue(PSVIUni::fgNamespaceName, attr->getNamespaceURI());
|
---|
931 | sendElementValue(PSVIUni::fgLocalName, attr->getLocalName());
|
---|
932 | sendElementValue(PSVIUni::fgPrefix, attr->getPrefix());
|
---|
933 | sendElementValue(PSVIUni::fgNormalizedValue, attr->getValue());
|
---|
934 | sendElementValue(PSVIUni::fgSpecified, translateBool(attr->getSpecified()));
|
---|
935 | sendElementValue(PSVIUni::fgAttributeType, attr->getTypeInfo()->getName());
|
---|
936 | sendElementEmpty(PSVIUni::fgReferences);
|
---|
937 | sendUnindentedElement(PSVIUni::fgAttribute);
|
---|
938 | }
|
---|
939 | }
|
---|
940 | if (firstFlag)
|
---|
941 | writeEmpty(PSVIUni::fgAttributes);
|
---|
942 | else
|
---|
943 | sendUnindentedElement(PSVIUni::fgAttributes);
|
---|
944 |
|
---|
945 | //now for namespace attributes
|
---|
946 | if (fNSAttributes->size()==0) {
|
---|
947 | writeEmpty(PSVIUni::fgNamespaceAttributes);
|
---|
948 | } else {
|
---|
949 | sendIndentedElement(PSVIUni::fgNamespaceAttributes);
|
---|
950 | for (unsigned int NScount = 0; NScount < fNSAttributes->size(); NScount++) {
|
---|
951 | DOMAttr* attr = (DOMAttr*)attrs->item(fNSAttributes->elementAt(NScount));
|
---|
952 | sendIndentedElement(PSVIUni::fgAttribute);
|
---|
953 | sendElementValue(PSVIUni::fgNamespaceName, XMLUni::fgXMLNSURIName);
|
---|
954 | sendElementValue(PSVIUni::fgLocalName, attr->getLocalName());
|
---|
955 | sendElementValue(PSVIUni::fgPrefix, attr->getPrefix());
|
---|
956 | sendElementValue(PSVIUni::fgNormalizedValue, attr->getValue());
|
---|
957 | sendElementValue(PSVIUni::fgSpecified, translateBool(attr->getSpecified()));
|
---|
958 | sendElementValue(PSVIUni::fgAttributeType, attr->getTypeInfo()->getName());
|
---|
959 | sendElementEmpty(PSVIUni::fgReferences);
|
---|
960 | sendUnindentedElement(PSVIUni::fgAttribute);
|
---|
961 | }
|
---|
962 | sendUnindentedElement(PSVIUni::fgNamespaceAttributes);
|
---|
963 | }
|
---|
964 | }
|
---|
965 |
|
---|
966 | void PSVIWriterHandlers::processWildcard(XSWildcard* wildcard) {
|
---|
967 | if (wildcard == NULL) {
|
---|
968 | sendElementEmpty(PSVIUni::fgWildcard);
|
---|
969 | } else {
|
---|
970 | sendIndentedElement(PSVIUni::fgWildcard);
|
---|
971 | sendIndentedElement(PSVIUni::fgNamespaceConstraint);
|
---|
972 | if (wildcard->getConstraintType()==XSWildcard::NSCONSTRAINT_ANY) {
|
---|
973 | sendElementValue(PSVIUni::fgVariety, PSVIUni::fgAny);
|
---|
974 | sendElementEmpty(PSVIUni::fgNamespaces);
|
---|
975 | } else {
|
---|
976 | if (wildcard->getConstraintType()==XSWildcard::NSCONSTRAINT_DERIVATION_LIST) {
|
---|
977 | sendElementEmpty(PSVIUni::fgVariety);
|
---|
978 | sendElementValueList(PSVIUni::fgNamespaces, wildcard->getNsConstraintList());
|
---|
979 | } else { //NSCONSTRAINT_NOT
|
---|
980 | sendElementValue(PSVIUni::fgVariety, PSVIUni::fgNot);
|
---|
981 | sendElementValueList(PSVIUni::fgNamespaces, wildcard->getNsConstraintList());
|
---|
982 | }
|
---|
983 | }
|
---|
984 | sendUnindentedElement(PSVIUni::fgNamespaceConstraint);
|
---|
985 | sendElementValue(PSVIUni::fgProcessContents,
|
---|
986 | translateProcessContents(wildcard->getProcessContents()));
|
---|
987 | processAnnotation(wildcard->getAnnotation());
|
---|
988 | sendUnindentedElement(PSVIUni::fgWildcard);
|
---|
989 | }
|
---|
990 | }
|
---|
991 |
|
---|
992 | void PSVIWriterHandlers::processModelGroup(XSModelGroup* modelGroup) {
|
---|
993 | if (modelGroup == NULL) {
|
---|
994 | sendElementEmpty(PSVIUni::fgModelGroup);
|
---|
995 | } else {
|
---|
996 | sendIndentedElement(PSVIUni::fgModelGroup);
|
---|
997 | sendElementValue(PSVIUni::fgCompositor, translateCompositor(modelGroup->getCompositor()));
|
---|
998 | sendIndentedElement(PSVIUni::fgParticles);
|
---|
999 | for (unsigned int i=0; i < modelGroup->getParticles()->size(); i++) {
|
---|
1000 | processParticle(modelGroup->getParticles()->elementAt(i));
|
---|
1001 | }
|
---|
1002 | sendUnindentedElement(PSVIUni::fgParticles);
|
---|
1003 | processAnnotation(modelGroup->getAnnotation());
|
---|
1004 | sendUnindentedElement(PSVIUni::fgModelGroup);
|
---|
1005 | }
|
---|
1006 | }
|
---|
1007 |
|
---|
1008 | void PSVIWriterHandlers::processParticle(XSParticle* particle) {
|
---|
1009 | if (particle == NULL) {
|
---|
1010 | sendElementEmpty(PSVIUni::fgParticle);
|
---|
1011 | } else {
|
---|
1012 | sendIndentedElement(PSVIUni::fgParticle);
|
---|
1013 | sendElementValueInt(PSVIUni::fgMinOccurs, particle->getMinOccurs());
|
---|
1014 | if (particle->getMaxOccursUnbounded()) {
|
---|
1015 | sendElementValue(PSVIUni::fgMaxOccurs, PSVIUni::fgUnbounded);
|
---|
1016 | } else {
|
---|
1017 | sendElementValueInt(PSVIUni::fgMaxOccurs,particle->getMaxOccurs());
|
---|
1018 | }
|
---|
1019 | sendIndentedElement(PSVIUni::fgTerm);
|
---|
1020 | switch (particle->getTermType()) {
|
---|
1021 | case XSParticle::TERM_ELEMENT:
|
---|
1022 | processElementDeclarationOrRef(particle->getElementTerm());
|
---|
1023 | break;
|
---|
1024 | case XSParticle::TERM_MODELGROUP:
|
---|
1025 | processModelGroup(particle->getModelGroupTerm());
|
---|
1026 | break;
|
---|
1027 | case XSParticle::TERM_WILDCARD:
|
---|
1028 | processWildcard(particle->getWildcardTerm());
|
---|
1029 | }
|
---|
1030 | sendUnindentedElement(PSVIUni::fgTerm);
|
---|
1031 | sendUnindentedElement(PSVIUni::fgParticle);
|
---|
1032 | }
|
---|
1033 | }
|
---|
1034 |
|
---|
1035 | void PSVIWriterHandlers::processAttributeWildcard(XSWildcard* wildcard) {
|
---|
1036 | if (wildcard == NULL) {
|
---|
1037 | sendElementEmpty(PSVIUni::fgAttributeWildcard);
|
---|
1038 | } else {
|
---|
1039 | sendIndentedElement(PSVIUni::fgAttributeWildcard);
|
---|
1040 | processWildcard(wildcard);
|
---|
1041 | sendUnindentedElement(PSVIUni::fgAttributeWildcard);
|
---|
1042 | }
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | void PSVIWriterHandlers::processScope(XSComplexTypeDefinition* enclosingCTD, short scope) {
|
---|
1046 | switch (scope) {
|
---|
1047 | case XSConstants::SCOPE_ABSENT:
|
---|
1048 | sendElementEmpty(PSVIUni::fgScope);
|
---|
1049 | break;
|
---|
1050 | case XSConstants::SCOPE_LOCAL:
|
---|
1051 | sendIndentedElement(PSVIUni::fgScope);
|
---|
1052 | sendReference(PSVIUni::fgComplexTypeDefinition, enclosingCTD);
|
---|
1053 | sendUnindentedElement(PSVIUni::fgScope);
|
---|
1054 | break;
|
---|
1055 | case XSConstants::SCOPE_GLOBAL:
|
---|
1056 | sendElementValue(PSVIUni::fgScope, PSVIUni::fgGlobal);
|
---|
1057 | }
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 | void PSVIWriterHandlers::processValueConstraint(XSConstants::VALUE_CONSTRAINT valueConstraintType, const XMLCh* constraintValue) {
|
---|
1061 | if (valueConstraintType == XSConstants::VALUE_CONSTRAINT_NONE) {
|
---|
1062 | sendElementEmpty(PSVIUni::fgValueConstraint);
|
---|
1063 | } else {
|
---|
1064 | sendIndentedElement(PSVIUni::fgValueConstraint);
|
---|
1065 | sendElementValue(PSVIUni::fgVariety, translateValueConstraint(valueConstraintType));
|
---|
1066 | sendElementValue(PSVIUni::fgValue, constraintValue);
|
---|
1067 | sendUnindentedElement(PSVIUni::fgValueConstraint);
|
---|
1068 | }
|
---|
1069 | }
|
---|
1070 |
|
---|
1071 | void PSVIWriterHandlers::processIdentityConstraintDefinition(XSNamedMap<XSIDCDefinition>* idConstraint) {
|
---|
1072 | if (idConstraint == NULL) {
|
---|
1073 | sendElementEmpty(PSVIUni::fgIdentityConstraintDefinitions);
|
---|
1074 | } else {
|
---|
1075 | sendIndentedElement(PSVIUni::fgIdentityConstraintDefinitions);
|
---|
1076 | for (unsigned int i=0; i < idConstraint->getLength(); i++) {
|
---|
1077 | XSIDCDefinition* constraint = idConstraint->item(i);
|
---|
1078 | sendIndentedElementWithID(PSVIUni::fgIdentityConstraintDefinition, (XSObject*) constraint);
|
---|
1079 | sendElementValue(PSVIUni::fgName, constraint->getName());
|
---|
1080 | sendElementValue(PSVIUni::fgTargetNamespace, constraint->getNamespace());
|
---|
1081 | sendElementValue(PSVIUni::fgIdentityConstraintCategory, translateIdConstraintCategory(constraint->getCategory()));
|
---|
1082 | sendIndentedElement(PSVIUni::fgSelector);
|
---|
1083 | processXPath(constraint->getSelectorStr());
|
---|
1084 | sendUnindentedElement(PSVIUni::fgSelector);
|
---|
1085 | processFields(constraint->getFieldStrs());
|
---|
1086 | sendReference(PSVIUni::fgReferencedKey, constraint->getRefKey());
|
---|
1087 | processAnnotations(constraint->getAnnotations());
|
---|
1088 | sendUnindentedElement(PSVIUni::fgIdentityConstraintDefinition);
|
---|
1089 | }
|
---|
1090 | sendUnindentedElement(PSVIUni::fgIdentityConstraintDefinitions);
|
---|
1091 | }
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 | void PSVIWriterHandlers::processFields(StringList* fields) {
|
---|
1095 | sendIndentedElement(PSVIUni::fgFields);
|
---|
1096 | for (unsigned int i=0; i < fields->size(); i++) {
|
---|
1097 | processXPath(fields->elementAt(i));
|
---|
1098 | }
|
---|
1099 | sendUnindentedElement(PSVIUni::fgFields);
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | void PSVIWriterHandlers::processXPath(const XMLCh* xpath) {
|
---|
1103 | sendIndentedElement(PSVIUni::fgXpath);
|
---|
1104 | sendElementValue(PSVIUni::fgXpath, xpath);
|
---|
1105 | sendUnindentedElement(PSVIUni::fgXpath);
|
---|
1106 | }
|
---|
1107 |
|
---|
1108 | void PSVIWriterHandlers::processChildren() {
|
---|
1109 | if (!fElementChildren->empty() && !fElementChildren->peek()) {
|
---|
1110 | fElementChildren->pop();
|
---|
1111 | sendIndentedElement(PSVIUni::fgChildren);
|
---|
1112 | fElementChildren->push(true);
|
---|
1113 | }
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | void PSVIWriterHandlers::processChildrenEnd() {
|
---|
1117 | if (fElementChildren->pop()) {
|
---|
1118 | sendUnindentedElement(PSVIUni::fgChildren);
|
---|
1119 | } else {
|
---|
1120 | writeEmpty(PSVIUni::fgChildren);
|
---|
1121 | }
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | void PSVIWriterHandlers::processTypeDefinitionOrRef(const XMLCh* enclose, XSTypeDefinition* type) {
|
---|
1125 | if (type==NULL) {
|
---|
1126 | sendElementEmpty(enclose);
|
---|
1127 | } else {
|
---|
1128 | sendIndentedElement(enclose);
|
---|
1129 | if (type->getAnonymous() && !(fDefinedIds->containsElement(type))) {
|
---|
1130 | processTypeDefinition(type);
|
---|
1131 | } else {
|
---|
1132 | if (type->getTypeCategory() == XSTypeDefinition::SIMPLE_TYPE) {
|
---|
1133 | sendReference(PSVIUni::fgSimpleTypeDefinition, type);
|
---|
1134 | } else {
|
---|
1135 | sendReference(PSVIUni::fgComplexTypeDefinition, type);
|
---|
1136 | }
|
---|
1137 | }
|
---|
1138 | sendUnindentedElement(enclose);
|
---|
1139 | }
|
---|
1140 | }
|
---|
1141 |
|
---|
1142 | void PSVIWriterHandlers::processSimpleTypeDefinitionOrRef(XSSimpleTypeDefinition* type) {
|
---|
1143 | if (type==NULL) {
|
---|
1144 | sendElementEmpty(PSVIUni::fgSimpleTypeDefinition);
|
---|
1145 | } else {
|
---|
1146 | if (type->getAnonymous() && !(fDefinedIds->containsElement(type))) {
|
---|
1147 | processSimpleTypeDefinition(type);
|
---|
1148 | } else {
|
---|
1149 | sendReference(PSVIUni::fgSimpleTypeDefinition, type);
|
---|
1150 | }
|
---|
1151 | }
|
---|
1152 | }
|
---|
1153 |
|
---|
1154 | void PSVIWriterHandlers::processAttributeDeclarationOrRef(XSAttributeDeclaration* attrDecl) {
|
---|
1155 | if (attrDecl==NULL) {
|
---|
1156 | sendElementEmpty(PSVIUni::fgAttributeDeclaration);
|
---|
1157 | } else {
|
---|
1158 | if (fDefinedIds->containsElement(attrDecl) ||
|
---|
1159 | (attrDecl->getScope() == XSConstants::SCOPE_GLOBAL)) {
|
---|
1160 | sendReference(PSVIUni::fgAttributeDeclaration, attrDecl);
|
---|
1161 | } else {
|
---|
1162 | processAttributeDeclaration(attrDecl);
|
---|
1163 | }
|
---|
1164 | }
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | void PSVIWriterHandlers::processElementDeclarationOrRef(XSElementDeclaration* elemDecl) {
|
---|
1168 | if (elemDecl==NULL) {
|
---|
1169 | sendElementEmpty(PSVIUni::fgElementDeclaration);
|
---|
1170 | } else {
|
---|
1171 | if (fDefinedIds->containsElement(elemDecl) ||
|
---|
1172 | (elemDecl->getScope() == XSConstants::SCOPE_GLOBAL)) {
|
---|
1173 | sendReference(PSVIUni::fgElementDeclaration, elemDecl);
|
---|
1174 | } else {
|
---|
1175 | processElementDeclaration(elemDecl);
|
---|
1176 | }
|
---|
1177 | }
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | void PSVIWriterHandlers::processTypeDefinitionRef(const XMLCh* enclose, XSTypeDefinition* type) {
|
---|
1181 | if (type==NULL) {
|
---|
1182 | sendElementEmpty(enclose);
|
---|
1183 | } else {
|
---|
1184 | sendIndentedElement(enclose);
|
---|
1185 | if (type->getTypeCategory() == XSTypeDefinition::SIMPLE_TYPE) {
|
---|
1186 | sendReference(PSVIUni::fgSimpleTypeDefinition, type);
|
---|
1187 | } else {
|
---|
1188 | sendReference(PSVIUni::fgComplexTypeDefinition, type);
|
---|
1189 | }
|
---|
1190 | sendUnindentedElement(enclose);
|
---|
1191 | }
|
---|
1192 | }
|
---|
1193 |
|
---|
1194 | void PSVIWriterHandlers::processAttributeDeclarationRef(const XMLCh* enclose, XSAttributeDeclaration* attrDecl) {
|
---|
1195 | if (attrDecl == NULL) {
|
---|
1196 | sendElementEmpty(PSVIUni::fgDeclaration);
|
---|
1197 | } else {
|
---|
1198 | sendIndentedElement(PSVIUni::fgDeclaration);
|
---|
1199 | sendReference(PSVIUni::fgAttributeDeclaration, attrDecl);
|
---|
1200 | sendUnindentedElement(PSVIUni::fgDeclaration);
|
---|
1201 | }
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | void PSVIWriterHandlers::processElementDeclarationRef(const XMLCh* enclose, XSElementDeclaration* elemDecl) {
|
---|
1205 | if (elemDecl==NULL) {
|
---|
1206 | sendElementEmpty(enclose);
|
---|
1207 | } else {
|
---|
1208 | sendIndentedElement(enclose);
|
---|
1209 | sendReference(PSVIUni::fgElementDeclaration, elemDecl);
|
---|
1210 | sendUnindentedElement(enclose);
|
---|
1211 | }
|
---|
1212 | }
|
---|
1213 |
|
---|
1214 | void PSVIWriterHandlers::sendReference(const XMLCh* elementName, XSObject* obj) {
|
---|
1215 | if (obj==NULL) {
|
---|
1216 | sendElementEmpty(elementName);
|
---|
1217 | } else {
|
---|
1218 | fAttrList->removeAllElements();
|
---|
1219 | fAttrList->addElement((XMLCh*)gRef);
|
---|
1220 | fAttrList->addElement((XMLCh*)getIdName(obj));
|
---|
1221 | fAttrList->addElement((XMLCh*)fgXsiNil);
|
---|
1222 | fAttrList->addElement((XMLCh*)PSVIUni::fgTrue);
|
---|
1223 | writeEmpty(elementName, fAttrList);
|
---|
1224 | }
|
---|
1225 | }
|
---|
1226 |
|
---|
1227 | void PSVIWriterHandlers::sendElementEmpty(const XMLCh* const elementName) {
|
---|
1228 | fAttrList->removeAllElements();
|
---|
1229 | fAttrList->addElement((XMLCh*)fgXsiNil);
|
---|
1230 | fAttrList->addElement((XMLCh*)PSVIUni::fgTrue);
|
---|
1231 | writeEmpty(elementName, fAttrList);
|
---|
1232 | }
|
---|
1233 |
|
---|
1234 | void PSVIWriterHandlers::sendElementValueInt(const XMLCh* elementName, int value) {
|
---|
1235 | XMLString::binToText(value, fTempResult, 50, 10);
|
---|
1236 | writeValue(elementName, fTempResult);
|
---|
1237 | }
|
---|
1238 |
|
---|
1239 | void PSVIWriterHandlers::sendElementValue(const XMLCh* const elementName, const XMLCh* const value) {
|
---|
1240 | if (value==NULL || XMLString::equals(value, XMLUni::fgZeroLenString)) {
|
---|
1241 | sendElementEmpty(elementName);
|
---|
1242 | } else {
|
---|
1243 | writeValue(elementName, value);
|
---|
1244 | }
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | void PSVIWriterHandlers::sendElementValueList(const XMLCh* const elementName, const StringList* values) {
|
---|
1248 | if (values==NULL) {
|
---|
1249 | sendElementEmpty(elementName);
|
---|
1250 | } else {
|
---|
1251 | writeValue(elementName, values);
|
---|
1252 | }
|
---|
1253 | }
|
---|
1254 |
|
---|
1255 | void PSVIWriterHandlers::sendIndentedElement(const XMLCh* const elementName) {
|
---|
1256 | writeOpen(elementName);
|
---|
1257 | incIndent();
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | void PSVIWriterHandlers::sendIndentedElementWithID(const XMLCh* elementName, XSObject* obj) {
|
---|
1261 | fDefinedIds->addElement(obj);
|
---|
1262 | fAttrList->removeAllElements();
|
---|
1263 | fAttrList->addElement((XMLCh*)gId);
|
---|
1264 | fAttrList->addElement((XMLCh*)getIdName(obj));
|
---|
1265 | writeOpen(elementName, fAttrList);
|
---|
1266 | incIndent();
|
---|
1267 | }
|
---|
1268 |
|
---|
1269 | void PSVIWriterHandlers::sendUnindentedElement(const XMLCh* elementName) {
|
---|
1270 | decIndent();
|
---|
1271 | writeClose(elementName);
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | void PSVIWriterHandlers::writeOpen(const XMLCh* const elementName) {
|
---|
1275 | *fFormatter
|
---|
1276 | << XMLFormatter::NoEscapes << fIndentChars << chOpenAngle << elementName << gAngleFeed;
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | void PSVIWriterHandlers::writeOpen(const XMLCh* const elementName, const StringList* const attrs) {
|
---|
1280 | *fFormatter
|
---|
1281 | << XMLFormatter::NoEscapes << fIndentChars << chOpenAngle << elementName ;
|
---|
1282 | for (unsigned int i=0; i < attrs->size(); i+=2 ) {
|
---|
1283 | *fFormatter
|
---|
1284 | << XMLFormatter::NoEscapes << chSpace << attrs->elementAt(i) << gEqualsQuote
|
---|
1285 | << XMLFormatter::AttrEscapes << attrs->elementAt(i+1)
|
---|
1286 | << XMLFormatter::NoEscapes << chDoubleQuote ;
|
---|
1287 | }
|
---|
1288 | *fFormatter
|
---|
1289 | << XMLFormatter::NoEscapes << gAngleFeed;
|
---|
1290 | }
|
---|
1291 |
|
---|
1292 | void PSVIWriterHandlers::writeClose(const XMLCh* const elementName) {
|
---|
1293 | *fFormatter
|
---|
1294 | << XMLFormatter::NoEscapes << fIndentChars << gAngleSlash << elementName << gAngleFeed;
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | void PSVIWriterHandlers::writeValue(const XMLCh* const elementName, const XMLCh* const value) {
|
---|
1298 | *fFormatter
|
---|
1299 | << XMLFormatter::NoEscapes << fIndentChars << chOpenAngle << elementName << chCloseAngle
|
---|
1300 | << XMLFormatter::CharEscapes << value
|
---|
1301 | << XMLFormatter::NoEscapes << gAngleSlash << elementName << gAngleFeed ;
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | void PSVIWriterHandlers::writeValue(const XMLCh* const elementName, const StringList* values) {
|
---|
1305 | *fFormatter
|
---|
1306 | << XMLFormatter::NoEscapes << fIndentChars << chOpenAngle << elementName << chCloseAngle;
|
---|
1307 | for (unsigned int i=0; i < values->size(); i++) {
|
---|
1308 | *fFormatter
|
---|
1309 | << XMLFormatter::CharEscapes << values->elementAt(i) << chSpace;
|
---|
1310 | }
|
---|
1311 | *fFormatter
|
---|
1312 | << XMLFormatter::NoEscapes << gAngleSlash << elementName << gAngleFeed ;
|
---|
1313 | }
|
---|
1314 |
|
---|
1315 | void PSVIWriterHandlers::writeEmpty(const XMLCh* const elementName, const StringList* const attrs) {
|
---|
1316 | *fFormatter
|
---|
1317 | << XMLFormatter::NoEscapes << fIndentChars << chOpenAngle << elementName ;
|
---|
1318 | for (unsigned int i=0; i < attrs->size(); i+=2 ) {
|
---|
1319 | *fFormatter
|
---|
1320 | << XMLFormatter::NoEscapes << chSpace << attrs->elementAt(i) << gEqualsQuote
|
---|
1321 | << XMLFormatter::AttrEscapes << attrs->elementAt(i+1)
|
---|
1322 | << XMLFormatter::NoEscapes << chDoubleQuote ;
|
---|
1323 | }
|
---|
1324 | *fFormatter
|
---|
1325 | << XMLFormatter::NoEscapes << gSlashAngleFeed ;
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 | void PSVIWriterHandlers::writeEmpty(const XMLCh* const elementName) {
|
---|
1329 | *fFormatter
|
---|
1330 | << XMLFormatter::NoEscapes << fIndentChars << chOpenAngle << elementName << gSlashAngleFeed ;
|
---|
1331 | }
|
---|
1332 |
|
---|
1333 | void PSVIWriterHandlers::writeString(const XMLCh* const string) {
|
---|
1334 | *fFormatter
|
---|
1335 | << XMLFormatter::NoEscapes << fIndentChars << string;
|
---|
1336 | }
|
---|
1337 |
|
---|
1338 | const XMLCh* PSVIWriterHandlers::translateScope(XSConstants::SCOPE scope) {
|
---|
1339 | switch (scope) {
|
---|
1340 | case XSConstants::SCOPE_ABSENT :
|
---|
1341 | return NULL;
|
---|
1342 | case XSConstants::SCOPE_GLOBAL :
|
---|
1343 | return PSVIUni::fgGlobal;
|
---|
1344 | case XSConstants::SCOPE_LOCAL :
|
---|
1345 | return PSVIUni::fgLocal;
|
---|
1346 | default :
|
---|
1347 | return PSVIUni::fgUnknown;
|
---|
1348 | }
|
---|
1349 | }
|
---|
1350 |
|
---|
1351 | const XMLCh* PSVIWriterHandlers::translateValueConstraint(XSConstants::VALUE_CONSTRAINT constraintKind) {
|
---|
1352 | switch (constraintKind) {
|
---|
1353 | case XSConstants::VALUE_CONSTRAINT_DEFAULT :
|
---|
1354 | return PSVIUni::fgDefault;
|
---|
1355 | case XSConstants::VALUE_CONSTRAINT_FIXED :
|
---|
1356 | return PSVIUni::fgFixed;
|
---|
1357 | default :
|
---|
1358 | return PSVIUni::fgUnknown;
|
---|
1359 | }
|
---|
1360 | }
|
---|
1361 |
|
---|
1362 | const XMLCh* PSVIWriterHandlers::translateBlockOrFinal(short val) {
|
---|
1363 | XMLString::copyString(fTempResult, XMLUni::fgZeroLenString);
|
---|
1364 | if ((val & XSConstants::DERIVATION_EXTENSION) != 0) {
|
---|
1365 | XMLString::catString(fTempResult, PSVIUni::fgExtension);
|
---|
1366 | }
|
---|
1367 | if ((val & XSConstants::DERIVATION_RESTRICTION) != 0) {
|
---|
1368 | if (XMLString::stringLen(fTempResult) != 0)
|
---|
1369 | XMLString::catString(fTempResult, fgSpace);
|
---|
1370 | XMLString::catString(fTempResult, PSVIUni::fgRestriction);
|
---|
1371 | }
|
---|
1372 | if ((val & XSConstants::DERIVATION_LIST) != 0) {
|
---|
1373 | if (XMLString::stringLen(fTempResult) != 0)
|
---|
1374 | XMLString::catString(fTempResult, fgSpace);
|
---|
1375 | XMLString::catString(fTempResult, PSVIUni::fgList);
|
---|
1376 | }
|
---|
1377 | if ((val & XSConstants::DERIVATION_UNION) != 0) {
|
---|
1378 | if (XMLString::stringLen(fTempResult) != 0)
|
---|
1379 | XMLString::catString(fTempResult, fgSpace);
|
---|
1380 | XMLString::catString(fTempResult, PSVIUni::fgUnion);
|
---|
1381 | }
|
---|
1382 | if ((val & XSConstants::DERIVATION_SUBSTITUTION) != 0) {
|
---|
1383 | if (XMLString::stringLen(fTempResult) != 0)
|
---|
1384 | XMLString::catString(fTempResult, fgSpace);
|
---|
1385 | XMLString::catString(fTempResult, PSVIUni::fgSubstitution);
|
---|
1386 | }
|
---|
1387 | return fTempResult;
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | const XMLCh* PSVIWriterHandlers::translateDerivationMethod(XSConstants::DERIVATION_TYPE derivation) {
|
---|
1391 | switch (derivation) {
|
---|
1392 | case XSConstants::DERIVATION_EXTENSION :
|
---|
1393 | return PSVIUni::fgExtension;
|
---|
1394 | case XSConstants::DERIVATION_LIST :
|
---|
1395 | return PSVIUni::fgList;
|
---|
1396 | case XSConstants::DERIVATION_RESTRICTION :
|
---|
1397 | return PSVIUni::fgRestriction;
|
---|
1398 | case XSConstants::DERIVATION_SUBSTITUTION :
|
---|
1399 | return PSVIUni::fgSubstitution;
|
---|
1400 | case XSConstants::DERIVATION_UNION :
|
---|
1401 | return PSVIUni::fgUnion;
|
---|
1402 | case XSConstants::DERIVATION_NONE :
|
---|
1403 | return NULL;
|
---|
1404 | default :
|
---|
1405 | return PSVIUni::fgUnknown;
|
---|
1406 | }
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | const XMLCh* PSVIWriterHandlers::translateProcessContents(XSWildcard::PROCESS_CONTENTS processContents) {
|
---|
1410 | switch (processContents) {
|
---|
1411 | case XSWildcard::PC_LAX :
|
---|
1412 | return PSVIUni::fgLax;
|
---|
1413 | case XSWildcard::PC_SKIP :
|
---|
1414 | return PSVIUni::fgSkip;
|
---|
1415 | case XSWildcard::PC_STRICT :
|
---|
1416 | return PSVIUni::fgStrict;
|
---|
1417 | default :
|
---|
1418 | return PSVIUni::fgUnknown;
|
---|
1419 | }
|
---|
1420 | }
|
---|
1421 |
|
---|
1422 | const XMLCh* PSVIWriterHandlers::translateCompositor(XSModelGroup::COMPOSITOR_TYPE compositor) {
|
---|
1423 | switch (compositor) {
|
---|
1424 | case XSModelGroup::COMPOSITOR_SEQUENCE :
|
---|
1425 | return PSVIUni::fgSequence;
|
---|
1426 | case XSModelGroup::COMPOSITOR_CHOICE :
|
---|
1427 | return PSVIUni::fgChoice;
|
---|
1428 | case XSModelGroup::COMPOSITOR_ALL :
|
---|
1429 | return PSVIUni::fgAll;
|
---|
1430 | default :
|
---|
1431 | return PSVIUni::fgUnknown;
|
---|
1432 | }
|
---|
1433 | }
|
---|
1434 |
|
---|
1435 | const XMLCh* PSVIWriterHandlers::translateValidity(PSVIItem::VALIDITY_STATE validity) {
|
---|
1436 | switch (validity) {
|
---|
1437 | case PSVIItem::VALIDITY_NOTKNOWN :
|
---|
1438 | return PSVIUni::fgNotKnown;
|
---|
1439 | case PSVIItem::VALIDITY_VALID :
|
---|
1440 | return PSVIUni::fgValid;
|
---|
1441 | case PSVIItem::VALIDITY_INVALID :
|
---|
1442 | return PSVIUni::fgInvalid;
|
---|
1443 | default :
|
---|
1444 | return PSVIUni::fgUnknown;
|
---|
1445 | }
|
---|
1446 | }
|
---|
1447 |
|
---|
1448 | const XMLCh* PSVIWriterHandlers::translateValidationAttempted(PSVIItem::ASSESSMENT_TYPE validation) {
|
---|
1449 | switch (validation) {
|
---|
1450 | case PSVIItem::VALIDATION_NONE :
|
---|
1451 | return PSVIUni::fgNone;
|
---|
1452 | case PSVIItem::VALIDATION_PARTIAL :
|
---|
1453 | return PSVIUni::fgPartial;
|
---|
1454 | case PSVIItem::VALIDATION_FULL :
|
---|
1455 | return PSVIUni::fgFull;
|
---|
1456 | default :
|
---|
1457 | return PSVIUni::fgUnknown;
|
---|
1458 | }
|
---|
1459 | }
|
---|
1460 |
|
---|
1461 | const XMLCh* PSVIWriterHandlers::translateIdConstraintCategory(XSIDCDefinition::IC_CATEGORY category) {
|
---|
1462 | switch (category) {
|
---|
1463 | case XSIDCDefinition::IC_KEY :
|
---|
1464 | return PSVIUni::fgKey;
|
---|
1465 | case XSIDCDefinition::IC_KEYREF :
|
---|
1466 | return PSVIUni::fgKeyref;
|
---|
1467 | case XSIDCDefinition::IC_UNIQUE :
|
---|
1468 | return PSVIUni::fgUnique;
|
---|
1469 | default :
|
---|
1470 | return PSVIUni::fgUnknown;
|
---|
1471 | }
|
---|
1472 | }
|
---|
1473 |
|
---|
1474 | const XMLCh* PSVIWriterHandlers::translateComplexContentType(XSComplexTypeDefinition::CONTENT_TYPE contentType) {
|
---|
1475 | switch (contentType) {
|
---|
1476 | case XSComplexTypeDefinition::CONTENTTYPE_ELEMENT :
|
---|
1477 | return PSVIUni::fgElementOnly;
|
---|
1478 | case XSComplexTypeDefinition::CONTENTTYPE_EMPTY :
|
---|
1479 | return PSVIUni::fgEmpty;
|
---|
1480 | case XSComplexTypeDefinition::CONTENTTYPE_MIXED :
|
---|
1481 | return PSVIUni::fgMixed;
|
---|
1482 | case XSComplexTypeDefinition::CONTENTTYPE_SIMPLE :
|
---|
1483 | return PSVIUni::fgSimple;
|
---|
1484 | default :
|
---|
1485 | return PSVIUni::fgUnknown;
|
---|
1486 | }
|
---|
1487 | }
|
---|
1488 |
|
---|
1489 | const XMLCh* PSVIWriterHandlers::translateSimpleTypeVariety(XSSimpleTypeDefinition::VARIETY variety) {
|
---|
1490 | switch (variety) {
|
---|
1491 | case XSSimpleTypeDefinition::VARIETY_LIST :
|
---|
1492 | return PSVIUni::fgList;
|
---|
1493 | case XSSimpleTypeDefinition::VARIETY_UNION :
|
---|
1494 | return PSVIUni::fgUnion;
|
---|
1495 | case XSSimpleTypeDefinition::VARIETY_ATOMIC :
|
---|
1496 | return PSVIUni::fgAtomic;
|
---|
1497 | case XSSimpleTypeDefinition::VARIETY_ABSENT :
|
---|
1498 | return NULL;
|
---|
1499 | default :
|
---|
1500 | return PSVIUni::fgUnknown;
|
---|
1501 | }
|
---|
1502 | }
|
---|
1503 |
|
---|
1504 | const XMLCh* PSVIWriterHandlers::translateOrderedFacet(XSSimpleTypeDefinition::ORDERING ordered) {
|
---|
1505 | switch (ordered) {
|
---|
1506 | case XSSimpleTypeDefinition::ORDERED_FALSE:
|
---|
1507 | return PSVIUni::fgFalse;
|
---|
1508 | case XSSimpleTypeDefinition::ORDERED_PARTIAL:
|
---|
1509 | return PSVIUni::fgPartial;
|
---|
1510 | case XSSimpleTypeDefinition::ORDERED_TOTAL:
|
---|
1511 | return PSVIUni::fgTotal;
|
---|
1512 | default :
|
---|
1513 | return PSVIUni::fgUnknown;
|
---|
1514 | }
|
---|
1515 | }
|
---|
1516 |
|
---|
1517 | const XMLCh* PSVIWriterHandlers::translateFacet(XSSimpleTypeDefinition::FACET facetKind) {
|
---|
1518 | switch (facetKind) {
|
---|
1519 | case XSSimpleTypeDefinition::FACET_WHITESPACE :
|
---|
1520 | return PSVIUni::fgWhiteSpace;
|
---|
1521 | case XSSimpleTypeDefinition::FACET_LENGTH :
|
---|
1522 | return PSVIUni::fgLength;
|
---|
1523 | case XSSimpleTypeDefinition::FACET_MINLENGTH :
|
---|
1524 | return PSVIUni::fgMinLength;
|
---|
1525 | case XSSimpleTypeDefinition::FACET_MAXLENGTH :
|
---|
1526 | return PSVIUni::fgMaxLength;
|
---|
1527 | case XSSimpleTypeDefinition::FACET_TOTALDIGITS :
|
---|
1528 | return PSVIUni::fgTotalDigits;
|
---|
1529 | case XSSimpleTypeDefinition::FACET_FRACTIONDIGITS :
|
---|
1530 | return PSVIUni::fgFractionDigits;
|
---|
1531 | case XSSimpleTypeDefinition::FACET_PATTERN :
|
---|
1532 | return PSVIUni::fgPattern;
|
---|
1533 | case XSSimpleTypeDefinition::FACET_ENUMERATION :
|
---|
1534 | return PSVIUni::fgEnumeration;
|
---|
1535 | case XSSimpleTypeDefinition::FACET_MAXINCLUSIVE :
|
---|
1536 | return PSVIUni::fgMaxInclusive;
|
---|
1537 | case XSSimpleTypeDefinition::FACET_MAXEXCLUSIVE :
|
---|
1538 | return PSVIUni::fgMaxExclusive;
|
---|
1539 | case XSSimpleTypeDefinition::FACET_MINEXCLUSIVE :
|
---|
1540 | return PSVIUni::fgMinExclusive;
|
---|
1541 | case XSSimpleTypeDefinition::FACET_MININCLUSIVE :
|
---|
1542 | return PSVIUni::fgMinInclusive;
|
---|
1543 | default :
|
---|
1544 | return PSVIUni::fgUnknown;
|
---|
1545 | }
|
---|
1546 | }
|
---|
1547 |
|
---|
1548 | const XMLCh* PSVIWriterHandlers::translateComponentType(XSConstants::COMPONENT_TYPE type) {
|
---|
1549 | switch (type) {
|
---|
1550 | case XSConstants::TYPE_DEFINITION :
|
---|
1551 | return PSVIUni::fgType;
|
---|
1552 | case XSConstants::ANNOTATION :
|
---|
1553 | return PSVIUni::fgAnnot;
|
---|
1554 | case XSConstants::ATTRIBUTE_DECLARATION :
|
---|
1555 | return PSVIUni::fgAttr;
|
---|
1556 | case XSConstants::ATTRIBUTE_GROUP_DEFINITION :
|
---|
1557 | return PSVIUni::fgAg;
|
---|
1558 | case XSConstants::ATTRIBUTE_USE :
|
---|
1559 | return PSVIUni::fgAu;
|
---|
1560 | case XSConstants::ELEMENT_DECLARATION :
|
---|
1561 | return PSVIUni::fgElt;
|
---|
1562 | case XSConstants::MODEL_GROUP_DEFINITION :
|
---|
1563 | return PSVIUni::fgMg;
|
---|
1564 | case XSConstants::NOTATION_DECLARATION :
|
---|
1565 | return PSVIUni::fgNot;
|
---|
1566 | case XSConstants::IDENTITY_CONSTRAINT :
|
---|
1567 | return PSVIUni::fgIdc;
|
---|
1568 | default :
|
---|
1569 | return PSVIUni::fgUnknown;
|
---|
1570 | }
|
---|
1571 | }
|
---|
1572 |
|
---|
1573 | const XMLCh* PSVIWriterHandlers::translateBool(bool flag) {
|
---|
1574 | return (flag ? PSVIUni::fgTrue : PSVIUni::fgFalse);
|
---|
1575 | }
|
---|
1576 |
|
---|
1577 | XMLCh* PSVIWriterHandlers::createID(XSObject* obj) {
|
---|
1578 | const XMLCh* objPrefix = fPrefixMap->get(obj->getNamespace());
|
---|
1579 | XMLCh* result = new XMLCh[100];
|
---|
1580 |
|
---|
1581 | if (XMLString::equals(obj->getNamespace(), PSVIUni::fgNamespaceXmlSchema)) {
|
---|
1582 | XMLString::copyString(result, obj->getName());
|
---|
1583 | } else {
|
---|
1584 | const XMLCh period[] = { chPeriod, chNull };
|
---|
1585 | XMLCh anonNum[6];
|
---|
1586 | bool hasPrefix = objPrefix!=NULL && XMLString::stringLen(objPrefix)!=0;
|
---|
1587 | if (hasPrefix) {
|
---|
1588 | XMLString::copyString(result, objPrefix);
|
---|
1589 | XMLString::catString(result, period);
|
---|
1590 | XMLString::catString(result, translateComponentType(obj->getType()));
|
---|
1591 | } else {
|
---|
1592 | XMLString::copyString(result, translateComponentType(obj->getType()));
|
---|
1593 | }
|
---|
1594 | XMLString::catString(result, period);
|
---|
1595 |
|
---|
1596 | if (obj->getType()==XSConstants::TYPE_DEFINITION && ((XSTypeDefinition*)obj)->getAnonymous()) {
|
---|
1597 | const XMLCh anon[] = { chLatin_a, chLatin_n, chLatin_o, chLatin_n, chUnderscore, chNull };
|
---|
1598 | XMLString::catString(result, anon);
|
---|
1599 | XMLString::binToText(fAnonNum, anonNum, 5, 10);
|
---|
1600 | XMLString::catString(result, anonNum);
|
---|
1601 | fAnonNum++;
|
---|
1602 | } else {
|
---|
1603 | XMLString::catString(result, obj->getName());
|
---|
1604 | if (!hasPrefix) {
|
---|
1605 | XMLString::catString(result, period);
|
---|
1606 | XMLString::binToText(fAnonNum, anonNum, 5, 10);
|
---|
1607 | XMLString::catString(result, anonNum);
|
---|
1608 | fAnonNum++;
|
---|
1609 | }
|
---|
1610 | }
|
---|
1611 | }
|
---|
1612 | fIdNames->addElement(result);
|
---|
1613 | return result;
|
---|
1614 | }
|
---|
1615 |
|
---|
1616 | const XMLCh* PSVIWriterHandlers::getIdName(XSObject* obj) {
|
---|
1617 | XMLCh* objLoc = new XMLCh[9];
|
---|
1618 | XMLString::binToText((unsigned long)obj, objLoc, 8, 16);
|
---|
1619 | XMLCh* idName = fIdMap->get(objLoc);
|
---|
1620 | if (!idName) {
|
---|
1621 | idName = createID(obj);
|
---|
1622 | fIdMap->put(objLoc, idName);
|
---|
1623 | fObjectLocations->addElement(objLoc);
|
---|
1624 | } else {
|
---|
1625 | delete objLoc;
|
---|
1626 | }
|
---|
1627 | return idName;
|
---|
1628 | }
|
---|
1629 |
|
---|
1630 | void PSVIWriterHandlers::incIndent() {
|
---|
1631 | XMLCh tab[] = {chHTab, chNull};
|
---|
1632 | if (fIndent >= fIndentCap) {
|
---|
1633 | fIndentCap *= 2;
|
---|
1634 | XMLCh* temp = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate((fIndentCap+1)*sizeof(XMLCh));
|
---|
1635 | XMLString::copyString(temp, fIndentChars);
|
---|
1636 | XMLPlatformUtils::fgMemoryManager->deallocate(fIndentChars);
|
---|
1637 | fIndentChars = temp;
|
---|
1638 | }
|
---|
1639 | XMLString::catString(fIndentChars, tab);
|
---|
1640 | fIndent++;
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 | void PSVIWriterHandlers::decIndent() {
|
---|
1644 | fIndentChars[XMLString::stringLen(fIndentChars)-1] = chNull;
|
---|
1645 | fIndent--;
|
---|
1646 | }
|
---|
1647 |
|
---|
1648 | /***
|
---|
1649 | * yyyy-mm-ddThh:mm:ss.sssss
|
---|
1650 | ***/
|
---|
1651 | void PSVIWriterHandlers::formDateTime(XSValue* obj)
|
---|
1652 | {
|
---|
1653 |
|
---|
1654 | char buffer[1024];
|
---|
1655 | memset(buffer, 0, sizeof buffer);
|
---|
1656 | sprintf(buffer, "%d-%d-%dT%d:%d:%f", obj->fData.fValue.f_datetime.f_year
|
---|
1657 | , obj->fData.fValue.f_datetime.f_month
|
---|
1658 | , obj->fData.fValue.f_datetime.f_day
|
---|
1659 | , obj->fData.fValue.f_datetime.f_hour
|
---|
1660 | , obj->fData.fValue.f_datetime.f_min
|
---|
1661 | , obj->fData.fValue.f_datetime.f_second
|
---|
1662 | + obj->fData.fValue.f_datetime.f_milisec);
|
---|
1663 |
|
---|
1664 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1665 | ArrayJanitor<XMLCh> jan(value);
|
---|
1666 | writeValue(gDataValue, value);
|
---|
1667 | }
|
---|
1668 |
|
---|
1669 | /***
|
---|
1670 | * <actualValue>
|
---|
1671 | * <dataType>unsignedShort</dataType>
|
---|
1672 | * <dataValue>0</dataValue>
|
---|
1673 | * </actualValue>
|
---|
1674 | ***/
|
---|
1675 | void PSVIWriterHandlers::processActualValue(PSVIItem* item)
|
---|
1676 | {
|
---|
1677 | if (!item) return;
|
---|
1678 |
|
---|
1679 | XSValue* obj = item->getActualValue();
|
---|
1680 |
|
---|
1681 | if (obj)
|
---|
1682 | {
|
---|
1683 | char buffer[1024];
|
---|
1684 |
|
---|
1685 | writeString(gCommentStart);
|
---|
1686 | incIndent();
|
---|
1687 | writeOpen(gActualValue);
|
---|
1688 | incIndent();
|
---|
1689 |
|
---|
1690 | switch (obj->fData.f_datatype)
|
---|
1691 | {
|
---|
1692 | case XSValue::dt_boolean:
|
---|
1693 | {
|
---|
1694 | writeValue(gDataType, SchemaSymbols::fgDT_BOOLEAN);
|
---|
1695 | writeValue(gDataValue, XMLUni::fgBooleanValueSpace[obj->fData.fValue.f_bool? 0: 1]);
|
---|
1696 | }
|
---|
1697 | break;
|
---|
1698 | case XSValue::dt_decimal:
|
---|
1699 | {
|
---|
1700 | writeValue(gDataType, SchemaSymbols::fgDT_DECIMAL);
|
---|
1701 | sprintf( buffer,"%f", obj->fData.fValue.f_decimal.f_dvalue);
|
---|
1702 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1703 | ArrayJanitor<XMLCh> jan(value);
|
---|
1704 | writeValue(gDataValue, value);
|
---|
1705 | }
|
---|
1706 | break;
|
---|
1707 | case XSValue::dt_float:
|
---|
1708 | {
|
---|
1709 | writeValue(gDataType, SchemaSymbols::fgDT_FLOAT);
|
---|
1710 | sprintf( buffer,"%f", obj->fData.fValue.f_float);
|
---|
1711 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1712 | ArrayJanitor<XMLCh> jan(value);
|
---|
1713 | writeValue(gDataValue, value);
|
---|
1714 | }
|
---|
1715 | break;
|
---|
1716 | case XSValue::dt_double:
|
---|
1717 | {
|
---|
1718 | writeValue(gDataType, SchemaSymbols::fgDT_DOUBLE);
|
---|
1719 | sprintf( buffer,"%f", obj->fData.fValue.f_double);
|
---|
1720 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1721 | ArrayJanitor<XMLCh> jan(value);
|
---|
1722 | writeValue(gDataValue, value);
|
---|
1723 | }
|
---|
1724 | break;
|
---|
1725 | case XSValue::dt_duration:
|
---|
1726 | {
|
---|
1727 | writeValue(gDataType, SchemaSymbols::fgDT_DURATION);
|
---|
1728 | formDateTime(obj);
|
---|
1729 | }
|
---|
1730 | break;
|
---|
1731 | case XSValue::dt_dateTime:
|
---|
1732 | {
|
---|
1733 | writeValue(gDataType, SchemaSymbols::fgDT_DATETIME);
|
---|
1734 | formDateTime(obj);
|
---|
1735 | }
|
---|
1736 | break;
|
---|
1737 | case XSValue::dt_time:
|
---|
1738 | {
|
---|
1739 | writeValue(gDataType, SchemaSymbols::fgDT_TIME);
|
---|
1740 | formDateTime(obj);
|
---|
1741 | }
|
---|
1742 | break;
|
---|
1743 | case XSValue::dt_date:
|
---|
1744 | {
|
---|
1745 | writeValue(gDataType, SchemaSymbols::fgDT_DATE);
|
---|
1746 | formDateTime(obj);
|
---|
1747 | }
|
---|
1748 | break;
|
---|
1749 | case XSValue::dt_gYearMonth:
|
---|
1750 | {
|
---|
1751 | writeValue(gDataType, SchemaSymbols::fgDT_YEARMONTH);
|
---|
1752 | formDateTime(obj);
|
---|
1753 | }
|
---|
1754 | break;
|
---|
1755 | case XSValue::dt_gYear:
|
---|
1756 | {
|
---|
1757 | writeValue(gDataType, SchemaSymbols::fgDT_YEAR);
|
---|
1758 | formDateTime(obj);
|
---|
1759 | }
|
---|
1760 | break;
|
---|
1761 | case XSValue::dt_gMonthDay:
|
---|
1762 | {
|
---|
1763 | writeValue(gDataType, SchemaSymbols::fgDT_MONTHDAY);
|
---|
1764 | formDateTime(obj);
|
---|
1765 | }
|
---|
1766 | break;
|
---|
1767 | case XSValue::dt_gDay:
|
---|
1768 | {
|
---|
1769 | writeValue(gDataType, SchemaSymbols::fgDT_DAY);
|
---|
1770 | formDateTime(obj);
|
---|
1771 | }
|
---|
1772 | break;
|
---|
1773 | case XSValue::dt_gMonth:
|
---|
1774 | {
|
---|
1775 | writeValue(gDataType, SchemaSymbols::fgDT_MONTH);
|
---|
1776 | formDateTime(obj);
|
---|
1777 | }
|
---|
1778 | break;
|
---|
1779 | case XSValue::dt_hexBinary:
|
---|
1780 | {
|
---|
1781 | writeValue(gDataType, SchemaSymbols::fgDT_HEXBINARY);
|
---|
1782 | writeValue(gDataValue, obj->fData.fValue.f_strVal);
|
---|
1783 | }
|
---|
1784 | break;
|
---|
1785 | case XSValue::dt_base64Binary:
|
---|
1786 | {
|
---|
1787 | writeValue(gDataType, SchemaSymbols::fgDT_BASE64BINARY);
|
---|
1788 | writeValue(gDataValue, obj->fData.fValue.f_strVal);
|
---|
1789 | }
|
---|
1790 | break;
|
---|
1791 |
|
---|
1792 | case XSValue::dt_integer:
|
---|
1793 | {
|
---|
1794 | writeValue(gDataType, SchemaSymbols::fgDT_INTEGER);
|
---|
1795 | sprintf( buffer,"%d", obj->fData.fValue.f_long);
|
---|
1796 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1797 | ArrayJanitor<XMLCh> jan(value);
|
---|
1798 | writeValue(gDataValue, value);
|
---|
1799 | }
|
---|
1800 | break;
|
---|
1801 | case XSValue::dt_nonPositiveInteger:
|
---|
1802 | {
|
---|
1803 | writeValue(gDataType, SchemaSymbols::fgDT_NONPOSITIVEINTEGER);
|
---|
1804 | sprintf( buffer,"%d", obj->fData.fValue.f_long);
|
---|
1805 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1806 | ArrayJanitor<XMLCh> jan(value);
|
---|
1807 | writeValue(gDataValue, value);
|
---|
1808 | }
|
---|
1809 | break;
|
---|
1810 | case XSValue::dt_negativeInteger:
|
---|
1811 | {
|
---|
1812 | writeValue(gDataType, SchemaSymbols::fgDT_NEGATIVEINTEGER);
|
---|
1813 | sprintf( buffer,"%d", obj->fData.fValue.f_long);
|
---|
1814 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1815 | ArrayJanitor<XMLCh> jan(value);
|
---|
1816 | writeValue(gDataValue, value);
|
---|
1817 | }
|
---|
1818 | break;
|
---|
1819 | case XSValue::dt_long:
|
---|
1820 | {
|
---|
1821 | writeValue(gDataType, SchemaSymbols::fgDT_LONG);
|
---|
1822 | sprintf( buffer,"%d", obj->fData.fValue.f_long);
|
---|
1823 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1824 | ArrayJanitor<XMLCh> jan(value);
|
---|
1825 | writeValue(gDataValue, value);
|
---|
1826 | }
|
---|
1827 | break;
|
---|
1828 | case XSValue::dt_int:
|
---|
1829 | {
|
---|
1830 | writeValue(gDataType, SchemaSymbols::fgDT_INT);
|
---|
1831 | sprintf( buffer,"%d", obj->fData.fValue.f_int);
|
---|
1832 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1833 | ArrayJanitor<XMLCh> jan(value);
|
---|
1834 | writeValue(gDataValue, value);
|
---|
1835 | }
|
---|
1836 | break;
|
---|
1837 | case XSValue::dt_short:
|
---|
1838 | {
|
---|
1839 | writeValue(gDataType, SchemaSymbols::fgDT_SHORT);
|
---|
1840 | sprintf( buffer,"%d", obj->fData.fValue.f_short);
|
---|
1841 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1842 | ArrayJanitor<XMLCh> jan(value);
|
---|
1843 | writeValue(gDataValue, value);
|
---|
1844 | }
|
---|
1845 | break;
|
---|
1846 | case XSValue::dt_byte:
|
---|
1847 | {
|
---|
1848 | writeValue(gDataType, SchemaSymbols::fgDT_BYTE);
|
---|
1849 | sprintf( buffer,"%d", obj->fData.fValue.f_char);
|
---|
1850 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1851 | ArrayJanitor<XMLCh> jan(value);
|
---|
1852 | writeValue(gDataValue, value);
|
---|
1853 | }
|
---|
1854 | break;
|
---|
1855 | case XSValue::dt_nonNegativeInteger:
|
---|
1856 | {
|
---|
1857 | writeValue(gDataType, SchemaSymbols::fgDT_NONNEGATIVEINTEGER);
|
---|
1858 | sprintf( buffer,"%u", obj->fData.fValue.f_long);
|
---|
1859 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1860 | ArrayJanitor<XMLCh> jan(value);
|
---|
1861 | writeValue(gDataValue, value);
|
---|
1862 | }
|
---|
1863 | break;
|
---|
1864 | case XSValue::dt_unsignedLong:
|
---|
1865 | {
|
---|
1866 | writeValue(gDataType, SchemaSymbols::fgDT_ULONG);
|
---|
1867 | sprintf( buffer,"%u", obj->fData.fValue.f_ulong);
|
---|
1868 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1869 | ArrayJanitor<XMLCh> jan(value);
|
---|
1870 | writeValue(gDataValue, value);
|
---|
1871 | }
|
---|
1872 | break;
|
---|
1873 | case XSValue::dt_unsignedInt:
|
---|
1874 | {
|
---|
1875 | writeValue(gDataType, SchemaSymbols::fgDT_UINT);
|
---|
1876 | sprintf( buffer,"%u", obj->fData.fValue.f_uint);
|
---|
1877 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1878 | ArrayJanitor<XMLCh> jan(value);
|
---|
1879 | writeValue(gDataValue, value);
|
---|
1880 | }
|
---|
1881 | break;
|
---|
1882 | case XSValue::dt_unsignedShort:
|
---|
1883 | {
|
---|
1884 | writeValue(gDataType, SchemaSymbols::fgDT_USHORT);
|
---|
1885 | sprintf( buffer,"%u", obj->fData.fValue.f_ushort);
|
---|
1886 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1887 | ArrayJanitor<XMLCh> jan(value);
|
---|
1888 | writeValue(gDataValue, value);
|
---|
1889 | }
|
---|
1890 | break;
|
---|
1891 | case XSValue::dt_unsignedByte:
|
---|
1892 | {
|
---|
1893 | writeValue(gDataType, SchemaSymbols::fgDT_UBYTE);
|
---|
1894 | sprintf( buffer,"%u", obj->fData.fValue.f_uchar);
|
---|
1895 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1896 | ArrayJanitor<XMLCh> jan(value);
|
---|
1897 | writeValue(gDataValue, value);
|
---|
1898 | }
|
---|
1899 | break;
|
---|
1900 | case XSValue::dt_positiveInteger:
|
---|
1901 | {
|
---|
1902 | writeValue(gDataType, SchemaSymbols::fgDT_POSITIVEINTEGER);
|
---|
1903 | sprintf( buffer,"%u", obj->fData.fValue.f_long);
|
---|
1904 | XMLCh *value = XMLString::transcode(buffer);
|
---|
1905 | ArrayJanitor<XMLCh> jan(value);
|
---|
1906 | writeValue(gDataValue, value);
|
---|
1907 | }
|
---|
1908 | break;
|
---|
1909 | case XSValue::dt_string:
|
---|
1910 | case XSValue::dt_anyURI:
|
---|
1911 | case XSValue::dt_QName:
|
---|
1912 | case XSValue::dt_NOTATION:
|
---|
1913 | case XSValue::dt_normalizedString:
|
---|
1914 | case XSValue::dt_token:
|
---|
1915 | case XSValue::dt_language:
|
---|
1916 | case XSValue::dt_NMTOKEN:
|
---|
1917 | case XSValue::dt_NMTOKENS:
|
---|
1918 | case XSValue::dt_Name:
|
---|
1919 | case XSValue::dt_NCName:
|
---|
1920 | case XSValue::dt_ID:
|
---|
1921 | case XSValue::dt_IDREF:
|
---|
1922 | case XSValue::dt_IDREFS:
|
---|
1923 | case XSValue::dt_ENTITY:
|
---|
1924 | case XSValue::dt_ENTITIES:
|
---|
1925 | break; //we shouldn't see them
|
---|
1926 | default:
|
---|
1927 | break;
|
---|
1928 | }
|
---|
1929 |
|
---|
1930 | decIndent();
|
---|
1931 | writeClose(gActualValue);
|
---|
1932 | decIndent();
|
---|
1933 | writeString(gCommentEnd);
|
---|
1934 | }
|
---|
1935 |
|
---|
1936 | delete obj;
|
---|
1937 |
|
---|
1938 | } |
---|