You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2002/07/11 20:55:45 UTC
cvs commit: xml-xerces/c/src/xercesc/validators/schema SchemaValidator.cpp SchemaValidator.hpp
knoaman 2002/07/11 11:55:45
Modified: c/src/xercesc/framework XMLValidator.hpp
c/src/xercesc/validators/DTD DTDValidator.cpp
DTDValidator.hpp
c/src/xercesc/validators/schema SchemaValidator.cpp
SchemaValidator.hpp
Log:
Add a flag to the preContentValidation method to indicate whether to validate
default/fixed attributes or not.
Revision Changes Path
1.3 +5 -1 xml-xerces/c/src/xercesc/framework/XMLValidator.hpp
Index: XMLValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLValidator.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLValidator.hpp 20 Feb 2002 18:17:01 -0000 1.2
+++ XMLValidator.hpp 11 Jul 2002 18:55:44 -0000 1.3
@@ -56,6 +56,10 @@
/*
* $Log$
+ * Revision 1.3 2002/07/11 18:55:44 knoaman
+ * Add a flag to the preContentValidation method to indicate whether to validate
+ * default/fixed attributes or not.
+ *
* Revision 1.2 2002/02/20 18:17:01 tng
* [Bug 5977] Warnings on generating apiDocs.
*
@@ -229,7 +233,8 @@
/**
* This method is called by the scanner after a Grammar is scanned.
*/
- virtual void preContentValidation(bool reuseGrammar) = 0;
+ virtual void preContentValidation(bool reuseGrammar,
+ bool validateDefAttr = false) = 0;
/**
* This method is called by the scanner after the parse has completed. It
1.2 +6 -5 xml-xerces/c/src/xercesc/validators/DTD/DTDValidator.cpp
Index: DTDValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDValidator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DTDValidator.cpp 1 Feb 2002 22:22:45 -0000 1.1
+++ DTDValidator.cpp 11 Jul 2002 18:55:44 -0000 1.2
@@ -384,7 +384,7 @@
// general entity pool. If not there, then its an error. If its
// not an external unparsed entity, then its an error.
//
- const XMLEntityDecl* decl = getScanner()->getEntityDecl(pszTmpVal);
+ const XMLEntityDecl* decl = fDTDGrammar->getEntityDecl(pszTmpVal);
if (decl)
{
if (!decl->isUnparsed())
@@ -431,7 +431,8 @@
}
-void DTDValidator::preContentValidation(bool reuseGrammar)
+void DTDValidator::preContentValidation(bool reuseGrammar,
+ bool validateDefAttr)
{
//
// Lets enumerate all of the elements in the element decl pool
@@ -569,7 +570,7 @@
}
// If it has a default/fixed value, then validate it
- if (curAttDef.getValue())
+ if (validateDefAttr && curAttDef.getValue())
{
validateAttrValue
(
@@ -584,7 +585,7 @@
// And enumerate all of the general entities. If any of them
// reference a notation, then make sure the notation exists.
//
- NameIdPoolEnumerator<DTDEntityDecl> entEnum = getScanner()->getEntityEnumerator();
+ NameIdPoolEnumerator<DTDEntityDecl> entEnum = fDTDGrammar->getEntityEnumerator();
while (entEnum.hasMoreElements())
{
const DTDEntityDecl& curEntity = entEnum.nextElement();
1.2 +5 -1 xml-xerces/c/src/xercesc/validators/DTD/DTDValidator.hpp
Index: DTDValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDValidator.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DTDValidator.hpp 1 Feb 2002 22:22:45 -0000 1.1
+++ DTDValidator.hpp 11 Jul 2002 18:55:44 -0000 1.2
@@ -56,8 +56,12 @@
/*
* $Log$
- * Revision 1.1 2002/02/01 22:22:45 peiyongz
- * Initial revision
+ * Revision 1.2 2002/07/11 18:55:44 knoaman
+ * Add a flag to the preContentValidation method to indicate whether to validate
+ * default/fixed attributes or not.
+ *
+ * Revision 1.1.1.1 2002/02/01 22:22:45 peiyongz
+ * sane_include
*
* Revision 1.13 2001/11/13 13:25:28 tng
* Deprecate function XMLValidator::checkRootElement.
@@ -153,7 +157,8 @@
, const XMLAttDef& attDef
) const;
- virtual void preContentValidation(bool reuseGrammar);
+ virtual void preContentValidation(bool reuseGrammar,
+ bool validateDefAttr = false);
virtual void postParseValidation();
1.13 +11 -11 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SchemaValidator.cpp 17 Jun 2002 18:53:58 -0000 1.12
+++ SchemaValidator.cpp 11 Jul 2002 18:55:44 -0000 1.13
@@ -56,6 +56,10 @@
/*
* $Log$
+ * Revision 1.13 2002/07/11 18:55:44 knoaman
+ * Add a flag to the preContentValidation method to indicate whether to validate
+ * default/fixed attributes or not.
+ *
* Revision 1.12 2002/06/17 18:53:58 tng
* DOM L3: support "datatype-normalization"
*
@@ -535,7 +539,7 @@
// Check built-in simple types
if (!XMLString::compareString(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) {
- fXsiTypeValidator = fGrammarResolver->getDatatypeRegistry()->getDatatypeValidator(localPart);
+ fXsiTypeValidator = fGrammarResolver->getDatatypeValidator(uriStr, localPart);
if (!fXsiTypeValidator)
emitError(XMLValid::BadXsiType, fXsiType->getRawName());
@@ -567,9 +571,8 @@
else {
// retrieve complexType registry and DatatypeValidator registry
RefHashTableOf<ComplexTypeInfo>* complexTypeRegistry = sGrammar->getComplexTypeRegistry();
- DatatypeValidatorFactory* dataTypeReg = fGrammarResolver->getDatatypeRegistry();
- if (!complexTypeRegistry || !dataTypeReg)
+ if (!complexTypeRegistry)
emitError(XMLValid::BadXsiType, fXsiType->getRawName());
else {
// retrieve the typeInfo specified in xsi:type
@@ -628,10 +631,7 @@
}
else {
// typeInfo not found
- if (!XMLString::compareString(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA))
- fXsiTypeValidator = dataTypeReg->getDatatypeValidator(localPart);
- else
- fXsiTypeValidator = dataTypeReg->getDatatypeValidator(aBuffer.getRawBuffer());
+ fXsiTypeValidator = fGrammarResolver->getDatatypeValidator(uriStr, localPart);
if (!fXsiTypeValidator)
emitError(XMLValid::BadXsiType, fXsiType->getRawName());
@@ -689,7 +689,8 @@
fTrailing = false;
}
-void SchemaValidator::preContentValidation(bool reuseGrammar)
+void SchemaValidator::preContentValidation(bool reuseGrammar,
+ bool validateDefAttr)
{
// Lets go through all the grammar in the GrammarResolver
// and validate those that has not been validated yet
@@ -705,10 +706,10 @@
while (grammarEnum.hasMoreElements())
{
SchemaGrammar& sGrammar = (SchemaGrammar&) grammarEnum.nextElement();
- if (sGrammar.getGrammarType() != Grammar::SchemaGrammarType || sGrammar.getUPAChecked())
+ if (sGrammar.getGrammarType() != Grammar::SchemaGrammarType || sGrammar.getValidated())
continue;
- sGrammar.setUPAChecked(true);
+ sGrammar.setValidated(true);
RefHash3KeysIdPoolEnumerator<SchemaElementDecl> elemEnum = sGrammar.getElemEnumerator();
@@ -837,7 +838,7 @@
}
// If it has a default/fixed value, then validate it
- if (curAttDef.getValue())
+ if (validateDefAttr && curAttDef.getValue())
{
validateAttrValue
(
1.7 +5 -1 xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.hpp
Index: SchemaValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SchemaValidator.hpp 17 Jun 2002 18:09:29 -0000 1.6
+++ SchemaValidator.hpp 11 Jul 2002 18:55:45 -0000 1.7
@@ -56,6 +56,10 @@
/*
* $Log$
+ * Revision 1.7 2002/07/11 18:55:45 knoaman
+ * Add a flag to the preContentValidation method to indicate whether to validate
+ * default/fixed attributes or not.
+ *
* Revision 1.6 2002/06/17 18:09:29 tng
* DOM L3: support "datatype-normalization"
*
@@ -165,7 +169,8 @@
, const XMLAttDef& attDef
) const;
- virtual void preContentValidation(bool reuseGrammar);
+ virtual void preContentValidation(bool reuseGrammar,
+ bool validateDefAttr = false);
virtual void postParseValidation();
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org