You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2007/06/01 21:40:27 UTC
svn commit: r543585 - in /xerces/c/trunk/src/xercesc/validators/schema:
SubstitutionGroupComparator.cpp TraverseSchema.cpp
Author: cargilld
Date: Fri Jun 1 12:40:26 2007
New Revision: 543585
URL: http://svn.apache.org/viewvc?view=rev&rev=543585
Log:
Schema fixes for anonymous type with mixed and substitution with bock.
Modified:
xerces/c/trunk/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
Modified: xerces/c/trunk/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp?view=diff&rev=543585&r1=543584&r2=543585
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp Fri Jun 1 12:40:26 2007
@@ -118,21 +118,30 @@
((exemplarBlockSet & SchemaSymbols::XSD_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)
- return false;
-
- // this will contain exemplar's complexType information.
+ // 2.3 The set of all {derivation method}s involved in the derivation of D's {type definition} from C's {type definition} does not intersect with the union of the blocking constraint, C's {prohibited substitutions} (if C is complex, otherwise the empty set) and the {prohibited substitutions} (respectively the empty set) of any intermediate {type definition}s in the derivation of D's {type definition} from C's {type definition}.
+ // prepare the combination of {derivation method} and
+ // {disallowed substitution}
+ int devMethod = 0;
+ int blockConstraint = exemplarBlockSet;
+
ComplexTypeInfo *exemplarComplexType = pElemDecl->getComplexTypeInfo();
+ ComplexTypeInfo *tempType = aComplexType;;
- for(ComplexTypeInfo *tempType = aComplexType;
- tempType != 0 && tempType != exemplarComplexType;
- tempType = tempType->getBaseComplexTypeInfo())
+ while (tempType != 0 &&
+ tempType != exemplarComplexType)
{
- if((tempType->getBlockSet() & anElementDerivationMethod) != 0)
- return false;
- }//for
+ devMethod |= tempType->getDerivedBy();
+ tempType = tempType->getBaseComplexTypeInfo();
+ if (tempType) {
+ blockConstraint |= tempType->getBlockSet();
+ }
+ }
+ if (tempType != exemplarComplexType) {
+ return false;
+ }
+ if ((devMethod & blockConstraint) != 0) {
+ return false;
+ }
return true;
}
Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?view=diff&rev=543585&r1=543584&r2=543585
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Fri Jun 1 12:40:26 2007
@@ -6221,7 +6221,8 @@
typeInfo->setContentSpec(specNode);
typeInfo->setAdoptContentSpec(true);
specNodeJan.release();
-
+ bool specNodeWasNull = false;
+
// -----------------------------------------------------------------------
// Merge in information from base, if it exists
// -----------------------------------------------------------------------
@@ -6248,6 +6249,7 @@
// Compose the final content model by concatenating the base and
// the current in sequence
if (!specNode) {
+ specNodeWasNull = true;
if (isMixed) {
if (baseSpecNode && baseSpecNode->hasAllContent()) {
reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::NotAllContent);
@@ -6376,16 +6378,15 @@
typeInfo->setContentType(SchemaElementDecl::Mixed_Simple);
}
}
- else if (typeInfo->getContentSpec() == 0) {
- if ((typeDerivedBy == SchemaSymbols::XSD_EXTENSION) &&
+ else if (specNodeWasNull &&
+ (typeDerivedBy == SchemaSymbols::XSD_EXTENSION) &&
baseTypeInfo) {
- typeInfo->setBaseDatatypeValidator(baseTypeInfo->getBaseDatatypeValidator());
- typeInfo->setDatatypeValidator(baseTypeInfo->getDatatypeValidator());
- typeInfo->setContentType(baseTypeInfo->getContentType());
- }
- else {
- typeInfo->setContentType(SchemaElementDecl::Empty);
- }
+ typeInfo->setBaseDatatypeValidator(baseTypeInfo->getBaseDatatypeValidator());
+ typeInfo->setDatatypeValidator(baseTypeInfo->getDatatypeValidator());
+ typeInfo->setContentType(baseTypeInfo->getContentType());
+ }
+ else if (typeInfo->getContentSpec() == 0) {
+ typeInfo->setContentType(SchemaElementDecl::Empty);
}
else {
typeInfo->setContentType(SchemaElementDecl::Children);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org