neilg 2003/11/23 21:10:26 Modified: c/src/xercesc/framework ValidationContext.hpp c/src/xercesc/internal ValidationContextImpl.cpp ValidationContextImpl.hpp c/src/xercesc/validators/datatype UnionDatatypeValidator.cpp UnionDatatypeValidator.hpp Log: implement method for determining member type of union that validated some value Revision Changes Path 1.2 +15 -2 xml-xerces/c/src/xercesc/framework/ValidationContext.hpp Index: ValidationContext.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/ValidationContext.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ValidationContext.hpp 12 Nov 2003 20:28:16 -0000 1.1 +++ ValidationContext.hpp 24 Nov 2003 05:10:26 -0000 1.2 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/11/24 05:10:26 neilg + * implement method for determining member type of union that validated some value + * * Revision 1.1 2003/11/12 20:28:16 peiyongz * Stateless Grammar: ValidationContext * @@ -75,6 +78,7 @@ class XMLRefInfo; class DTDEntityDecl; +class DatatypeValidator; class XMLPARSER_EXPORT ValidationContext : public XMemory { @@ -122,6 +126,14 @@ virtual void checkEntity(const XMLCh * const ) const = 0 ; + /** + * Union datatype handling + * + */ + + virtual DatatypeValidator * getValidatingMemberType() const = 0 ; + virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) = 0 ; + //@} @@ -158,3 +170,4 @@ XERCES_CPP_NAMESPACE_END #endif + 1.2 +6 -2 xml-xerces/c/src/xercesc/internal/ValidationContextImpl.cpp Index: ValidationContextImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ValidationContextImpl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ValidationContextImpl.cpp 12 Nov 2003 20:29:47 -0000 1.1 +++ ValidationContextImpl.cpp 24 Nov 2003 05:10:26 -0000 1.2 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/11/24 05:10:26 neilg + * implement method for determining member type of union that validated some value + * * Revision 1.1 2003/11/12 20:29:47 peiyongz * Stateless Grammar: ValidationContext * @@ -88,6 +91,7 @@ ,fIdRefList(0) ,fEntityDeclPool(0) ,fToCheckIdRefList(true) +,fValidatingMemberType(0) { fIdRefList = new (fMemoryManager) RefHashTableOf<XMLRefInfo>(109, fMemoryManager); } 1.2 +34 -2 xml-xerces/c/src/xercesc/internal/ValidationContextImpl.hpp Index: ValidationContextImpl.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ValidationContextImpl.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ValidationContextImpl.hpp 12 Nov 2003 20:29:47 -0000 1.1 +++ ValidationContextImpl.hpp 24 Nov 2003 05:10:26 -0000 1.2 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.2 2003/11/24 05:10:26 neilg + * implement method for determining member type of union that validated some value + * * Revision 1.1 2003/11/12 20:29:47 peiyongz * Stateless Grammar: ValidationContext * @@ -119,6 +122,15 @@ virtual void checkEntity(const XMLCh * const ) const; + + /** + * Union datatype handling + * + */ + + virtual DatatypeValidator * getValidatingMemberType() const; + virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) ; + //@} private: @@ -143,14 +155,34 @@ // default entities (such as > < ...) defined by the XML Standard. // // fToAddToList + // fValidatingMemberType + // The member type in a union that actually + // validated some text. Note that the validationContext does not + // own this object, and the value of getValidatingMemberType + // will not be accurate unless the type of the most recently-validated + // element/attribute is in fact a union datatype. // ----------------------------------------------------------------------- RefHashTableOf<XMLRefInfo>* fIdRefList; const NameIdPool<DTDEntityDecl>* fEntityDeclPool; bool fToCheckIdRefList; + DatatypeValidator * fValidatingMemberType; }; + + +inline DatatypeValidator * ValidationContextImpl::getValidatingMemberType() const +{ + return fValidatingMemberType; +} + +inline void ValidationContextImpl::setValidatingMemberType(DatatypeValidator * validatingMemberType) +{ + fValidatingMemberType = validatingMemberType; +} + XERCES_CPP_NAMESPACE_END #endif + 1.18 +9 -4 xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp Index: UnionDatatypeValidator.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- UnionDatatypeValidator.cpp 13 Nov 2003 23:19:18 -0000 1.17 +++ UnionDatatypeValidator.cpp 24 Nov 2003 05:10:26 -0000 1.18 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.18 2003/11/24 05:10:26 neilg + * implement method for determining member type of union that validated some value + * * Revision 1.17 2003/11/13 23:19:18 peiyongz * initSize * @@ -138,9 +141,8 @@ XERCES_CPP_NAMESPACE_BEGIN -static const int BUF_LEN = 64; +static const unsigned int BUF_LEN = 64; static XMLCh value1[BUF_LEN+1]; -static XMLCh value2[BUF_LEN+1]; // --------------------------------------------------------------------------- // Constructors and Destructor @@ -360,6 +362,9 @@ //set the validator of the type actually used to validate the content DatatypeValidator *dtv = fMemberTypeValidators->elementAt(i); fValidatedDatatype = dtv; + // context will be null during schema construction + if(context) + context->setValidatingMemberType(dtv); } catch (XMLException&) { 1.13 +6 -2 xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp Index: UnionDatatypeValidator.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- UnionDatatypeValidator.hpp 12 Nov 2003 20:32:03 -0000 1.12 +++ UnionDatatypeValidator.hpp 24 Nov 2003 05:10:26 -0000 1.13 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.13 2003/11/24 05:10:26 neilg + * implement method for determining member type of union that validated some value + * * Revision 1.12 2003/11/12 20:32:03 peiyongz * Statless Grammar: ValidationContext * @@ -462,3 +465,4 @@ /** * End of file UnionDatatypeValidator.hpp */ +
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]