You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2002/11/20 20:57:44 UTC
cvs commit: xml-xerces/c/src/xercesc/validators/datatype ListDatatypeValidator.hpp ListDatatypeValidator.cpp
peiyongz 2002/11/20 11:57:44
Modified: c/src/xercesc/validators/datatype ListDatatypeValidator.hpp
ListDatatypeValidator.cpp
Log:
validate content as a whole against pattern.
Revision Changes Path
1.3 +7 -2 xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
Index: ListDatatypeValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ListDatatypeValidator.hpp 4 Nov 2002 14:53:28 -0000 1.2
+++ ListDatatypeValidator.hpp 20 Nov 2002 19:57:44 -0000 1.3
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.3 2002/11/20 19:57:44 peiyongz
+ * validate content as a whole against pattern.
+ *
* Revision 1.2 2002/11/04 14:53:28 tng
* C++ Namespace Support.
*
@@ -210,7 +213,9 @@
private:
- void checkContent(RefVectorOf<XMLCh>* tokenVector, bool asBase);
+ void checkContent(RefVectorOf<XMLCh>* tokenVector
+ , const XMLCh* const content
+ , bool asBase);
bool valueSpaceCheck(RefVectorOf<XMLCh>* tokenVector
, const XMLCh* const enumStr) const;
1.4 +15 -13 xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
Index: ListDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ListDatatypeValidator.cpp 4 Nov 2002 14:53:28 -0000 1.3
+++ ListDatatypeValidator.cpp 20 Nov 2002 19:57:44 -0000 1.4
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.4 2002/11/20 19:57:44 peiyongz
+ * validate content as a whole against pattern.
+ *
* Revision 1.3 2002/11/04 14:53:28 tng
* C++ Namespace Support.
*
@@ -188,7 +191,7 @@
setContent(content);
RefVectorOf<XMLCh>* tokenVector = XMLString::tokenizeString(content);
Janitor<RefVectorOf<XMLCh> > janName(tokenVector);
- checkContent(tokenVector, false);
+ checkContent(tokenVector, content, false);
}
void ListDatatypeValidator::checkContent( const XMLCh* const content, bool asBase)
@@ -196,18 +199,20 @@
setContent(content);
RefVectorOf<XMLCh>* tokenVector = XMLString::tokenizeString(content);
Janitor<RefVectorOf<XMLCh> > janName(tokenVector);
- checkContent(tokenVector, asBase);
+ checkContent(tokenVector, content, asBase);
}
//
// here content is a list of items
//
-void ListDatatypeValidator::checkContent( RefVectorOf<XMLCh>* tokenVector, bool asBase)
+void ListDatatypeValidator::checkContent( RefVectorOf<XMLCh>* tokenVector
+ , const XMLCh* const content
+ , bool asBase)
{
DatatypeValidator* bv = getBaseValidator();
if (bv->getType() == DatatypeValidator::List)
- ((ListDatatypeValidator*)bv)->checkContent(tokenVector, true);
+ ((ListDatatypeValidator*)bv)->checkContent(tokenVector, content, true);
else
{ // the ultimate itemType DTV
for (unsigned int i = 0; i < tokenVector->size(); i++)
@@ -231,18 +236,15 @@
}
}
- //check each and every item in the list
- for (unsigned int i = 0; i < tokenVector->size(); i++)
+ //check every item in the list as a whole
+ if (getRegex()->matches(content) == false)
{
- if (getRegex()->matches(tokenVector->elementAt(i)) ==false)
- {
- ThrowXML2(InvalidDatatypeValueException
+ ThrowXML2(InvalidDatatypeValueException
, XMLExcepts::VALUE_NotMatch_Pattern
- , tokenVector->elementAt(i)
+ , content
, getPattern());
- }
-
}
+
}
// if this is a base validator, we only need to check pattern facet
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org