From e7e552493f75ae63a5a2dbf8ff3b67eaa729e578 Mon Sep 17 00:00:00 2001 From: nanbor Date: Thu, 20 Dec 2001 23:36:16 +0000 Subject: *** empty log message *** --- ACEXML/common/Attributes_Def_Builder.h | 58 ++++++++++++++++ ACEXML/common/Element_Def_Builder.h | 122 +++++++++++++++++++++++++++++++++ ACEXML/common/Validator.h | 56 +++++++++++++++ ACEXML/docs/parser_features.txt | 15 ++++ ACEXML/examples/SAXPrint/svc.conf.xml | 20 ++++++ ACEXML/parser/parser/Parser.h | 5 ++ 6 files changed, 276 insertions(+) create mode 100644 ACEXML/common/Attributes_Def_Builder.h create mode 100644 ACEXML/common/Element_Def_Builder.h create mode 100644 ACEXML/common/Validator.h create mode 100644 ACEXML/docs/parser_features.txt diff --git a/ACEXML/common/Attributes_Def_Builder.h b/ACEXML/common/Attributes_Def_Builder.h new file mode 100644 index 00000000000..6adaa2dde9f --- /dev/null +++ b/ACEXML/common/Attributes_Def_Builder.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Attributes_Def_Builder.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= +#ifndef _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ +#define _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ + +#include "XML_Types.h" + +/** + * @ 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: + typedef enum { + CDATA, + ID, + IDREF, + IDREFS, + ENTITY, + ENTITIES, + NMTOKEN, + NMTOKENS, + NOTATION, + ENUMERATION + } ATT_TYPE; + + virtual ~ACEXML_Attributes_Def_Builder () = 0; + + /** + * Set the element name that the attribute builder applies. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int setElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + +}; + +#endif /* _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ */ diff --git a/ACEXML/common/Element_Def_Builder.h b/ACEXML/common/Element_Def_Builder.h new file mode 100644 index 00000000000..65be6629dfb --- /dev/null +++ b/ACEXML/common/Element_Def_Builder.h @@ -0,0 +1,122 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Element_Def_Builder.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= +#ifndef _ACEXML_ELEMENT_DEF_BUILDER_H_ +#define _ACEXML_ELEMENT_DEF_BUILDER_H_ + +#include "XML_Types.h" + +/** + * @ class ACEXML_Element_Def_Builder Element_Def_Builder.h "common/Element_Def_Builder.h" + * + * @ brief An abstract virtual class that defines the interface + * to define an element definition. + * + * This class defines how to define an element definition after + * parsing a DTD. + */ +class ACEXML_Export ACEXML_Element_Def_Builder +{ +public: + + typedef enum { + EMPTY, + ANY, + MIXED, + CHILDREN + } CONTENT_TYPE; + + typedef enum { + ONE, + ZERO_OR_MORE, + ONE_OR_MORE, + ONE_OR_ZERO + } CARDINALITY; + + virtual ~ACEXML_Element_Def_Builder () = 0; + + /** + * Define the name of the element. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int setElementName (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Define the content type of the element. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int setContentType (CONTENT_TYPE type, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Insert one more element into Mixed definition. + */ + virtual int insertMixedElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Start a new group of children. + */ + virtual int startChildGroup () = 0; + + /** + * End a new group of children. + * + * @retval 0 on success. + */ + virtual int endChildGroup (CARDINALITY card, + ACEXML_Env &xmlenv) = 0; + + /** + * Set the type of current child group to Choice. + * + * @retval 0 on success, -1 if the type of the child group has + * already been set and this action conflicts with the previous + * setting. + */ + virtual int setChoice () = 0; + + /** + * Set the type of current child group to Sequence. + * + * @retval 0 on success, -1 if the type of the child group has + * already been set and this action conflicts with the previous + * setting. + */ + virtual int setSequence () = 0; + + /** + * Insert an new element into the current child group. + * + * @retval 0 on success, -1 otherwise. + */ + virtual int insertElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; +}; + +#endif /* _ACEXML_ELEMENT_DEF_BUILDER_H_ */ diff --git a/ACEXML/common/Validator.h b/ACEXML/common/Validator.h new file mode 100644 index 00000000000..c5e35a63460 --- /dev/null +++ b/ACEXML/common/Validator.h @@ -0,0 +1,56 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Validator.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= +#ifndef _ACEXML_VALIDATOR_H_ +#define _ACEXML_VALIDATOR_H_ + +#include "XML_Types.h" + +/** + * @ class ACEXML_Validator Validator.h "common/Validator.h" + * + * @ brief An abstract virtual class defining validator interface. + * + * An validator provides validation service for one XML element. + * ACEXML_Validators are stateful object. Implementations should + * remember the current element encountered and determine if + * it's a valid sequence of child elements. A parser fishes + * out a validator of certain + */ +class ACEXML_Export ACEXML_Validator +{ +public: + virtual ~ACEXML_Validator () = 0; + + /** + * Validate attributes of an element. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int startElement (ACEXML_Attributes *atts, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Validate the next child element. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int nextElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; +}; + +#endif /* _ACEXML_VALIDATOR_H_ */ diff --git a/ACEXML/docs/parser_features.txt b/ACEXML/docs/parser_features.txt new file mode 100644 index 00000000000..9a049c5fabb --- /dev/null +++ b/ACEXML/docs/parser_features.txt @@ -0,0 +1,15 @@ +/** +@defgroup acexml_parser_features Configurable Special Features of ACEXML Parser +@{ + +There are special features in ACEXML Parser that can be +activated/deactivated thru @c setFeature. Likewise, whether a feature +has been activated or not can be queried using @c getFeature. + +@sa ACEXML_XMLReader::setFeature +@sa ACEXML_XMLReader::getFeature + +Here is a list of supported features: + +@} +*/ \ No newline at end of file diff --git a/ACEXML/examples/SAXPrint/svc.conf.xml b/ACEXML/examples/SAXPrint/svc.conf.xml index 78f51d1fab3..ff0eebe831f 100644 --- a/ACEXML/examples/SAXPrint/svc.conf.xml +++ b/ACEXML/examples/SAXPrint/svc.conf.xml @@ -1,3 +1,23 @@ + + + + + + + + + + + + + + + ]> + -d diff --git a/ACEXML/parser/parser/Parser.h b/ACEXML/parser/parser/Parser.h index 57053cbeec8..df19607e160 100644 --- a/ACEXML/parser/parser/Parser.h +++ b/ACEXML/parser/parser/Parser.h @@ -409,7 +409,12 @@ protected: */ /** + * @var simple_parsing_name_ * + * This constant string defines the name of "simple XML parsing" + * feature. When this feature is enable, ACEXML parser is allowed + * to parse a simple XML stream without mandated XML prolog + * and no DTD defintion. */ static const ACEXML_Char simple_parsing_name_[]; -- cgit v1.2.1