00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Validator.h 00006 * 00007 * Validator.h,v 1.7 2003/07/19 19:04:10 dhinton Exp 00008 * 00009 * @author Nanbor Wang <nanbor@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 #ifndef _ACEXML_VALIDATOR_H_ 00013 #define _ACEXML_VALIDATOR_H_ 00014 00015 #include /**/ "ace/pre.h" 00016 #include "ACEXML/common/ACEXML_Export.h" 00017 00018 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00019 #pragma once 00020 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00021 00022 #include "ACEXML/common/Attributes.h" 00023 #include "ACEXML/common/Env.h" 00024 #include "ACEXML/common/SAXExceptions.h" 00025 00026 /** 00027 * @class ACEXML_Validator Validator.h "common/Validator.h" 00028 * 00029 * @brief An abstract virtual class defining validator interface. 00030 * 00031 * An validator provides validation service for one XML element. 00032 * ACEXML_Validators are stateful object. Implementations should 00033 * remember the current element encountered and determine if 00034 * it's a valid sequence of child elements. A parser fishes 00035 * out a validator of certain 00036 */ 00037 class ACEXML_Export ACEXML_Validator 00038 { 00039 public: 00040 virtual ~ACEXML_Validator () = 0; 00041 00042 /** 00043 * Validate attributes of an element. 00044 * 00045 * @retval 0 if valid, -1 otherwise. 00046 */ 00047 virtual int startElement (ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) 00048 ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; 00049 00050 /** 00051 * Validate the next child element. 00052 * 00053 * @retval 0 if valid, -1 otherwise. 00054 */ 00055 virtual int nextElement (const ACEXML_Char *namespaceURI, 00056 const ACEXML_Char *localName, 00057 const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) 00058 ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; 00059 }; 00060 00061 00062 #include /**/ "ace/post.h" 00063 00064 #endif /* _ACEXML_VALIDATOR_H_ */