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 2005/04/26 19:51:01 UTC
cvs commit: xml-xerces/c/src/xercesc/validators/schema SchemaValidator.cpp TraverseSchema.cpp
cargilld 2005/04/26 10:51:01
Modified: c/src/xercesc/validators/schema SchemaValidator.cpp
TraverseSchema.cpp
Log:
Schema updates to match spec: both the default value and the canonical representation of that value have to fit the pattern and it is an error for NOTATION to be used directly in a schema.
Revision Changes Path
1.60 +12 -1 xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.cpp
Index: SchemaValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- SchemaValidator.cpp 25 Nov 2004 15:16:04 -0000 1.59
+++ SchemaValidator.cpp 26 Apr 2005 17:51:01 -0000 1.60
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.60 2005/04/26 17:51:01 cargilld
+ * Schema updates to match spec: both the default value and the canonical representation of that value have to fit the pattern and it is an error for NOTATION to be used directly in a schema.
+ *
* Revision 1.59 2004/11/25 15:16:04 knoaman
* PSVI: fix for getIsSchemaSpecified on empty elements with default values.
*
@@ -440,6 +443,7 @@
else
{
DatatypeValidator::ValidatorType eleDefDVType = fCurrentDatatypeValidator->getType();
+ bool validateCanonical = false;
if (eleDefDVType == DatatypeValidator::NOTATION)
{
// if notation, need to bind URI to notation first
@@ -477,8 +481,10 @@
// is neither the one in the element nor the one in the current
// complex type (if any)
if ((fCurrentDatatypeValidator != ((SchemaElementDecl*)elemDecl)->getDatatypeValidator())
- && (!fTypeStack->peek() || (fCurrentDatatypeValidator != fTypeStack->peek()->getDatatypeValidator())))
+ && (!fTypeStack->peek() || (fCurrentDatatypeValidator != fTypeStack->peek()->getDatatypeValidator()))) {
value = elemDefaultValue;
+ validateCanonical = true;
+ }
else
value = 0;
}
@@ -508,6 +514,11 @@
{
try {
fCurrentDatatypeValidator->validate(value, getScanner()->getValidationContext(), fMemoryManager);
+ if (validateCanonical) {
+ XMLCh* canonical = (XMLCh*) fCurrentDatatypeValidator->getCanonicalRepresentation(value, fMemoryManager);
+ ArrayJanitor<XMLCh> tempCanonical(canonical, fMemoryManager);
+ fCurrentDatatypeValidator->validate(canonical, getScanner()->getValidationContext(), fMemoryManager);
+ }
}
catch (XMLException& idve)
{
1.136 +7 -2 xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.cpp
Index: TraverseSchema.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- TraverseSchema.cpp 5 Apr 2005 15:12:36 -0000 1.135
+++ TraverseSchema.cpp 26 Apr 2005 17:51:01 -0000 1.136
@@ -6879,7 +6879,7 @@
const XMLCh* localPart = getLocalPart(type);
- if (XMLString::equals(localPart, SchemaSymbols::fgELT_NOTATION)) {
+ if (XMLString::equals(localPart, XMLUni::fgNotationString)) {
reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNotationType, name);
}
}
@@ -8586,6 +8586,11 @@
try
{
validator->validate(valConstraint,0,fMemoryManager);
+
+ XMLCh* canonical = (XMLCh*) validator->getCanonicalRepresentation(valConstraint, fMemoryManager);
+ ArrayJanitor<XMLCh> tempCanonical(canonical, fMemoryManager);
+ validator->validate(canonical, 0, fMemoryManager);
+
isValid = true;
}
catch(const XMLException& excep)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org