Skip to content
Snippets Groups Projects
Commit 61b6f416 authored by Neil Graham's avatar Neil Graham
Browse files

implement method for determining member type of union that validated some value

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175437 13f79535-47bb-0310-9956-ffa450edef68
parent 484152ba
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
/* /*
* $Log$ * $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 * Revision 1.1 2003/11/12 20:28:16 peiyongz
* Stateless Grammar: ValidationContext * Stateless Grammar: ValidationContext
* *
...@@ -75,6 +78,7 @@ XERCES_CPP_NAMESPACE_BEGIN ...@@ -75,6 +78,7 @@ XERCES_CPP_NAMESPACE_BEGIN
class XMLRefInfo; class XMLRefInfo;
class DTDEntityDecl; class DTDEntityDecl;
class DatatypeValidator;
class XMLPARSER_EXPORT ValidationContext : public XMemory class XMLPARSER_EXPORT ValidationContext : public XMemory
{ {
...@@ -122,6 +126,14 @@ public : ...@@ -122,6 +126,14 @@ public :
virtual void checkEntity(const XMLCh * const ) const = 0 ; 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 @@ private : ...@@ -158,3 +170,4 @@ private :
XERCES_CPP_NAMESPACE_END XERCES_CPP_NAMESPACE_END
#endif #endif
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
/* /*
* $Log$ * $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 * Revision 1.1 2003/11/12 20:29:47 peiyongz
* Stateless Grammar: ValidationContext * Stateless Grammar: ValidationContext
* *
...@@ -88,6 +91,7 @@ ValidationContextImpl::ValidationContextImpl(MemoryManager* const manager) ...@@ -88,6 +91,7 @@ ValidationContextImpl::ValidationContextImpl(MemoryManager* const manager)
,fIdRefList(0) ,fIdRefList(0)
,fEntityDeclPool(0) ,fEntityDeclPool(0)
,fToCheckIdRefList(true) ,fToCheckIdRefList(true)
,fValidatingMemberType(0)
{ {
fIdRefList = new (fMemoryManager) RefHashTableOf<XMLRefInfo>(109, fMemoryManager); fIdRefList = new (fMemoryManager) RefHashTableOf<XMLRefInfo>(109, fMemoryManager);
} }
......
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
/* /*
* $Log$ * $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 * Revision 1.1 2003/11/12 20:29:47 peiyongz
* Stateless Grammar: ValidationContext * Stateless Grammar: ValidationContext
* *
...@@ -119,6 +122,15 @@ public : ...@@ -119,6 +122,15 @@ public :
virtual void checkEntity(const XMLCh * const ) const; virtual void checkEntity(const XMLCh * const ) const;
/**
* Union datatype handling
*
*/
virtual DatatypeValidator * getValidatingMemberType() const;
virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) ;
//@} //@}
private: private:
...@@ -143,14 +155,34 @@ private: ...@@ -143,14 +155,34 @@ private:
// default entities (such as &gt; &lt; ...) defined by the XML Standard. // default entities (such as &gt; &lt; ...) defined by the XML Standard.
// //
// fToAddToList // 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; RefHashTableOf<XMLRefInfo>* fIdRefList;
const NameIdPool<DTDEntityDecl>* fEntityDeclPool; const NameIdPool<DTDEntityDecl>* fEntityDeclPool;
bool fToCheckIdRefList; bool fToCheckIdRefList;
DatatypeValidator * fValidatingMemberType;
}; };
inline DatatypeValidator * ValidationContextImpl::getValidatingMemberType() const
{
return fValidatingMemberType;
}
inline void ValidationContextImpl::setValidatingMemberType(DatatypeValidator * validatingMemberType)
{
fValidatingMemberType = validatingMemberType;
}
XERCES_CPP_NAMESPACE_END XERCES_CPP_NAMESPACE_END
#endif #endif
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
/* /*
* $Id$ * $Id$
* $Log$ * $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 * Revision 1.17 2003/11/13 23:19:18 peiyongz
* initSize * initSize
* *
...@@ -138,9 +141,8 @@ ...@@ -138,9 +141,8 @@
XERCES_CPP_NAMESPACE_BEGIN 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 value1[BUF_LEN+1];
static XMLCh value2[BUF_LEN+1];
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Constructors and Destructor // Constructors and Destructor
...@@ -360,6 +362,9 @@ void UnionDatatypeValidator::checkContent(const XMLCh* const content ...@@ -360,6 +362,9 @@ void UnionDatatypeValidator::checkContent(const XMLCh* const content
//set the validator of the type actually used to validate the content //set the validator of the type actually used to validate the content
DatatypeValidator *dtv = fMemberTypeValidators->elementAt(i); DatatypeValidator *dtv = fMemberTypeValidators->elementAt(i);
fValidatedDatatype = dtv; fValidatedDatatype = dtv;
// context will be null during schema construction
if(context)
context->setValidatingMemberType(dtv);
} }
catch (XMLException&) catch (XMLException&)
{ {
......
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
/* /*
* $Id$ * $Id$
* $Log$ * $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 * Revision 1.12 2003/11/12 20:32:03 peiyongz
* Statless Grammar: ValidationContext * Statless Grammar: ValidationContext
* *
...@@ -462,3 +465,4 @@ XERCES_CPP_NAMESPACE_END ...@@ -462,3 +465,4 @@ XERCES_CPP_NAMESPACE_END
/** /**
* End of file UnionDatatypeValidator.hpp * End of file UnionDatatypeValidator.hpp
*/ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment