diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-11-21 18:18:51 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-11-21 18:18:51 +0000 |
commit | b1196d05b2c891d266558179ad5ebfb6013b791b (patch) | |
tree | f98577ac274d97fec992225e57541e9b042475b7 | |
parent | 0c9ea56183b64632f2c5592e4b76d71236aa1303 (diff) | |
download | ATCD-b1196d05b2c891d266558179ad5ebfb6013b791b.tar.gz |
DoxyGen document fixes.
32 files changed, 1132 insertions, 215 deletions
diff --git a/ACEXML/common/ACEXML_Export.h b/ACEXML/common/ACEXML_Export.h index f88db61c605..85ade891148 100644 --- a/ACEXML/common/ACEXML_Export.h +++ b/ACEXML/common/ACEXML_Export.h @@ -1,6 +1,15 @@ - // -*- C++ -*- -// $Id$ + +//============================================================================= +/** + * @file ACEXML_Export.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl // ------------------------------ diff --git a/ACEXML/common/Attributes.h b/ACEXML/common/Attributes.h index ae7cd88f015..1684d940872 100644 --- a/ACEXML/common/Attributes.h +++ b/ACEXML/common/Attributes.h @@ -1,73 +1,113 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file Attributes.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_ATTRIBUTES_H_ #define _ACEXML_ATTRIBUTES_H_ #include "common/XML_Types.h" +/** + * @class ACEXML_Attributes Attributes.h "common/Attributes.h" + * + * @brief ACEXML_Attributes defines a collection of attributes of an XML element. + * + * This is an abstract class (interface in Java) that defines + * the API for accessing attributes of an XML entity. + * + * This interface allows access to a list of attributes in three different ways: + * + * - by attribute index; + * - by Namespace-qualified name; or + * - by qualified (prefixed) name. + * + * The list will not contain attributes that were declared #IMPLIED + * but not specified in the start tag. It will also not contain + * attributes used as Namespace declarations (xmlns*) unless the + * http://xml.org/sax/features/namespace-prefixes feature is set to + * true (it is false by default). + * + * If the namespace-prefixes feature (see above) is false, access by + * qualified name may not be available; if the + * http://xml.org/sax/features/namespaces feature is false, access by + * Namespace-qualified names may not be available. + * + * This interface replaces the now-deprecated SAX1 AttributeList + * interface, which does not contain Namespace support. In addition to + * Namespace support, it adds the getIndex methods (below). + * + * The order of attributes in the list is unspecified, and will vary + * from implementation to implementation. + */ class ACEXML_Export ACEXML_Attributes { - // This is an abstract class (interface in Java) that defines - // the API for accessing attributes of an XML entity. public: - /* + /** * Look up the index of an attribute by XML 1.0 qualified name. */ virtual int getIndex (const ACEXML_Char *qName) = 0; - /* + /** * Look up the index of an attribute by Namespace name. */ virtual int getIndex (const ACEXML_Char *uri, const ACEXML_Char *localPart) = 0; - /* + /** * Return the number of attributes in the list. */ virtual size_t getLength (void) = 0; - /* + /** * Look up an attribute's local name by index. */ virtual const ACEXML_Char *getLocalName (size_t index) = 0; - /* + /** * Look up an attribute's XML 1.0 qualified name by index. */ virtual const ACEXML_Char *getQName (size_t index) = 0; - /* + /** * Look up an attribute's type by index. */ virtual const ACEXML_Char *getType (size_t index) = 0; - /* + /** * Look up an attribute's type by XML 1.0 qualified name. */ virtual const ACEXML_Char *getType (const ACEXML_Char *qName) = 0; - /* + /** * Look up an attribute's type by Namespace name. */ virtual const ACEXML_Char *getType (const ACEXML_Char *uri, const ACEXML_Char *localPart) = 0; - /* + /** * Look up an attribute's Namespace URI by index. */ virtual const ACEXML_Char *getURI (size_t index) = 0; - /* + /** * Look up an attribute's value by index. */ virtual const ACEXML_Char *getValue (size_t index) = 0; - /* + /** * Look up an attribute's value by XML 1.0 qualified name. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *qName) = 0; - /* + /** * Look up an attribute's value by Namespace name. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *uri, diff --git a/ACEXML/common/AttributesImpl.h b/ACEXML/common/AttributesImpl.h index 916bbffb930..4f69b9a307d 100644 --- a/ACEXML/common/AttributesImpl.h +++ b/ACEXML/common/AttributesImpl.h @@ -1,4 +1,15 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file AttributesImpl.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + #ifndef ACEXML_ATTRIBUTESIMPL_H #define ACEXML_ATTRIBUTESIMPL_H @@ -12,67 +23,128 @@ class ACEXML_AttributesImpl; +/** + * @class ACEXML_Attribute AttributesImpl.h "common/AttributesImpl.h" + * + * @brief ACEXML_Attribute defines the data structure of an attribute + * + * @sa ACEXML_AttributesImpl + */ class ACEXML_Export ACEXML_Attribute { public: friend class ACEXML_AttributesImpl; + /// Default constructor. ACEXML_Attribute (void); + + /// Copy constructor. ACEXML_Attribute (const ACEXML_Attribute &attr); + + /// Initialize all constructor. ACEXML_Attribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value); + /// Destructor. ~ACEXML_Attribute (void); + /// Set all members. void setAttribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value); + /// Set \a uri_. const ACEXML_Char *uri (void) const; + + /// Get \a uri_. void uri (const ACEXML_Char *uri); + /// Set \a localName_. const ACEXML_Char *localName (void) const; + + /// Get \a localName_. void localName (const ACEXML_Char *localName); + /// Set \a qName_. const ACEXML_Char *qName (void) const; + + /// Get \a qName_. void qName (const ACEXML_Char *qName); + /// Set \a type_. const ACEXML_Char *type (void) const; + + /// Get \a type_. void type (const ACEXML_Char *type); + /// Set \a value_. const ACEXML_Char *value (void) const; + + /// Get \a value_. void value (const ACEXML_Char *value); + /// Assignment operator. ACEXML_Attribute &operator= (const ACEXML_Attribute &rhs); + + /// Comparison operator. int operator!= (const ACEXML_Attribute&rhs) const; private: + /// @var uri_ Namespace URI of an attribute ACEXML_Char *uri_; + + /// @var localName_ ACEXML_Char *localName_; ACEXML_Char *qName_; ACEXML_Char *type_; ACEXML_Char *value_; }; +/** + * @typedef ACE_Array<ACEXML_Attribute> ACEXML_Attribute_Array + */ typedef ACE_Array<ACEXML_Attribute> ACEXML_Attribute_Array; +/** + * @class ACEXML_AttributesImpl AttributesImpl.h "common/AttributesImpl.h" + * + * @brief ACEXML_AttributesImpl provides the default implementation + * of interface ACEXML_Attributes. + * + * This class provides a default implementation of the SAX2 Attributes + * interface, with the addition of manipulators so that the list can + * be modified or reused. + * + * There are two typical uses of this class: + * + * - to take a persistent snapshot of an Attributes object in a startElement event; or + * - to construct or modify an Attributes object in a SAX2 driver or filter. + * + * This class replaces the now-deprecated SAX1 AttributeListImpl + * class; in addition to supporting the updated Attributes interface + * rather than the deprecated AttributeList interface, it also + * includes a much more efficient implementation using a single array + * rather than a set of Vectors. + * + * @sa ACEXML_Attributes + */ class ACEXML_Export ACEXML_AttributesImpl : public ACEXML_Attributes { public: - /* + /** * Initialize an AttributesImpl that holds <size> attributes. */ ACEXML_AttributesImpl (int size = ACEXML_AttributesImpl_Default_Size); ACEXML_AttributesImpl (const ACEXML_AttributesImpl &attrs); virtual ~ACEXML_AttributesImpl (void); - /* + /** * Add a new attribute using the argument(s) supplied. * Return -1 if an attribute with the same name already exists. */ @@ -83,7 +155,7 @@ public: const ACEXML_Char *value); virtual int addAttribute (const ACEXML_Attribute &att); - /* + /** * Remove an attribute from the array. Notice that this * operation can invalidate previously acquired <index> * value. (It will repack the array.) @@ -91,81 +163,81 @@ public: virtual int removeAttribute (size_t index); - /* + /** * Look up the index of an attribute by XML 1.0 qualified name. * Return -1 if we fail to find a match. */ virtual int getIndex (const ACEXML_Char *qName); - /* + /** * Look up the index of an attribute by Namespace name. * Return -1 if we fail to find a match. */ virtual int getIndex (const ACEXML_Char *uri, const ACEXML_Char *localPart); - /* + /** * Return the number of attributes in the list. */ virtual size_t getLength (void); - /* + /** * Look up an attribute's local name by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getLocalName (size_t index); - /* + /** * Look up an attribute's XML 1.0 qualified name by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getQName (size_t index); - /* + /** * Look up an attribute's type by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getType (size_t index); - /* + /** * Look up an attribute's type by XML 1.0 qualified name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getType (const ACEXML_Char *qName); - /* + /** * Look up an attribute's type by Namespace name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getType (const ACEXML_Char *uri, const ACEXML_Char *localPart); - /* + /** * Look up an attribute's Namespace URI by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getURI (size_t index); - /* + /** * Look up an attribute's value by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getValue (size_t index); - /* + /** * Look up an attribute's value by XML 1.0 qualified name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *qName); - /* + /** * Look up an attribute's value by Namespace name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *uri, const ACEXML_Char *localPart); - /* + /** * Set an attribute at index. Return -1 if index is out of * range. */ @@ -176,41 +248,42 @@ public: const ACEXML_Char *type, const ACEXML_Char *value); - /* + /** * Set the localName of the attribute at <index>. * return -1 if <index> is out of range. */ virtual int setLocalName (size_t index, const ACEXML_Char *localName); - /* + /** * Set the qName of the attribute at <index>. * return -1 if <index> is out of range. */ virtual int setQName (size_t index, const ACEXML_Char *qName); - /* + /** * Set the URI of the attribute at <index>. * return -1 if <index> is out of range. */ virtual int setURI (size_t index, const ACEXML_Char *uri); - /* + /** * Set the type of the attribute at <index>. * return -1 if <index> is out of range. */ virtual int setType (size_t index, const ACEXML_Char *type); - /* + /** * Set the value of the attribute at <index>. * return -1 if <index> is out of range. */ virtual int setValue (size_t index, const ACEXML_Char *value); private: + /// Container for all attributes. ACEXML_Attribute_Array attrs_; }; diff --git a/ACEXML/common/CharStream.h b/ACEXML/common/CharStream.h index 038cc8dd717..94d44645025 100644 --- a/ACEXML/common/CharStream.h +++ b/ACEXML/common/CharStream.h @@ -1,15 +1,30 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file CharStream.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_CHARSTREAM_H_ #define _ACEXML_CHARSTREAM_H_ #include "common/XML_Types.h" +/** + * @class ACEXML_CharStream CharStream.h "common/CharStream.h" + * + * ACEXML_CharStream is an abstract class (interface) which defines + * the basic opertions a parser could use to retrieve XML charater + * sequence. The sequence can be read from a file or a character + * buffer. + */ class ACEXML_Export ACEXML_CharStream { - // ACEXML_InputStream defines the basic opertion the parser - // could use to retrieve XML charater sequence. The sequence - // can be read from a file or a character buffer. public: /** diff --git a/ACEXML/common/ContentHandler.h b/ACEXML/common/ContentHandler.h index c1ce8ee10da..d680a9261c1 100644 --- a/ACEXML/common/ContentHandler.h +++ b/ACEXML/common/ContentHandler.h @@ -1,5 +1,14 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- +//============================================================================= +/** + * @file ContentHandler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_CONTENTHANDLER_H_ #define _ACEXML_CONTENTHANDLER_H_ @@ -8,10 +17,29 @@ #include "common/Locator.h" #include "common/Attributes.h" +/** + * @class ACEXML_ContentHandler ContentHandler.h "common/ContentHandler.h" + * + * @brief ACEXML_ContentHandler + * + * This is the main interface that most SAX applications implement: if + * the application needs to be informed of basic parsing events, it + * implements this interface and registers an instance with the SAX + * parser using the setContentHandler method. The parser uses the + * instance to report basic document-related events like the start and + * end of elements and character data. + * + * The order of events in this interface is very important, and + * mirrors the order of information in the document itself. For + * example, all of an element's content (character data, processing + * instructions, and/or subelements) will appear, in order, between + * the startElement event and the corresponding endElement event. + + */ class ACEXML_Export ACEXML_ContentHandler { public: - /* + /** * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, @@ -21,14 +49,14 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of the end of a document. */ virtual void endDocument (ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, @@ -38,7 +66,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix, @@ -46,7 +74,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, @@ -56,7 +84,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, @@ -65,13 +93,13 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator, ACEXML_Env &xmlenv) = 0; - /* + /** * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name, @@ -79,14 +107,14 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of the beginning of a document. */ virtual void startDocument (ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, @@ -97,7 +125,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, diff --git a/ACEXML/common/DTDHandler.h b/ACEXML/common/DTDHandler.h index 35f3a28ea73..c8cb7a1f8d2 100644 --- a/ACEXML/common/DTDHandler.h +++ b/ACEXML/common/DTDHandler.h @@ -1,15 +1,52 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- +//============================================================================= +/** + * @file DTDHandler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_DTDHANDLER_H_ #define _ACEXML_DTDHANDLER_H_ #include "common/Env.h" #include "common/SAXExceptions.h" +/** + * @class ACEXML_DTDHandler DTDHandler.h "common/DTDHandler.h" + * + * @brief ACEXML_DTDHandler + * + * If a SAX application needs information about notations and unparsed + * entities, then the application implements this interface and + * registers an instance with the SAX parser using the parser's + * setDTDHandler method. The parser uses the instance to report + * notation and unparsed entity declarations to the application. + * + * Note that this interface includes only those DTD events that the + * XML recommendation requires processors to report: notation and + * unparsed entity declarations. + * + * The SAX parser may report these events in any order, regardless of + * the order in which the notations and unparsed entities were + * declared; however, all DTD events must be reported after the + * document handler's startDocument event, and before the first + * startElement event. + * + * It is up to the application to store the information for future use + * (perhaps in a hash table or object tree). If the application + * encounters attributes of type "NOTATION", "ENTITY", or "ENTITIES", + * it can use the information that it obtained through this interface + * to find the entity and/or notation corresponding with the attribute + * value. + */ class ACEXML_Export ACEXML_DTDHandler { public: - /* + /** * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, @@ -19,7 +56,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, diff --git a/ACEXML/common/DefaultHandler.h b/ACEXML/common/DefaultHandler.h index f790f022056..c746550c72b 100644 --- a/ACEXML/common/DefaultHandler.h +++ b/ACEXML/common/DefaultHandler.h @@ -1,5 +1,14 @@ -// -*- C++ -*- $Id$ - +// -*- C++ -*- + +//============================================================================= +/** + * @file DefaultHandler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef ACEXML_DEFAULTHANDLER_H #define ACEXML_DEFAULTHANDLER_H @@ -8,6 +17,25 @@ #include "common/EntityResolver.h" #include "common/ErrorHandler.h" +/** + * @class ACEXML_DefaultHandler DefaultHandler.h "common/DefaultHandler.h" + * + * @brief ACEXML_DefaultHandler + * + * This class is available as a convenience base class for SAX2 + * applications: it provides default implementations for all of the + * callbacks in the four core SAX2 handler classes: + * + * - EntityResolver + * - DTDHandler + * - ContentHandler + * - ErrorHandler + * + * Application writers can extend this class when they need to + * implement only part of an interface; parser writers can instantiate + * this class to provide default handlers when the application has not + * supplied its own. + */ class ACEXML_Export ACEXML_DefaultHandler : public ACEXML_ContentHandler, public ACEXML_DTDHandler, @@ -15,13 +43,13 @@ class ACEXML_Export ACEXML_DefaultHandler public ACEXML_ErrorHandler { public: - /* + /** * Default constructor. */ ACEXML_DefaultHandler (void); - /* - * Default destructor. + /** + * destructor. */ virtual ~ACEXML_DefaultHandler (void); diff --git a/ACEXML/common/EntityResolver.h b/ACEXML/common/EntityResolver.h index d0c9f59740f..913228e2ca0 100644 --- a/ACEXML/common/EntityResolver.h +++ b/ACEXML/common/EntityResolver.h @@ -1,15 +1,42 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- +//============================================================================= +/** + * @file EntityResolver.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_ENTITYHANDLER_H_ #define _ACEXML_ENTITYHANDLER_H_ #include "common/Env.h" #include "common/InputSource.h" +/** + * @class ACEXML_EntityResolver EntityResolver.h "common/EntityResolver.h" + * + * @brief ACEXML_EntityResolver + * + * If a SAX application needs to implement customized handling for + * external entities, it must implement this interface and register an + * instance with the SAX driver using the setEntityResolver method. + * + * The XML reader will then allow the application to intercept any + * external entities (including the external DTD subset and external + * parameter entities, if any) before including them. + * + * Many SAX applications will not need to implement this interface, + * but it will be especially useful for applications that build XML + * documents from databases or other specialised input sources, or for + * applications that use URI types other than URLs. + */ class ACEXML_Export ACEXML_EntityResolver { public: - /* + /** * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, diff --git a/ACEXML/common/Env.h b/ACEXML/common/Env.h index 444ffe90b88..23d1aae4474 100644 --- a/ACEXML/common/Env.h +++ b/ACEXML/common/Env.h @@ -1,20 +1,41 @@ -// -*- C++ -*- $Id$ -// +// -*- C++ -*- + +//============================================================================= +/** + * @file Env.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_ENV_H_ #define _ACEXML_ENV_H_ #include "common/Exception.h" +/** + * @class ACEXML_Env Env.h "common/Env.h" + * + * @brief ACEXML_Env + * + * ACEXML_Env is modeled after CORBA_Environment class. It provides + * a place holder for callees to propagate exceptions back to + * callers. ACEXML does not support native exceptions at this + * moement. + * + * @sa ACEXML_Exception + */ class ACEXML_Export ACEXML_Env { - /** - * - * - */ public: + /// Default constructor. ACEXML_Env (); + + /// Copy constructor. ACEXML_Env (const ACEXML_Env &ev); + /// Destructor. ~ACEXML_Env (void); /// Check if exception has occured. diff --git a/ACEXML/common/ErrorHandler.h b/ACEXML/common/ErrorHandler.h index 4ca4294d7d0..06ddd8408e9 100644 --- a/ACEXML/common/ErrorHandler.h +++ b/ACEXML/common/ErrorHandler.h @@ -1,15 +1,46 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- +//============================================================================= +/** + * @file ErrorHandler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_ERRORHANDLER_H_ #define _ACEXML_ERRORHANDLER_H_ #include "common/Env.h" #include "common/SAXExceptions.h" +/** + * @class ACEXML_ErrorHandler ErrorHandler.h "common/ErrorHandler.h" + * + * @brief ACEXML_ErrorHandler + * + * If a SAX application needs to implement customized error handling, + * it must implement this interface and then register an instance with + * the XML reader using the setErrorHandler method. The parser will + * then report all errors and warnings through this interface. + * + * @b WARNING: If an application does not register an ErrorHandler, + * XML parsing errors will go unreported and bizarre behaviour may + * result. + * + * For XML processing errors, a SAX driver must use this interface + * instead of throwing an exception: it is up to the application to + * decide whether to throw an exception for different types of errors + * and warnings. Note, however, that there is no requirement that the + * parser continue to provide useful information after a call to + * fatalError (in other words, a SAX driver class could catch an + * exception and report a fatalError). + */ class ACEXML_Export ACEXML_ErrorHandler { public: - /* + /** * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception, @@ -17,7 +48,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception, @@ -25,7 +56,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception, diff --git a/ACEXML/common/Exception.h b/ACEXML/common/Exception.h index 6613bfc0164..7f285ff3688 100644 --- a/ACEXML/common/Exception.h +++ b/ACEXML/common/Exception.h @@ -1,37 +1,65 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file Exception.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_EXCEPTION_H_ #define _ACEXML_EXCEPTION_H_ #include "common/XML_Types.h" +/** + * @class ACEXML_Exception Exception.h "common/Exception.h" + * + * @brief ACEXML_Exception + * + * ACEXML_Exception is the base class for all ACEXML related exceptions. + * Since ACEXML currently does not support native exceptions, all + * exceptions should be thrown thru ACEXML_Env. + * + * @sa ACEXML_Env + */ class ACEXML_Export ACEXML_Exception { public: + /// Default contructor. ACEXML_Exception (void); + + /// Copu constructor. ACEXML_Exception (const ACEXML_Exception &ex); + /// Destructor. virtual ~ACEXML_Exception (void); + /// Accessor for the exception name. static const ACEXML_Char *name (void); - // Accessor for the exception name. + /// Return the exception type. (for safe downcast.) virtual const ACEXML_Char *id (void); - // Return the exception type. (for safe downcast.) + /// Dynamically create a copy of this exception. virtual ACEXML_Exception *duplicate (void) = 0; - // Dynamically create a copy of this exception. + /// Check whether this is an exception of type specify by + /// <name>. virtual int is_a (const ACEXML_Char *name) = 0; - // Check whether this is an exception of type specify by - // <name>. + /// Print out exception using ACE_DEBUG. virtual void print (void) = 0; - // Print out exception using ACE_DEBUG. protected: + /// All exceptions have names. This name is used to identify the + /// type of an exception. static const ACEXML_Char *exception_name_; + /// A null string that we return when there's no exception occurred. static const ACEXML_Char *null_; }; diff --git a/ACEXML/common/FileCharStream.h b/ACEXML/common/FileCharStream.h index 3e59bc20c69..eb6171147b1 100644 --- a/ACEXML/common/FileCharStream.h +++ b/ACEXML/common/FileCharStream.h @@ -1,4 +1,14 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file FileCharStream.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_FILECHARSTREAM_H_ #define _ACEXML_FILECHARSTREAM_H_ @@ -7,11 +17,10 @@ #include "ace/streams.h" /** + * @class ACEXML_FileCharStream FileCharStream.h "common/FileCharStream.h" + * * An implementation of ACEXML_CharStream for reading * input from a file. - * defines the basic opertion the parser - * could use to retrieve XML charater sequence. The sequence - * can be read from a file or a character buffer. */ class ACEXML_Export ACEXML_FileCharStream : public ACEXML_CharStream { diff --git a/ACEXML/common/InputSource.h b/ACEXML/common/InputSource.h index 0bf35dd187f..62ab76c6854 100644 --- a/ACEXML/common/InputSource.h +++ b/ACEXML/common/InputSource.h @@ -1,10 +1,48 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file InputSource.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_INPUTSOURCE_H_ #define _ACEXML_INPUTSOURCE_H_ #include "common/CharStream.h" +/** + * @class ACEXML_InputSource InputSource.h "common/InputSource.h" + * + * @brief ACEXML_InputSource encapsulates the actual input stream with some + * added information. + * + * This class allows a SAX application to encapsulate information + * about an input source in a single object, which may include a + * public identifier, a system identifier, a byte stream (possibly + * with a specified encoding), and/or a character stream. + * + * There are two places that the application will deliver this input + * source to the parser: as the argument to the Parser.parse method, + * or as the return value of the EntityResolver.resolveEntity method. + * + * The SAX parser will use the InputSource object to determine how to + * read XML input. If there is a character stream available, the + * parser will read that stream directly; if not, the parser will use + * a byte stream, if available; if neither a character stream nor a + * byte stream is available, the parser will attempt to open a URI + * connection to the resource identified by the system identifier. + * + * An InputSource object belongs to the application: the SAX parser + * shall never modify it in any way (it may modify a copy if + * necessary). + * + * @sa ACEXML_CharStream + */ class ACEXML_Export ACEXML_InputSource { public: diff --git a/ACEXML/common/Locator.h b/ACEXML/common/Locator.h index 19a56d14d10..91dd7ef29c6 100644 --- a/ACEXML/common/Locator.h +++ b/ACEXML/common/Locator.h @@ -1,10 +1,44 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file Locator.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_LOCATOR_H_ #define _ACEXML_LOCATOR_H_ #include "common/XML_Types.h" +/** + * @class ACEXML_Locator Locator.h "common/Locator.h" + * + * @brief ACEXML_Locator defines operations that an XML locator should support. + * + * If a SAX parser provides location information to the SAX + * application, it does so by implementing this interface and then + * passing an instance to the application using the content handler's + * setDocumentLocator method. The application can use the object to + * obtain the location of any other content handler event in the XML + * source document. + * + * Note that the results returned by the object will be valid only + * during the scope of each content handler method: the application + * will receive unpredictable results if it attempts to use the + * locator at any other time. + * + * SAX parsers are not required to supply a locator, but they are very + * strongly encouraged to do so. If the parser supplies a locator, it + * must do so before reporting any other document events. If no + * locator has been set by the time the application receives the + * startDocument event, the application should assume that a locator + * is not available. + */ class ACEXML_Export ACEXML_Locator { public: diff --git a/ACEXML/common/LocatorImpl.h b/ACEXML/common/LocatorImpl.h index 5822c97b886..404457ffaeb 100644 --- a/ACEXML/common/LocatorImpl.h +++ b/ACEXML/common/LocatorImpl.h @@ -1,10 +1,55 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file LocatorImpl.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef ACEXML_LOCALTORIMPL_H #define ACEXML_LOCALTORIMPL_H #include "common/Locator.h" +/** + * @class ACEXML_LocatorImpl LocatorImpl.h "common/LocatorImpl.h" + * + * @brief ACEXML_LocatorImpl is an implementation of ACEXML_Locator. + * + * This class is available mainly for application writers, who can + * use it to make a persistent snapshot of a locator at any point + * during a document parse: + * + * @code + * ACEXML_Locator locator; + * ACEXML_Locator startloc; + * + * public void setLocator (ACEXML_Locator locator) + * { + * // note the locator + * this.locator = locator; + * } + * + * public void startDocument () + * { + * // save the location of the start of the document + * // for future use. + * ACEXML_Locator startloc = new ACEXML_LocatorImpl(locator); + * } + * @endcode + * + * Normally, parser writers will not use this class, since it is more + * efficient to provide location information only when requested, + * rather than constantly updating a Locator object. + * + * @todo ACEXML parser doesn't support the use of Locator yet. + * + * @sa ACEXML_Locator + */ class ACEXML_Export ACEXML_LocatorImpl : public ACEXML_Locator { public: diff --git a/ACEXML/common/NamespaceSupport.h b/ACEXML/common/NamespaceSupport.h index beb4ec0407d..b712b063c94 100644 --- a/ACEXML/common/NamespaceSupport.h +++ b/ACEXML/common/NamespaceSupport.h @@ -1,4 +1,14 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file NamespaceSupport.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef ACEXML_NAMESPACESUPPORT_H #define ACEXML_NAMESPACESUPPORT_H @@ -31,24 +41,84 @@ typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String, typedef ACE_Unbounded_Queue<const ACEXML_Char *> ACEXML_STR_LIST; +/** + * @class ACEXML_Namespace_Context_Stack NamespaceSupport.h "common/NamespaceSupport.h" + * + * @brief ACEXML_Namespace_Context_Stack implements a simple stack + * that ACEXML_NamespaceSupport uses to keep track of namespace scopes. + * + * @sa ACEXML_NamespaceSupport + */ class ACEXML_Export ACEXML_Namespace_Context_Stack { public: + /// Default constructor. ACEXML_Namespace_Context_Stack (void); + + /// Destructor. ~ACEXML_Namespace_Context_Stack (void); + /// Push the old namespace before entering into a new namespace scope. int push (ACEXML_NS_CONTEXT * old); + + /// Pop the old namespace when exiting a namespace scope. ACEXML_NS_CONTEXT *pop (void); private: + /// Internal stack structure to hold namespace context. struct NS_Node_T { ACEXML_NS_CONTEXT *item_; struct NS_Node_T *next_; }; + /// Anchor point for head of stack. NS_Node_T *head_; }; +/** + * @class ACEXML_NamespaceSupport NamespaceSupport.h "common/NamespaceSupport.h" + * + * @brief ACEXML_NamespaceSupport provides namespace management + * operation for an XML parser. + * + * This class encapsulates the logic of Namespace processing: it + * tracks the declarations currently in force for each context and + * automatically processes qualified XML 1.0 names into their + * Namespace parts; it can also be used in reverse for generating XML + * 1.0 from Namespaces. + * + * Namespace support objects are reusable, but the reset method must + * be invoked between each session. + * + * Here is a simple session (in Java :-p): + * @code + * String parts[] = new String[3]; + * NamespaceSupport support = new NamespaceSupport(); + * + * support.pushContext(); + * support.declarePrefix("", "http://www.w3.org/1999/xhtml"); + * support.declarePrefix("dc", "http://www.purl.org/dc#"); + * + * String parts[] = support.processName("p", parts, false); + * System.out.println("Namespace URI: " + parts[0]); + * System.out.println("Local name: " + parts[1]); + * System.out.println("Raw name: " + parts[2]); + * + * String parts[] = support.processName("dc:title", parts, false); + * System.out.println("Namespace URI: " + parts[0]); + * System.out.println("Local name: " + parts[1]); + * System.out.println("Raw name: " + parts[2]); + * + * support.popContext(); + * @endcode + * + * Note that this class is optimized for the use case where most + * elements do not contain Namespace declarations: if the same + * prefix/URI mapping is repeated for each context (for example), this + * class will be somewhat less efficient. + * + * @sa ACEXML_Exception + */ class ACEXML_Export ACEXML_NamespaceSupport { public: diff --git a/ACEXML/common/SAXExceptions.h b/ACEXML/common/SAXExceptions.h index 5c2ffa29fef..8cf909befda 100644 --- a/ACEXML/common/SAXExceptions.h +++ b/ACEXML/common/SAXExceptions.h @@ -1,128 +1,162 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file SAXExceptions.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_SAXEXCEPTIONS_H_ #define _ACEXML_SAXEXCEPTIONS_H_ #include "common/Exception.h" +/** + * @class ACEXML_SAXException SAXExceptions.h "common/SAXExceptions.h" + * + * @brief ACEXML_SAXException + * + * ACEXML_SAXException is the mother of all SAX related exceptions. + */ class ACEXML_Export ACEXML_SAXException : public ACEXML_Exception { public: + /// Default constructor. ACEXML_SAXException (void); + + /// Constructor initializing the exception message. ACEXML_SAXException (const ACEXML_Char *msg); + + /// Copy constructor. ACEXML_SAXException (const ACEXML_SAXException &ex); + /// Destructor. virtual ~ACEXML_SAXException (void); static const ACEXML_Char *name (void); - // Accessor for the exception name. virtual const ACEXML_Char *id (void); - // Return the exception type. (for safe downcast.) + /// Return the extra message accompanying the exception. const ACEXML_Char *message (void); - // Return the extra message accompanying the exception. virtual ACEXML_Exception *duplicate (void); - // Dynamically create a copy of this exception. virtual int is_a (const ACEXML_Char *name); - // Check whether this is an exception of type specify by - // <name>. virtual void print (void); - // Print out exception using ACE_DEBUG. protected: static const ACEXML_Char *exception_name_; + /// A message providing more information about the exception being thrown. ACEXML_Char *message_; }; +/** + * @class ACEXML_SAXNotSupportedException SAXExceptions.h "common/SAXExceptions.h" + * + * @brief ACEXML_SAXNotSupportedException + */ class ACEXML_Export ACEXML_SAXNotSupportedException : public ACEXML_SAXException { public: + /// Default constructor. ACEXML_SAXNotSupportedException (void); + + /// Copy constructor. ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex); + /// Destructor. virtual ~ACEXML_SAXNotSupportedException (void); static const ACEXML_Char *name (void); - // Accessor for the exception name. virtual const ACEXML_Char *id (void); - // Return the exception type. (for safe downcast.) virtual ACEXML_Exception *duplicate (void); - // Dynamically create a copy of this exception. virtual int is_a (const ACEXML_Char *name); - // Check whether this is an exception of type specify by - // <name>. virtual void print (void); - // Print out exception using ACE_DEBUG. protected: static const ACEXML_Char *exception_name_; }; +/** + * @class ACEXML_SAXNotRecognizedException SAXExceptions.h "common/SAXExceptions.h" + * + * @brief ACEXML_SAXNotRecognizedException + */ class ACEXML_Export ACEXML_SAXNotRecognizedException : public ACEXML_SAXException { public: + /// Default constructor. ACEXML_SAXNotRecognizedException (void); + + /// Constructor with an initializing exception message. ACEXML_SAXNotRecognizedException (const ACEXML_Char *msg); + + /// Copy constructor. ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex); + /// Destructor. virtual ~ACEXML_SAXNotRecognizedException (void); static const ACEXML_Char *name (void); - // Accessor for the exception name. virtual const ACEXML_Char *id (void); - // Return the exception type. (for safe downcast.) virtual ACEXML_Exception *duplicate (void); - // Dynamically create a copy of this exception. virtual int is_a (const ACEXML_Char *name); - // Check whether this is an exception of type specify by - // <name>. virtual void print (void); - // Print out exception using ACE_DEBUG. protected: static const ACEXML_Char *exception_name_; }; +/** + * @class ACEXML_SAXParseException SAXExceptions.h "common/SAXExceptions.h" + * + * @brief ACEXML_SAXParseException + * + * @todo This exception needs to provide error location information to behave like + * the real SAXParseException defined in SAX2 spec. + */ class ACEXML_Export ACEXML_SAXParseException : public ACEXML_SAXException { public: + /// Default constructor. ACEXML_SAXParseException (void); + + /// Constructor with an initializing exception message. ACEXML_SAXParseException (const ACEXML_Char *msg); + + /// Copy constructor. ACEXML_SAXParseException (const ACEXML_SAXParseException &ex); + /// Destructor. virtual ~ACEXML_SAXParseException (void); static const ACEXML_Char *name (void); - // Accessor for the exception name. virtual const ACEXML_Char *id (void); - // Return the exception type. (for safe downcast.) virtual ACEXML_Exception *duplicate (void); - // Dynamically create a copy of this exception. virtual int is_a (const ACEXML_Char *name); - // Check whether this is an exception of type specify by - // <name>. virtual void print (void); - // Print out exception using ACE_DEBUG. protected: static const ACEXML_Char *exception_name_; diff --git a/ACEXML/common/Transcode.h b/ACEXML/common/Transcode.h index f71f97cf5ba..4cfcbb80b27 100644 --- a/ACEXML/common/Transcode.h +++ b/ACEXML/common/Transcode.h @@ -1,11 +1,30 @@ -// -*- C++ -*- $Id$ -// This file declares functions to convert char string among different -// unicode encoding (utf8, utf16, utf32) +// -*- C++ -*- + +//============================================================================= +/** + * @file Transcode.h + * + * This file declares functions to convert char string among different + * unicode encoding (utf8, utf16, utf32) + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_TRANSCODE_H_ #define _ACEXML_TRANSCODE_H_ #include "common/XML_Types.h" +/** + * @class ACEXML_Transcoder Transcode.h "common/Transcode.h" + * + * @brief ACEXML_Transcoder + * + * Wrapper class for performing transcoding among different UNICODE + * encoding. + */ class ACEXML_Export ACEXML_Transcoder { public: diff --git a/ACEXML/common/XMLFilter.h b/ACEXML/common/XMLFilter.h index 4ae2997bfb2..da09fa723ac 100644 --- a/ACEXML/common/XMLFilter.h +++ b/ACEXML/common/XMLFilter.h @@ -1,19 +1,43 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- +//============================================================================= +/** + * @file XMLFilter.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_XMLFILTER_H_ #define _ACEXML_XMLFILTER_H_ #include "common/XMLReader.h" +/** + * @class ACEXML_XMLFilter XMLFilter.h "common/XMLFilter.h" + * + * @brief ACEXML_XMLFilter + * + * An XML filter is like an XML reader, except + * that it obtains its events from another XML reader rather than a + * primary source like an XML document or database. Filters can modify + * a stream of events as they pass on to the final application. + * + * The XMLFilterImpl helper class provides a convenient base for + * creating SAX2 filters, by passing on all ACEXML_EntityResolver, + * ACEXML_DTDHandler, ACEXML_ContentHandler and ACEXML_ErrorHandler + * events automatically. + */ class ACEXML_Export ACEXML_XMLFilter : public ACEXML_XMLReader { public: - /* + /** * Get the parent reader. */ virtual ACEXML_XMLReader *getParent (void) const = 0; - /* + /** * Set the parent reader. */ virtual void setParent (ACEXML_XMLReader *parent) = 0; diff --git a/ACEXML/common/XMLFilterImpl.h b/ACEXML/common/XMLFilterImpl.h index 5710bd9d465..16429e51146 100644 --- a/ACEXML/common/XMLFilterImpl.h +++ b/ACEXML/common/XMLFilterImpl.h @@ -1,5 +1,14 @@ -// -*- C++ -*- $Id$ - +// -*- C++ -*- + +//============================================================================= +/** + * @file XMLFilterImpl.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef ACEXML_XMLFILTERIMPL_H #define ACEXML_XMLFILTERIMPL_H @@ -11,6 +20,17 @@ #include "common/EntityResolver.h" #include "common/ErrorHandler.h" +/** + * @class ACEXML_XMLFilterImpl XMLFilterImpl.h "common/XMLFilterImpl.h" + * + * @brief ACEXML_XMLFilterImpl + * + * This class is designed to sit between an XMLReader and the client + * application's event handlers. By default, it does nothing but pass + * requests up to the reader and events on to the handlers unmodified, + * but subclasses can override specific methods to modify the event + * stream or the configuration requests as they pass through. + */ class ACEXML_Export ACEXML_XMLFilterImpl : public ACEXML_XMLFilter, public ACEXML_ContentHandler, @@ -19,17 +39,17 @@ class ACEXML_Export ACEXML_XMLFilterImpl public ACEXML_ErrorHandler { public: - /* + /** * Default constructor. Create with no parent. */ ACEXML_XMLFilterImpl (void); - /* + /** * Construct an XML filter with the specified parent. */ ACEXML_XMLFilterImpl (ACEXML_XMLReader *parent); - /* + /** * Destructor. */ virtual ~ACEXML_XMLFilterImpl (void); diff --git a/ACEXML/common/XMLReader.h b/ACEXML/common/XMLReader.h index 970e4c92deb..2816f0e4938 100644 --- a/ACEXML/common/XMLReader.h +++ b/ACEXML/common/XMLReader.h @@ -1,5 +1,14 @@ -// -*- C++ -*- $Id$ - +// -*- C++ -*- + +//============================================================================= +/** + * @file XMLReader.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_XMLREADER_H_ #define _ACEXML_XMLREADER_H_ @@ -8,30 +17,45 @@ #include "common/EntityResolver.h" #include "common/ErrorHandler.h" +/** + * @class ACEXML_XMLReader XMLReader.h "common/XMLReader.h" + * + * @brief ACEXML_XMLReader + * + * XMLReader is the interface that an XML parser's SAX2 driver must + * implement. This interface allows an application to set and query + * features and properties in the parser, to register event handlers + * for document processing, and to initiate a document parse. + * + * All SAX interfaces are assumed to be synchronous: the parse methods + * must not return until parsing is complete, and readers must wait + * for an event-handler callback to return before reporting the next + * event. + */ class ACEXML_Export ACEXML_XMLReader { public: - /* + /** * Return the current content handler. */ virtual ACEXML_ContentHandler *getContentHandler (void) const = 0; - /* + /** * Return the current DTD handler. */ virtual ACEXML_DTDHandler *getDTDHandler (void) const = 0; - /* + /** * Return the current entity resolver. */ virtual ACEXML_EntityResolver *getEntityResolver (void) const = 0; - /* + /** * Return the current error handler. */ virtual ACEXML_ErrorHandler *getErrorHandler (void) const = 0; - /* + /** * Look up the value of a feature. */ virtual int getFeature (const ACEXML_Char *name, @@ -40,7 +64,7 @@ public: // ACEXML_SAXNotSupportedException)) = 0; - /* + /** * Look up the value of a property. */ virtual void * getProperty (const ACEXML_Char *name, @@ -49,7 +73,7 @@ public: // ACEXML_SAXNotSupportedException)) = 0; - /* + /** * Parse an XML document. */ virtual void parse (ACEXML_InputSource *input, @@ -57,7 +81,7 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Parse an XML document from a system identifier (URI). */ virtual void parse (const ACEXML_Char *systemId, @@ -66,27 +90,27 @@ public: // ACE_THROW_SPEC ((ACEXML_SAXException)) = 0; - /* + /** * Allow an application to register a content event handler. */ virtual void setContentHandler (ACEXML_ContentHandler *handler) = 0; - /* + /** * Allow an application to register a DTD event handler. */ virtual void setDTDHandler (ACEXML_DTDHandler *handler) = 0; - /* + /** * Allow an application to register an entity resolver. */ virtual void setEntityResolver (ACEXML_EntityResolver *resolver) = 0; - /* + /** * Allow an application to register an error event handler. */ virtual void setErrorHandler (ACEXML_ErrorHandler *handler) = 0; - /* + /** * Set the state of a feature. */ virtual void setFeature (const ACEXML_Char *name, @@ -96,7 +120,7 @@ public: // ACEXML_SAXNotSupportedException)) = 0; - /* + /** * Set the value of a property. */ virtual void setProperty (const ACEXML_Char *name, diff --git a/ACEXML/common/XML_Types.h b/ACEXML/common/XML_Types.h index e09f63740c5..b45ff7f7524 100644 --- a/ACEXML/common/XML_Types.h +++ b/ACEXML/common/XML_Types.h @@ -1,6 +1,17 @@ -// -*- C++ -*- $Id$ -// This file collects the type definitions for data types -// used in ACE XML parser. +// -*- C++ -*- + +//============================================================================= +/** + * @file XML_Types.h + * + * This file collects the type definitions for data types + * used in ACE XML parser. + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_XML_TYPES_H_ #define _ACEXML_XML_TYPES_H_ diff --git a/ACEXML/docs/TODO.txt b/ACEXML/docs/TODO.txt new file mode 100644 index 00000000000..5fa955a8985 --- /dev/null +++ b/ACEXML/docs/TODO.txt @@ -0,0 +1,35 @@ +/** +@page acexml_todo ACEXML TO-DO List + +<ul> + + <li>Make the parser dynamically loadable + + <li>Decouple ACE_Svc_Configurator from ACE Library. Allow users to + load in different configurator/parsers. + + <li>Add Namespace support. The basic supporting mechanisms are + already in place. The parser itself, however, does not take + advantage of them to differentiate the different namespace. + + <li>Add DTD parsing ability. + + <li>Add Schema paring ability. It is not clear to me, however, how + to specify which schema a document is associated with. + + <li>Add document locator implementation so we can report in which + line/column an error occurs. + + <li>Add support for resolving external entities, such as a + schema/namespace definition located on the web. + + <li>A char stream should be able to differentiate the file encoding + and perform the correct transcoding automatically. + + <li>Need to support ACEXML_Locator in the parser. There's currently + no way to tell the location where the parser is parsing or where + an error occurred. + +</ul> + +*/
\ No newline at end of file diff --git a/ACEXML/docs/bugs.txt b/ACEXML/docs/bugs.txt new file mode 100644 index 00000000000..d8af8bc9be2 --- /dev/null +++ b/ACEXML/docs/bugs.txt @@ -0,0 +1,16 @@ +/** +@page acexml_bugs ACEXML Known Bugs + +<ul> + + <li>Exception handling is not implemented. Maybe we should not try + to use the environment variables/exceptions scheme again. + Considering changing to a simpler error reporting method. + + <li>Need to verify predefined entities are working correctly. Check + out the SAXPrint example. + +</ul> + + +*/
\ No newline at end of file diff --git a/ACEXML/docs/guidelines.txt b/ACEXML/docs/guidelines.txt new file mode 100644 index 00000000000..d8a144fa3e1 --- /dev/null +++ b/ACEXML/docs/guidelines.txt @@ -0,0 +1,12 @@ +/** +@page acexml_guides ACEXML Programming Guidelines + +<ul> + + <li>Currently, there's only an example showing how to use the parser + under ACE_Wrappers/XML/examples/SAXPrint/. + +</ul> + + +*/
\ No newline at end of file diff --git a/ACEXML/docs/readme.txt b/ACEXML/docs/readme.txt new file mode 100644 index 00000000000..cf873e1ce4b --- /dev/null +++ b/ACEXML/docs/readme.txt @@ -0,0 +1,35 @@ +/** +@mainpage ACEXML - A Small and Portable XML Parser + +\section acexml_synopsis Synopsis +ACEXML is a small footprint and portable framework for integrating XML +parsing ability into user applications. The framework is based on the + <a href="http://www.saxproject.org/"> Simple API for XML +(SAX 2.0) </A> by David Megginson. A simple non-conformant XML parser +is also included in the framework. Since our original motivation was +to use the parser for specifying software composition and +configuration descriptors, at the current stage, the parser does not +fully support all the features specified in the XML specification. + +We do, however, plan to add more features to the parser and will +either release a more versatile parser or allow the current parser to +dynamically load in the extra features in the future. + + +\section acexml_features Features of ACEXML +<ul> + <li> ACEXML only recognize UNICODE documents, although they can be + in various different encoding, such as UTF-8, UTF-16, or UCS-4. + Therefore, it might be a problem to handle document containing + multi-byte charatersets. They can, however, be translated into + UNICODE before being parsed by ACEXML parser. +</ul> + +\section acexml_others Other Topics +<ol> + <li>@ref acexml_guides + <li>@ref acexml_bugs + <li>@ref acexml_todo +</ol> + +*/ diff --git a/ACEXML/examples/SAXPrint/Print_Handler.h b/ACEXML/examples/SAXPrint/Print_Handler.h index d21f013a3b3..a9608c6b322 100644 --- a/ACEXML/examples/SAXPrint/Print_Handler.h +++ b/ACEXML/examples/SAXPrint/Print_Handler.h @@ -1,10 +1,28 @@ // $Id$ +//============================================================================= +/** + * @file Print_Handler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + #ifndef ACEXML_PRINT_HANDLER_H #define ACEXML_PRINT_HANDLER_H #include "common/DefaultHandler.h" +/** + * @class ACEXML_Print_Handler + * + * @brief ACEXML_Print_Handler is an example SAX event handler. + * + * This SAX event handler prints out a detailed event report + * on every event it received. + */ class ACEXML_Print_Handler : public ACEXML_DefaultHandler { public: diff --git a/ACEXML/examples/SAXPrint/SAXPrint_Handler.h b/ACEXML/examples/SAXPrint/SAXPrint_Handler.h index 58e9a4c44ac..90fd8e9f113 100644 --- a/ACEXML/examples/SAXPrint/SAXPrint_Handler.h +++ b/ACEXML/examples/SAXPrint/SAXPrint_Handler.h @@ -1,10 +1,28 @@ // $Id$ +//============================================================================= +/** + * @file SAXPrint_Handler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + #ifndef ACEXML_SAXPRINT_HANDLER_H #define ACEXML_SAXPRINT_HANDLER_H #include "common/DefaultHandler.h" +/** + * @class ACEXML_SAXPrint_Handler + * + * @brief ACEXML_SAXPrint_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ class ACEXML_SAXPrint_Handler : public ACEXML_DefaultHandler { public: diff --git a/ACEXML/parser/parser/Entity_Manager.h b/ACEXML/parser/parser/Entity_Manager.h index e59d8dbf719..cd168af29b3 100644 --- a/ACEXML/parser/parser/Entity_Manager.h +++ b/ACEXML/parser/parser/Entity_Manager.h @@ -1,4 +1,14 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file Entity_Manager.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef ACEXML_ENTITY_MANAGER_H #define ACEXML_ENTITY_MANAGER_H @@ -31,7 +41,11 @@ typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String, ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_REVERSE_ITER; /** - * Class to manager and resolve entity references. + * @class ACEXML_Entity_Manager Entity_Manager.h "parser/parser/Entity_Manager.h" + * + * @brief Class to manage and resolve entity references. + * + * @todo Fill in details for this class. */ class ACEXML_PARSER_Export ACEXML_Entity_Manager { diff --git a/ACEXML/parser/parser/Parser.h b/ACEXML/parser/parser/Parser.h index 08b10555147..f3a0a85deda 100644 --- a/ACEXML/parser/parser/Parser.h +++ b/ACEXML/parser/parser/Parser.h @@ -1,4 +1,14 @@ -// -*- C++ -*- $Id$ +// -*- C++ -*- + +//============================================================================= +/** + * @file Parser.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= #ifndef _ACEXML_BASIC_PARSER_H_ #define _ACEXML_BASIC_PARSER_H_ @@ -36,6 +46,12 @@ typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_REVERSE_ITER; +/** + * @class ACEXML_Parser Parser.h "parser/parser/Parser.h" + * + * @brief A SAX based parser. + * + */ class ACEXML_PARSER_Export ACEXML_Parser : public ACEXML_XMLReader { public: @@ -142,120 +158,191 @@ public: // *** Helper functions for parsing XML - /// Skip any whitespace encounter and return the first - /// none-white space characters (which will be consumed from - /// the CharStream.) If no whitespace is found, - /// it will return 0. @a whitespace return a pointer to - /// the string of skipped whitespace after proper conversion. - /// @a whitespace will be null if there's no whitespace found. + /** + * Skip any whitespaces encounter. + * + * @param whitespace Return a pointer to the string of skipped + * whitespace after proper conversion. Null if there's no + * whitespace found. + * + * @retval The first none-white space characters (which will be + * consumed from the CharStream.) If no whitespace is found, it + * will return 0. + */ ACEXML_Char skip_whitespace (ACEXML_Char **whitespace); - /// Return 1 if @a c is a valid white space character. Otherwise, - /// return 0. + /** + * Check if a character @a c is a whitespace. + * + * @retval 1 if @a c is a valid white space character. 0 otherwise. + */ int is_whitespace (ACEXML_Char c); + + /** + * Check if a character @a c is a whitespace or '='. + * + * @retval 1 if true, 0 otherwise. + */ int is_whitespace_or_equal (ACEXML_Char c); + + /** + * Check if a character @a c is a valid character for nonterminal NAME. + * + * @retval 1 if true, 0 otherwise. + */ int is_nonname (ACEXML_Char c); - /// Skip an equal sign. Return 0 when succeeds, -1 if no equal sign - /// is found. + /** + * Skip an equal sign. + * + * @retval 0 when succeeds, -1 if no equal sign is found. + */ int skip_equal (void); - /// Get a quoted string. Return 0 on success, -1 otherwise. - /// @a str return the un-quoted string. Quoted strings are - /// used to specify attribute values and this routine will - /// replace character and entity references on-the-fly. Parameter - /// entitys is not allowed (or replaced) in this function. + /** + * Get a quoted string. Quoted strings are used to specify + * attribute values and this routine will replace character and + * entity references on-the-fly. Parameter entitys is not allowed + * (or replaced) in this function. + * + * @param str returns the un-quoted string. + * + * @retval 0 on success, -1 otherwise. + */ int get_quoted_string (ACEXML_Char *&str); - /// Parse a PI statement. The first character encountered - /// should always be '?' in the PI prefix "<?". - /// Return 0 on success, -1 otherwise. + /** + * Parse a PI statement. The first character encountered + * should always be '?' in the PI prefix "@<?". + * + * @retval 0 on success, -1 otherwise. + */ int parse_processing_instruction (ACEXML_Env &xmlenv); - /// Filter out a comment. The first character encountered - /// should always be the first '-' in the comment prefix - /// "<!--" + /** + * Skip over a comment. The first character encountered + * should always be the first '-' in the comment prefix + * "@<@!--". + */ int grok_comment (); - /// Read a name from the input CharStream (until white space). - /// If @a ch != 0, then we have already consumed the first name - /// character from the input CharStream, otherwise, read_name - /// will use this->get() to acquire the initial character. - /// Return a pointer to the string in the obstack, 0 if it's not - /// a valid name. + /** + * Read a name from the input CharStream (until white space). + * If @a ch @!= 0, then we have already consumed the first name + * character from the input CharStream, otherwise, read_name + * will use this->get() to acquire the initial character. + * + * @retval A pointer to the string in the obstack, 0 if it's not + * a valid name. + */ ACEXML_Char *read_name (ACEXML_Char ch = 0); - /// Parse the DOCTYPE declaration. The first character encountered - /// should always be 'D' in doctype prefix: "<!DOCTYPE". + /** + * Parse the DOCTYPE declaration. The first character encountered + * should always be 'D' in doctype prefix: "@<@!DOCTYPE". + */ int parse_doctypedecl (ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) ; - /// Parse an XML element. The first character encountered should - /// be the first character of the element "Name". + /** + * Parse an XML element. The first character encountered should + * be the first character of the element "Name". + */ void parse_element (ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) ; - /// Parse XML Prolog. + /** + * Parse XML Prolog. + */ void parse_xml_prolog (ACEXML_Env &xmlenv); - /// Parse a character reference, i.e., " " or "". Return 0 on - /// success and -1 otherwise. @a buf points to a character buffer for - /// the result and @a len specifies the capacities of the buffer. The first - /// character encountered should be the '#' char. + /** + * Parse a character reference, i.e., " " or "". The first + * character encountered should be the '#' char. + * + * @param buf points to a character buffer for + * the result. + * @param len specifies the capacities of the buffer. + * + * @retval 0 on success and -1 otherwise. + */ int parse_char_reference (ACEXML_Char *buf, size_t len); - /// Parse an entity reference, i.e., "&". Return a pointer to - /// the resolved const ACEXML_String if success (previously - /// defined), 0 otherwise. The first character encountered should be - /// the character following '&'. + /** + * Parse an entity reference, i.e., "&". The first character + * encountered should be the character following '&'. + * + * @retval A pointer to the resolved const ACEXML_String if success + * (previously defined), 0 otherwise. + */ const ACEXML_String *parse_reference (void); - /// Parse a CDATA section. The first character should always be the first - /// '[' in CDATA definition. Return 0 on success, -1 otherwise. + /** + * Parse a CDATA section. The first character should always be the first + * '[' in CDATA definition. + * + * @retval 0 on success, -1 otherwise. + */ int parse_cdata (ACEXML_Env &xmlenv); - /// Parse a "markupdecl" section, this includes both "markupdecl" and - /// "DeclSep" sections in XML specification + /** + * Parse a "markupdecl" section, this includes both "markupdecl" and + * "DeclSep" sections in XML specification + */ int parse_internal_dtd (ACEXML_Env &xmlenv); - /// Parse an "ELEMENT" decl. The first character this method - /// expects is always the 'L' (the second char) in the word - /// "ELEMENT". + /** + * Parse an "ELEMENT" decl. The first character this method + * expects is always the 'L' (the second char) in the word + * "ELEMENT". + */ int parse_element_decl (ACEXML_Env &xmlenv); - /// Parse an "ENTITY" decl. The first character this method expects - /// is always the 'N' (the second char) in the word "ENTITY". + /** + * Parse an "ENTITY" decl. The first character this method expects + * is always the 'N' (the second char) in the word "ENTITY". + */ int parse_entity_decl (ACEXML_Env &xmlenv); - /// Parse an "ATTLIST" decl. Thse first character this method - /// expects is always the 'A' (the first char) in the word - /// "ATTLIST". + /** + * Parse an "ATTLIST" decl. Thse first character this method + * expects is always the 'A' (the first char) in the word + * "ATTLIST". + */ int parse_attlist_decl (ACEXML_Env &xmlenv); - /// Parse a "NOTATION" decl. The first character this method - /// expects is always the 'N' (the first char) in the word - /// "NOTATION". + /** + *Parse a "NOTATION" decl. The first character this method + * expects is always the 'N' (the first char) in the word + * "NOTATION". + */ int parse_notation_decl (ACEXML_Env &xmlenv); +protected: /// Get a character. ACEXML_Char get (void); /// Peek a character. ACEXML_Char peek (void); - /// Check if more data can be added to a character buffer in obstack. - /// If not, the existing data in the buffer will be cleared out by - /// freezing the segment and pass it out thru a content_handler_->characters () - /// call. @a counter records the length of the existing data in - /// obstack. + /** + * Check if more data can be added to a character buffer in obstack. + * If not, the existing data in the buffer will be cleared out by + * freezing the segment and pass it out thru a content_handler_->characters () + * call. @a counter records the length of the existing data in + * obstack. + */ int try_grow_cdata (size_t size, size_t &len, ACEXML_Env &xmlenv); private: - /// Check and dispatch errors/warnings to ErrorHandler. - /// Return 0 if the error/warning is handled successfully, - /// -1, if the handler doesn't know how to handle the error/exceptions. + /** + * Check and dispatch errors/warnings to ErrorHandler. + * + * @retval 0 if the error/warning is handled successfully, -1, if + * the handler doesn't know how to handle the error/exceptions. + */ int check_exception (ACEXML_Env &xmlenv); /// Keeping track of the handlers. We do not manage diff --git a/ACEXML/parser/parser/Parser.i b/ACEXML/parser/parser/Parser.i index 562923e11c7..5298146e990 100644 --- a/ACEXML/parser/parser/Parser.i +++ b/ACEXML/parser/parser/Parser.i @@ -1,4 +1,12 @@ -// $Id$ +//============================================================================= +/** + * @file Parser.i + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= ACEXML_INLINE ACEXML_ContentHandler * ACEXML_Parser::getContentHandler (void) const diff --git a/ACEXML/parser/parser/Parser_export.h b/ACEXML/parser/parser/Parser_export.h index 28acf599a1b..71630ccd962 100644 --- a/ACEXML/parser/parser/Parser_export.h +++ b/ACEXML/parser/parser/Parser_export.h @@ -1,6 +1,15 @@ - // -*- C++ -*- -// $Id$ + +//============================================================================= +/** + * @file Parser_export.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl // ------------------------------ |