diff --git a/samples/src/PSVIWriter/PSVIWriterHandlers.cpp b/samples/src/PSVIWriter/PSVIWriterHandlers.cpp index bf1f375715c0bbeb6ce02b8d114b75d13804e6e9..f5c785b3682e90ac02067698a6050e4504b72280 100644 --- a/samples/src/PSVIWriter/PSVIWriterHandlers.cpp +++ b/samples/src/PSVIWriter/PSVIWriterHandlers.cpp @@ -874,16 +874,22 @@ void PSVIWriterHandlers::processAnnotation(XSAnnotation* annotation) { if (annotation == NULL) { sendElementEmpty(PSVIUni::fgAnnotation); } else { - XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* document = DOMImplementationRegistry::getDOMImplementation(XMLUni::fgZeroLenString)-> + XSAnnotation* annot; + annot = annotation; + + while (annot) { + XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* document = DOMImplementationRegistry::getDOMImplementation(XMLUni::fgZeroLenString)-> createDocument(); - annotation->writeAnnotation((DOMNode*)document, XSAnnotation::W3C_DOM_DOCUMENT); - DOMElement* elem = document->getDocumentElement(); - sendIndentedElement(PSVIUni::fgAnnotation); - processDOMElement(PSVIUni::fgApplicationInformation, elem, PSVIUni::fgAppinfo); - processDOMElement(PSVIUni::fgUserInformation, elem, PSVIUni::fgDocumentation); - processDOMAttributes(elem->getAttributes()); - sendUnindentedElement(PSVIUni::fgAnnotation); - document->release(); + annot->writeAnnotation((DOMNode*)document, XSAnnotation::W3C_DOM_DOCUMENT); + DOMElement* elem = document->getDocumentElement(); + sendIndentedElement(PSVIUni::fgAnnotation); + processDOMElement(PSVIUni::fgApplicationInformation, elem, PSVIUni::fgAppinfo); + processDOMElement(PSVIUni::fgUserInformation, elem, PSVIUni::fgDocumentation); + processDOMAttributes(elem->getAttributes()); + sendUnindentedElement(PSVIUni::fgAnnotation); + document->release(); + annot = annot->getNext(); + } } } diff --git a/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp b/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp index f363dbe28b09743a111f4747535a77e583faae7b..3bf5f54ffa8a096a1a7f73835e59d9028b69da5c 100644 --- a/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp +++ b/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp @@ -1674,7 +1674,8 @@ void DOMLSSerializerImpl::processBOM() } else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString) == 0) || (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString2) == 0) || - (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString3) == 0) ) + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString3) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString4) == 0) ) { if (XMLPlatformUtils::fgXMLChBigEndian) fFormatter->writeBOM(BOM_ucs4be, 4); diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp index ccec6e1022b027e96c974484e071144a5263f200..1e4f851ca5848fdd67e3fbbd7c71c361d2630148 100644 --- a/src/xercesc/internal/IGXMLScanner2.cpp +++ b/src/xercesc/internal/IGXMLScanner2.cpp @@ -1799,7 +1799,7 @@ void IGXMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* con } } - grammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + SchemaGrammar* grammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) grammar->getGrammarDescription(); gramDesc->setContextType(XMLSchemaDescription::CONTEXT_PREPARSE); gramDesc->setLocationHints(srcToFill->getSystemId()); @@ -1808,7 +1808,7 @@ void IGXMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* con ( root , fURIStringPool - , (SchemaGrammar*) grammar + , grammar , fGrammarResolver , this , srcToFill->getSystemId() diff --git a/src/xercesc/internal/XMLReader.cpp b/src/xercesc/internal/XMLReader.cpp index 91cf5689db07f4123d5b31025b0d64d3b7bb039b..e7d02674bfd908d0ce0bb87801f74fb447a868ab 100644 --- a/src/xercesc/internal/XMLReader.cpp +++ b/src/xercesc/internal/XMLReader.cpp @@ -1281,7 +1281,8 @@ bool XMLReader::setEncoding(const XMLCh* const newEncoding) } else if (!XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString) || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString2) - || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString3)) + || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString3) + || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString4)) { fMemoryManager->deallocate(inputEncoding); diff --git a/src/xercesc/util/PlatformUtils.cpp b/src/xercesc/util/PlatformUtils.cpp index 4cdf5f1fed81f736c931395b6f1be96389f74107..128f5a0d9228becfb60d9eab2f15581b824a15e3 100644 --- a/src/xercesc/util/PlatformUtils.cpp +++ b/src/xercesc/util/PlatformUtils.cpp @@ -167,6 +167,9 @@ XMLMutex* gXMLCleanupListMutex = 0; // --------------------------------------------------------------------------- XMLNetAccessor* XMLPlatformUtils::fgNetAccessor = 0; XMLTransService* XMLPlatformUtils::fgTransService = 0; +#ifdef OS390 +XMLTransService* XMLPlatformUtils::fgTransService2 = 0; +#endif PanicHandler* XMLPlatformUtils::fgUserPanicHandler = 0; PanicHandler* XMLPlatformUtils::fgDefaultPanicHandler = 0; MemoryManager* XMLPlatformUtils::fgMemoryManager = 0; diff --git a/src/xercesc/util/PlatformUtils.hpp b/src/xercesc/util/PlatformUtils.hpp index 32dd38c53b2783e8720f97c76c85cbdc68bfb5d6..c12842e0454ae44b0caa38749165dd107789307c 100644 --- a/src/xercesc/util/PlatformUtils.hpp +++ b/src/xercesc/util/PlatformUtils.hpp @@ -99,6 +99,9 @@ public : * among parser instances within that process. */ static XMLTransService* fgTransService; +#ifdef OS390 + static XMLTransService* fgTransService2; +#endif /** The Panic Handler * diff --git a/src/xercesc/util/TransService.cpp b/src/xercesc/util/TransService.cpp index e2a7ae414e42872b621899e8b87f23b4afbbe342..c2a188ebbc097a1dc7f3961feaa5b4553ddc62c0 100644 --- a/src/xercesc/util/TransService.cpp +++ b/src/xercesc/util/TransService.cpp @@ -464,6 +464,15 @@ void XMLTransService::initTransService() , false ) ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString4, + new EEndianNameMapFor<XMLUCS4Transcoder> + ( + XMLUni::fgUCS4EncodingString4 + , false + ) + ); // // Add in our mappings for IBM037, and the one alias we support for diff --git a/src/xercesc/util/TransService.hpp b/src/xercesc/util/TransService.hpp index 8e87d3e4a7fa8455448578bd11bdbee8b9bd5aaa..987b0e9f74f2de50789e1c1d90ae8119192db443 100644 --- a/src/xercesc/util/TransService.hpp +++ b/src/xercesc/util/TransService.hpp @@ -150,6 +150,9 @@ protected : // ----------------------------------------------------------------------- // Protected virtual methods. // ----------------------------------------------------------------------- +#ifdef OS390 + friend class Uniconv390TransService; +#endif virtual XMLTranscoder* makeNewXMLTranscoder ( const XMLCh* const encodingName diff --git a/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp b/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp index e5a01d524c638ded9449981709273820dc7e2cb3..65f1adae96da4de263582c716e5bcb3d764d3f0e 100644 --- a/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp +++ b/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp @@ -191,7 +191,10 @@ else { fCaseConverter->ftolowerhand=UNICONV_NOHANDLE; } - fICUService = new ICUTransService; + if ((gForceTranscode == MUST_USE_ICU) | + (gForceTranscode == MUST_USE_ICU_SRC_OFFS)) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } gViewTranscoder = false; if ( !strcmp(getenv("_IXM_VIEW_CONVERSION"),"YES") ) @@ -218,8 +221,8 @@ Uniconv390TransService::~Uniconv390TransService() delete fCaseConverter; fCaseConverter=0; } - if (fICUService) { - delete fICUService; + if (XMLPlatformUtils::fgTransService2) { + delete XMLPlatformUtils::fgTransService2; } } @@ -277,7 +280,13 @@ int Uniconv390TransService::compareIString(const XMLCh* const comp1 } // check if unicode services does not support upper casing again, then call ICU. if (fCaseConverter->ftoupperhand == UNICONV_ERROR) { - return fICUService->compareIString(comp1,comp2); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + return XMLPlatformUtils::fgTransService2->compareIString(comp1,comp2); } return 0; } @@ -343,7 +352,13 @@ int Uniconv390TransService::compareNIString(const XMLCh* const comp1 } // check if unicode services does not support upper casing, then call ICU. if (fCaseConverter->ftoupperhand == UNICONV_ERROR) { - return fICUService->compareNIString(comp1,comp2,maxChars); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + return XMLPlatformUtils::fgTransService2->compareNIString(comp1,comp2,maxChars); } return 0; } @@ -391,7 +406,13 @@ void Uniconv390TransService::upperCase(XMLCh* const toUpperCase) const } } if (fCaseConverter->ftoupperhand==UNICONV_ERROR) { - return fICUService->upperCase(toUpperCase); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + return XMLPlatformUtils::fgTransService2->upperCase(toUpperCase); } } @@ -426,7 +447,13 @@ void Uniconv390TransService::lowerCase(XMLCh* const toLowerCase) const } } if (fCaseConverter->ftolowerhand==UNICONV_ERROR) { - return fICUService->lowerCase(toLowerCase); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + return XMLPlatformUtils::fgTransService2->lowerCase(toLowerCase); } } @@ -439,7 +466,13 @@ DBGPRINTF2("makeNewLCPTranscoder() localencoding=%s \n",nl_langinfo(CODESET)); (gForceTranscode == MUST_USE_ICU_SRC_OFFS)) { if (gViewTranscoder) printf("IXM1004I LCP - Using ICU - %s\n",nl_langinfo(CODESET)); - fLCPTranscoder = fICUService->makeNewLCPTranscoder(); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + fLCPTranscoder = XMLPlatformUtils::fgTransService2->makeNewLCPTranscoder(); } else { char codepage[32]; sprintf(codepage,"%s-s390", nl_langinfo(CODESET)); @@ -454,7 +487,13 @@ DBGPRINTF2("makeNewLCPTranscoder() localencoding=%s \n",nl_langinfo(CODESET)); if (gForceTranscode != MUST_USE_UNICONV) { if (gViewTranscoder) printf("IXM1006I LCP - Using ICU - %s\n",nl_langinfo(CODESET)); - fLCPTranscoder = fICUService->makeNewLCPTranscoder(); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + fLCPTranscoder = XMLPlatformUtils::fgTransService2->makeNewLCPTranscoder(); } } } @@ -478,7 +517,13 @@ DBGPRINTF3("makeNewXMLTranscoder() encoding=%s blocksize=%d\n",localname,blockSi (gForceTranscode == MUST_USE_ICU_SRC_OFFS)) { if (gViewTranscoder) printf("IXM1001I XML - Using ICU - %s\n",localname); - return fICUService->makeNewXMLTranscoder(encodingName,resValue,blockSize, manager); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + return XMLPlatformUtils::fgTransService2->makeNewXMLTranscoder(encodingName,resValue,blockSize, manager); } uniconvconverter *tconv=addConverter(localname,resValue); @@ -490,7 +535,13 @@ DBGPRINTF3("makeNewXMLTranscoder() encoding=%s blocksize=%d\n",localname,blockSi else { if (gViewTranscoder) printf("IXM1002I XML - Using ICU - %s\n",localname); - return fICUService->makeNewXMLTranscoder(encodingName,resValue,blockSize, manager); + if (!XMLPlatformUtils::fgTransService2) { + XMLMutexLock lockConverter(&fCaseConverter->fcaseMutex); + if (!XMLPlatformUtils::fgTransService2) { + XMLPlatformUtils::fgTransService2 = new ICUTransService; + } + } + return XMLPlatformUtils::fgTransService2->makeNewXMLTranscoder(encodingName,resValue,blockSize, manager); } } @@ -745,6 +796,15 @@ void Uniconv390TransService::initTransService() , false ) ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString4, + new EEndianNameMapFor<XMLUCS4Transcoder> + ( + XMLUni::fgUCS4EncodingString4 + , false + ) + ); // // Add in our mappings for IBM037, and the one alias we support for @@ -1011,6 +1071,15 @@ void Uniconv390TransService::initTransService() , false ) ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString4, + new EEndianNameMapFor<XMLUCS4Transcoder> + ( + XMLUni::fgUCS4EncodingString4 + , false + ) + ); // // Add in our mappings for IBM037, and the one alias we support for diff --git a/src/xercesc/util/XMLUni.cpp b/src/xercesc/util/XMLUni.cpp index fd1177d01eadc9dc1bad7b1d74e39b565f99b6a9..9c0dbfac66eea600459bfab622d073aff49673e2 100644 --- a/src/xercesc/util/XMLUni.cpp +++ b/src/xercesc/util/XMLUni.cpp @@ -356,6 +356,11 @@ const XMLCh XMLUni::fgUCS4EncodingString3[] = chLatin_U, chLatin_C, chLatin_S, chUnderscore, chDigit_4, chNull }; +const XMLCh XMLUni::fgUCS4EncodingString4[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_3, chDigit_2, chNull +}; + const XMLCh XMLUni::fgUCS4BEncodingString[] = { chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chSpace, chOpenParen, chLatin_B, chLatin_E, chCloseParen, chNull diff --git a/src/xercesc/util/XMLUni.hpp b/src/xercesc/util/XMLUni.hpp index 4d921d8c1c4b33538cfc0960dcdd2524ff9ef622..ce510a396c4015dfb4a744fa4aadf8186639d65e 100644 --- a/src/xercesc/util/XMLUni.hpp +++ b/src/xercesc/util/XMLUni.hpp @@ -105,6 +105,7 @@ public : static const XMLCh fgUCS4EncodingString[]; static const XMLCh fgUCS4EncodingString2[]; static const XMLCh fgUCS4EncodingString3[]; + static const XMLCh fgUCS4EncodingString4[]; static const XMLCh fgUCS4BEncodingString[]; static const XMLCh fgUCS4BEncodingString2[]; static const XMLCh fgUCS4LEncodingString[]; diff --git a/src/xercesc/validators/schema/TraverseSchema.cpp b/src/xercesc/validators/schema/TraverseSchema.cpp index a7f94eac671070a0b91c5ccb631938cf0ac67276..d629f060949dbf9d075e10cb2e6a3b897f747047 100644 --- a/src/xercesc/validators/schema/TraverseSchema.cpp +++ b/src/xercesc/validators/schema/TraverseSchema.cpp @@ -1012,6 +1012,7 @@ TraverseSchema::traverseChoiceSequence(const DOMElement* const elem, for (; child != 0; child = XUtil::getNextSiblingElement(child)) { contentSpecNode.release(); bool seeParticle = false; + bool wasAny = false; const XMLCh* childName = child->getLocalName(); if (XMLString::equals(childName, SchemaSymbols::fgELT_ELEMENT)) { @@ -1065,6 +1066,7 @@ TraverseSchema::traverseChoiceSequence(const DOMElement* const elem, contentSpecNode.reset(traverseAny(child)); seeParticle = true; + wasAny = true; } else { reportSchemaError(child, XMLUni::fgValidityDomain, XMLValid::GroupContentRestricted, childName); @@ -1076,6 +1078,9 @@ TraverseSchema::traverseChoiceSequence(const DOMElement* const elem, if (seeParticle) { checkMinMax(contentSpecNode.get(), child, Not_All_Context); + if (wasAny && contentSpecNode.get()->getMaxOccurs() == 0) { + contentSpecNode.reset(0); + } } if (left.get() == 0) { @@ -2625,7 +2630,10 @@ TraverseSchema::traverseElementDecl(const DOMElement* const elem, // check annotation const DOMElement* content = checkContent(elem, XUtil::getFirstChildElement(elem), true); - if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + // Put annotations on all elements for the situation where there is a group of + // elements and not all have annotations. + //if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + if (!fAnnotation && fScanner->getGenerateSyntheticAnnotations()) { fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); } @@ -5566,10 +5574,15 @@ TraverseSchema::isSubstitutionGroupValid(const DOMElement* const elem, // that is, make sure that the type we're deriving has some relatoinship // to substitutionGroupElt's type. else if (typeInfo) { // do complexType case ...need testing + + ComplexTypeInfo* subsTypeInfo = subsElemDecl->getComplexTypeInfo(); + + if (subsTypeInfo == typeInfo) + return true; int derivationMethod = typeInfo->getDerivedBy(); - if (typeInfo->getContentType() == SchemaElementDecl::Simple) { // take care of complexType based on simpleType case... + if (subsTypeInfo == 0) { // take care of complexType based on simpleType case... DatatypeValidator* elemDV = typeInfo->getDatatypeValidator(); DatatypeValidator* subsValidator = subsElemDecl->getDatatypeValidator(); @@ -5588,11 +5601,6 @@ TraverseSchema::isSubstitutionGroupValid(const DOMElement* const elem, } else { // complex content - ComplexTypeInfo* subsTypeInfo = subsElemDecl->getComplexTypeInfo(); - - if (subsTypeInfo == typeInfo) - return true; - const ComplexTypeInfo* elemTypeInfo = typeInfo; for (; elemTypeInfo && elemTypeInfo != subsTypeInfo; @@ -5611,15 +5619,17 @@ TraverseSchema::isSubstitutionGroupValid(const DOMElement* const elem, } else if (validator) { // do simpleType case... - // first, check for type relation. - DatatypeValidator* subsValidator = subsElemDecl->getDatatypeValidator(); + if (!subsElemDecl->getComplexTypeInfo()) { + // first, check for type relation. + DatatypeValidator* subsValidator = subsElemDecl->getDatatypeValidator(); - if (subsValidator == validator) { - return true; - } - else if (subsValidator && subsValidator->isSubstitutableBy(validator) - && ((subsElemDecl->getFinalSet() & SchemaSymbols::XSD_RESTRICTION) == 0)) { + if (subsValidator == validator) { + return true; + } + else if (subsValidator && subsValidator->isSubstitutableBy(validator) + && ((subsElemDecl->getFinalSet() & SchemaSymbols::XSD_RESTRICTION) == 0)) { return true; + } } } else // validator==0 && typeInfo==0 -- no checking @@ -6304,7 +6314,15 @@ void TraverseSchema::processComplexContent(const DOMElement* const ctElem, } } else if (typeInfo->getContentSpec() == 0) { - typeInfo->setContentType(SchemaElementDecl::Empty); + if ((typeDerivedBy == SchemaSymbols::XSD_EXTENSION) && + baseTypeInfo) { + typeInfo->setBaseDatatypeValidator(baseTypeInfo->getBaseDatatypeValidator()); + typeInfo->setDatatypeValidator(baseTypeInfo->getDatatypeValidator()); + typeInfo->setContentType(baseTypeInfo->getContentType()); + } + else { + typeInfo->setContentType(SchemaElementDecl::Empty); + } } else { typeInfo->setContentType(SchemaElementDecl::Children);