summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-12-20 23:36:16 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-12-20 23:36:16 +0000
commite7e552493f75ae63a5a2dbf8ff3b67eaa729e578 (patch)
tree3859faefbadc9158fa54917df3ae9af1bc8a145b
parent51a464dee6cb556a231545e62a680aa9e2689bba (diff)
downloadATCD-e7e552493f75ae63a5a2dbf8ff3b67eaa729e578.tar.gz
*** empty log message ***
-rw-r--r--ACEXML/common/Attributes_Def_Builder.h58
-rw-r--r--ACEXML/common/Element_Def_Builder.h122
-rw-r--r--ACEXML/common/Validator.h56
-rw-r--r--ACEXML/docs/parser_features.txt15
-rw-r--r--ACEXML/examples/SAXPrint/svc.conf.xml20
-rw-r--r--ACEXML/parser/parser/Parser.h5
6 files changed, 276 insertions, 0 deletions
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 <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+#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 <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+#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 <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+#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 @@
+<?xml version="1.0"?>
+<!-- This is a test XML file. Most of the stuff here don't make any sense at all -->
+<!DOCTYPE ACE_Svc_Conf PUBLIC 'GOODSAM' 'http://ace.cs.wustl.edu/dtd/ACE_SVCCONF.DTD'
+ [
+ <!NOTATION goody PUBLIC 'NBC' 'http://hardcoreace.com/'>
+ <!NOTATION frodo PUBLIC 'ABC'>
+ <!NOTATION bilbo SYSTEM "C:/ACE-GUIDELINE">
+ <!ENTITY ccm 'CCM_App'>
+ <!ENTITY pippin PUBLIC 'GOTO' 'http://taozen.com/' NDATA NBC>
+ <!ENTITY sam PUBLIC 'SHIRE' 'http://taozen.com/'>
+ <!ENTITY gandolf SYSTEM 'D:/RINGS.DOT'>
+ <!ELEMENT GOOBEGONE EMPTY>
+ <!ELEMENT POOPOO ANY>
+ <!ELEMENT HOHOHO ((BOOBOO, GOOBEGONE)?, (GOOBEGONE|POOPOO)*)+>
+ <!ELEMENT BOOBOO (#PCDATA | BOOBOO)*>
+ <!ATTLIST GOOBEGONE
+ ohmy CDATA #REQUIRED
+ testing IDREF #IMPLIED>
+ ]>
+
<ACE_Svc_Conf>
<static id="ACE_Service_Manager">
<params>-d</params>
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_[];