diff --git a/src/validators/schema/SubstitutionGroupComparator.cpp b/src/validators/schema/SubstitutionGroupComparator.cpp index c4060ee8850018486c82f532644a579187917b99..64d4ec7f96957c48a702cdff2d84e44a924f67fc 100644 --- a/src/validators/schema/SubstitutionGroupComparator.cpp +++ b/src/validators/schema/SubstitutionGroupComparator.cpp @@ -1,37 +1,37 @@ /* * The Apache Software License, Version 1.1 - * + * * Copyright (c) 1999-2000 The Apache Software Foundation. All rights * reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * + * notice, this list of conditions and the following disclaimer. + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * + * * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: + * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. - * + * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this - * software without prior written permission. For written + * software without prior written permission. For written * permission, please contact apache\@apache.org. - * + * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -45,7 +45,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== - * + * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation, and was * originally based on software copyright (c) 1999, International @@ -55,7 +55,10 @@ */ /* - * $Log: + * $Log$ + * Revision 1.2 2001/05/04 14:50:28 tng + * Fixed the cvs symbols. + * * */ @@ -73,11 +76,11 @@ bool SubstitutionGroupComparator::isEquivalentTo(const QName& anElement , const QName& exemplar) { - if ((XMLString::compareString(anElement.getLocalPart(), exemplar.getLocalPart()) == 0) && - (anElement.getURI() == exemplar.getURI())) + if ((XMLString::compareString(anElement.getLocalPart(), exemplar.getLocalPart()) == 0) && + (anElement.getURI() == exemplar.getURI())) return true; // they're the same! - if (!fGrammarResolver || !fStringPool ) + if (!fGrammarResolver || !fStringPool ) { ThrowXML(RuntimeException, XMLExcepts::SubGrpComparator_NGR); } @@ -87,13 +90,13 @@ bool SubstitutionGroupComparator::isEquivalentTo(const QName& anElement const XMLCh* localpart = anElement.getLocalPart(); // In addition to simply trying to find a chain between anElement and exemplar, - // we need to make sure that no steps in the chain are blocked. + // we need to make sure that no steps in the chain are blocked. // That is, at every step, we need to make sure that the element // being substituted for will permit being substituted // for, and whether the type of the element will permit derivations in // instance documents of this sort. - if (!uri) + if (!uri) return false; SchemaGrammar *sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uri); @@ -105,38 +108,38 @@ bool SubstitutionGroupComparator::isEquivalentTo(const QName& anElement XMLCh* substitutionGroupFullName = pElemDecl->getSubstitutionGroupName(); bool foundIt = false; - while (substitutionGroupFullName) + while (substitutionGroupFullName) { - int commaAt = XMLString::indexOf(substitutionGroupFullName, ','); + int commaAt = XMLString::indexOf(substitutionGroupFullName, ','); XMLCh* tmpURI = 0; XMLCh* tmpLocalpart = substitutionGroupFullName; - if (commaAt >= 0) + if (commaAt >= 0) { - if (commaAt > 0) + if (commaAt > 0) XMLString::subString(tmpURI, substitutionGroupFullName, 0, commaAt); - - XMLString::subString(tmpLocalpart, substitutionGroupFullName, commaAt+1, XMLString::stringLen(substitutionGroupFullName)); + + XMLString::subString(tmpLocalpart, substitutionGroupFullName, commaAt+1, XMLString::stringLen(substitutionGroupFullName)); } - if (!tmpURI) + if (!tmpURI) return false; - + sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(tmpURI); - if (!sGrammar) - return false; + if (!sGrammar) + return false; uriId = fStringPool->addOrFind(tmpURI); pElemDecl = (SchemaElementDecl*) sGrammar->getElemDecl(uriId, tmpLocalpart, 0, Grammar::TOP_LEVEL_SCOPE); - - if (!pElemDecl) - return false; - if ((XMLString::compareString(tmpLocalpart, exemplar.getLocalPart()) == 0) && - (uriId == exemplar.getURI())) + if (!pElemDecl) + return false; + + if ((XMLString::compareString(tmpLocalpart, exemplar.getLocalPart()) == 0) && + (uriId == exemplar.getURI())) { // time to check for block value on element - if((pElemDecl->getBlockSet() & SchemaSymbols::SUBSTITUTION) != 0) - return false; + if((pElemDecl->getBlockSet() & SchemaSymbols::SUBSTITUTION) != 0) + return false; foundIt = true; break; @@ -145,14 +148,14 @@ bool SubstitutionGroupComparator::isEquivalentTo(const QName& anElement substitutionGroupFullName = pElemDecl->getSubstitutionGroupName(); }//while - if (!foundIt) - return false; + if (!foundIt) + return false; // this will contain anElement's complexType information. ComplexTypeInfo *aComplexType = anElementDecl->getComplexTypeInfo(); int exemplarBlockSet = pElemDecl->getBlockSet(); - if(!aComplexType) + if(!aComplexType) { // check on simpleType case DatatypeValidator *anElementDV = anElementDecl->getDatatypeValidator(); @@ -162,23 +165,23 @@ bool SubstitutionGroupComparator::isEquivalentTo(const QName& anElement ((anElementDV == exemplarDV) || ((exemplarBlockSet & SchemaSymbols::RESTRICTION) == 0))); } - + // now we have to make sure there are no blocks on the complexTypes that this is based upon int anElementDerivationMethod = aComplexType->getDerivedBy(); - if((anElementDerivationMethod & exemplarBlockSet) != 0) + if((anElementDerivationMethod & exemplarBlockSet) != 0) return false; // this will contain exemplar's complexType information. ComplexTypeInfo *exemplarComplexType = pElemDecl->getComplexTypeInfo(); for(ComplexTypeInfo *tempType = aComplexType; - tempType != 0 && tempType != exemplarComplexType; + tempType != 0 && tempType != exemplarComplexType; tempType = tempType->getBaseComplexTypeInfo()) { - if((tempType->getBlockSet() & anElementDerivationMethod) != 0) + if((tempType->getBlockSet() & anElementDerivationMethod) != 0) return false; }//for - + return true; } /** diff --git a/src/validators/schema/SubstitutionGroupComparator.hpp b/src/validators/schema/SubstitutionGroupComparator.hpp index b454c2f96deead4399ae739c9f31d1697522f72a..f0278c5b881a5917484994a49747a76f9044aab6 100644 --- a/src/validators/schema/SubstitutionGroupComparator.hpp +++ b/src/validators/schema/SubstitutionGroupComparator.hpp @@ -1,37 +1,37 @@ /* * The Apache Software License, Version 1.1 - * + * * Copyright (c) 1999-2000 The Apache Software Foundation. All rights * reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * + * notice, this list of conditions and the following disclaimer. + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * + * * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: + * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. - * + * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this - * software without prior written permission. For written + * software without prior written permission. For written * permission, please contact apache\@apache.org. - * + * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -45,7 +45,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== - * + * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation, and was * originally based on software copyright (c) 1999, International @@ -55,7 +55,7 @@ */ /* - * $Id + * $Id$ */ #if !defined(SUBSTITUTIONGROUPCOMPARATOR_HPP) @@ -69,7 +69,7 @@ class VALIDATORS_EXPORT SubstitutionGroupComparator { public: - + // ----------------------------------------------------------------------- // Public Constructor // ----------------------------------------------------------------------- @@ -98,7 +98,7 @@ public: /** @name Validation Function */ //@{ - /** + /** * Checks that the "anElement" is within the subsitution group. * * @param anElement QName of the element @@ -118,14 +118,14 @@ private: // Unimplemented Ctor // ----------------------------------------------------------------------- SubstitutionGroupComparator(); - + // ----------------------------------------------------------------------- // Private data members // // // ----------------------------------------------------------------------- - + GrammarResolver *fGrammarResolver; XMLStringPool *fStringPool;