From e1526972e3a185ee15b3078ff227be18684eb2f5 Mon Sep 17 00:00:00 2001 From: nanbor Date: Thu, 27 Dec 2001 23:01:07 +0000 Subject: *** empty log message *** --- ACEXML/common/Attributes_Def_Builder.cpp | 13 ++++++ ACEXML/common/Attributes_Def_Builder.h | 68 ++++++++++++++++++++++++++++--- ACEXML/common/DTD_Manager.cpp | 8 ++++ ACEXML/common/DTD_Manager.h | 70 ++++++++++++++++++++++++++++++++ ACEXML/common/Element_Def_Builder.cpp | 8 ++++ ACEXML/common/Element_Def_Builder.h | 3 +- ACEXML/common/Validator.cpp | 8 ++++ ACEXML/common/Validator.h | 3 +- 8 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 ACEXML/common/Attributes_Def_Builder.cpp create mode 100644 ACEXML/common/DTD_Manager.cpp create mode 100644 ACEXML/common/DTD_Manager.h create mode 100644 ACEXML/common/Element_Def_Builder.cpp create mode 100644 ACEXML/common/Validator.cpp diff --git a/ACEXML/common/Attributes_Def_Builder.cpp b/ACEXML/common/Attributes_Def_Builder.cpp new file mode 100644 index 00000000000..eac6ebfa032 --- /dev/null +++ b/ACEXML/common/Attributes_Def_Builder.cpp @@ -0,0 +1,13 @@ +// $Id$ + +#include "common/Attributes_Def_Builder.h" + +ACEXML_Attribute_Def_Builder::~ACEXML_Attribute_Def_Builder () +{ + +} + +ACEXML_Attributes_Def_Builder::~ACEXML_Attributes_Def_Builder () +{ + +} diff --git a/ACEXML/common/Attributes_Def_Builder.h b/ACEXML/common/Attributes_Def_Builder.h index 6adaa2dde9f..0e17b95a155 100644 --- a/ACEXML/common/Attributes_Def_Builder.h +++ b/ACEXML/common/Attributes_Def_Builder.h @@ -12,18 +12,19 @@ #ifndef _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ #define _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ -#include "XML_Types.h" +#include "common/XML_Types.h" +#include "common/Env.h" /** - * @ class ACEXML_Attributes_Def_Builder Attributes_Def_Builder.h "common/Attributes_Def_Builder.h" + * @ class ACEXML_Attribute_Def_Builder Attributes_Def_Builder.h "common/Attributes_Def_Builder.h" * * @ brief An abstract virtual class defining an interface - * for building attribute definitions from DTD. + * for building an attribute definition from DTD. * * This class should be invisible to application programmers and * is only used for validator implementors. */ -class ACEXML_Export ACEXML_Attributes_Def_Builder +class ACEXML_Export ACEXML_Attribute_Def_Builder { public: typedef enum { @@ -36,9 +37,64 @@ public: NMTOKEN, NMTOKENS, NOTATION, - ENUMERATION + ENUMERATION, + ERROR_TYPE, } ATT_TYPE; + typedef enum { + REQUIRED, + IMPLIED, + FIXED, + INVALID + } DEFAULT_DECL; + + virtual ~ACEXML_Attribute_Def_Builder () = 0; + + /** + * Set the attribute type. + */ + virtual int setAttType (const ATT_TYPE type, + ACEXML_Env &xmlenv) + // ACE_THORW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Insert an element for NOTATION or ENUMERATION type attribute. + */ + virtual int insertList (const ACEXML_Char Name, + ACEXML_Env &xmlenv) + // ACE_THORW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Set default attribute declaration. + */ + virtual int setDefault (const DEFAULT_DECL def, + const ACEXML_Char *value, + ACEXML_Env &xmlenv) + // ACE_THORW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Check validity of the current attribute definition being built. + * + * @retval 0 if the attribute is not a valid combo. + */ + virtual int validAttr (void) = 0; +}; + +/** + * @ class ACEXML_Attributes_Def_Builder Attributes_Def_Builder.h "common/Attributes_Def_Builder.h" + * + * @ brief An abstract virtual class defining an interface + * for building attribute definitions from DTD. + * + * This class should be invisible to application programmers and + * is only used for validator implementors. + */ +class ACEXML_Export ACEXML_Attributes_Def_Builder +{ +public: virtual ~ACEXML_Attributes_Def_Builder () = 0; /** @@ -53,6 +109,8 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; + + }; #endif /* _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ */ diff --git a/ACEXML/common/DTD_Manager.cpp b/ACEXML/common/DTD_Manager.cpp new file mode 100644 index 00000000000..29f8e1c984c --- /dev/null +++ b/ACEXML/common/DTD_Manager.cpp @@ -0,0 +1,8 @@ +// $Id$ + +#include "common/DTDManager.h" + +ACEXML_DTDManager::~ACEXML_DTDManager () +{ + +} diff --git a/ACEXML/common/DTD_Manager.h b/ACEXML/common/DTD_Manager.h new file mode 100644 index 00000000000..9d1b99fae99 --- /dev/null +++ b/ACEXML/common/DTD_Manager.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DTDManager.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= +#ifndef _ACEXML_DTD_Manager_H_ +#define _ACEXML_DTD_Manager_H_ + +#include "common/Attributes_Def_Builder.h" +#include "common/Element_Def_Builder.h" +#include "common/Validator.h" + +class ACEXML_Export ACEXML_DTDManager +{ +public: + virtual ~ACEXML_DTDManager () = 0; + + /** + * Acquire a pointer to an element definition builder. + * The XML parser use this interface to acquire the + * definition builder and use the builder to create + * the DTD element definition. The resulting builder + * is then registered with the DTD Manager or destroyed + * if error occured when the builder encountered errors. + * + * @retval 0 if error occurs creating the builder. + */ + virtual ACEXML_Element_Def_Builder *getElement_Def_Builder () = 0; + + /** + * Insert a new element definition into the DTD Manager. + * + * @retval 0 if success, -1 if error. + */ + virtual int insertElement_Definition (ACEXML_Element_Def_Builder *def, + ACEXML_Env &xmlenv) = 0; + + /** + * Acquire a pointer to an attributes definition builder. + * + */ + virtual ACEXML_Attributes_Def_Builder *getAttribute_Def_Builder () = 0; + + /** + * Insert a new attributes definition into the DTD Manager. + * + * @retval 0 if success, -1 otherwise. + */ + virtual int insertAttributes_Definition (ACEXML_Attributes_Def_Builder *def, + ACEXML_Env &xmlenv) = 0; + + /** + * Acquire an element validator to validate an XML element. + * + * @todo I haven't figured out what memory management scheme + * we should use for the acquired validator. + */ + virtual ACEXML_Validator *getValidator (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) = 0; +}; + +#endif /* _ACEXML_DTD_Manager_H_ */ diff --git a/ACEXML/common/Element_Def_Builder.cpp b/ACEXML/common/Element_Def_Builder.cpp new file mode 100644 index 00000000000..b44ce24fe2f --- /dev/null +++ b/ACEXML/common/Element_Def_Builder.cpp @@ -0,0 +1,8 @@ +// $Id$ + +#include "common/Element_Def_Builder.h" + +ACEXML_Element_Def_Builder::~ACEXML_Element_Def_Builder () +{ + +} diff --git a/ACEXML/common/Element_Def_Builder.h b/ACEXML/common/Element_Def_Builder.h index 65be6629dfb..6c79b21358e 100644 --- a/ACEXML/common/Element_Def_Builder.h +++ b/ACEXML/common/Element_Def_Builder.h @@ -12,7 +12,8 @@ #ifndef _ACEXML_ELEMENT_DEF_BUILDER_H_ #define _ACEXML_ELEMENT_DEF_BUILDER_H_ -#include "XML_Types.h" +#include "common/XML_Types.h" +#include "common/Env.h" /** * @ class ACEXML_Element_Def_Builder Element_Def_Builder.h "common/Element_Def_Builder.h" diff --git a/ACEXML/common/Validator.cpp b/ACEXML/common/Validator.cpp new file mode 100644 index 00000000000..7e6d4c1e847 --- /dev/null +++ b/ACEXML/common/Validator.cpp @@ -0,0 +1,8 @@ +// $Id$ + +#include "common/Validator.h" + +ACEXML_Validator::~ACEXML_Validator () +{ + +} diff --git a/ACEXML/common/Validator.h b/ACEXML/common/Validator.h index c5e35a63460..6e65043f8a4 100644 --- a/ACEXML/common/Validator.h +++ b/ACEXML/common/Validator.h @@ -12,7 +12,8 @@ #ifndef _ACEXML_VALIDATOR_H_ #define _ACEXML_VALIDATOR_H_ -#include "XML_Types.h" +#include "common/Attributes.h" +#include "common/Env.h" /** * @ class ACEXML_Validator Validator.h "common/Validator.h" -- cgit v1.2.1