summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-11-15 17:18:19 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-11-15 17:18:19 +0000
commitf76bc212378ee42dd8ff2665896fd6b1b2553651 (patch)
treeead45f21c0eb6a33fdcfbb6d39919592abdc7622
parentf30a68993b5d63668a7df21d079320aa0782a893 (diff)
downloadATCD-f76bc212378ee42dd8ff2665896fd6b1b2553651.tar.gz
ChangeLogTag:Thu Nov 15 11:11:14 2001 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--ACEXML/ACEXML.dsw44
-rw-r--r--ACEXML/Makefile19
-rw-r--r--ACEXML/README17
-rw-r--r--ACEXML/common/ACEXML_Export.h44
-rw-r--r--ACEXML/common/Attributes.h76
-rw-r--r--ACEXML/common/AttributesImpl.cpp285
-rw-r--r--ACEXML/common/AttributesImpl.h220
-rw-r--r--ACEXML/common/AttributesImpl.i151
-rw-r--r--ACEXML/common/CharStream.cpp7
-rw-r--r--ACEXML/common/CharStream.h51
-rw-r--r--ACEXML/common/ContentHandler.h110
-rw-r--r--ACEXML/common/DTDHandler.h34
-rw-r--r--ACEXML/common/DefaultHandler.cpp176
-rw-r--r--ACEXML/common/DefaultHandler.h189
-rw-r--r--ACEXML/common/DefaultHandler.i1
-rw-r--r--ACEXML/common/EntityResolver.h22
-rw-r--r--ACEXML/common/Env.cpp22
-rw-r--r--ACEXML/common/Env.h46
-rw-r--r--ACEXML/common/Env.i26
-rw-r--r--ACEXML/common/ErrorHandler.h37
-rw-r--r--ACEXML/common/Exception.cpp69
-rw-r--r--ACEXML/common/Exception.h41
-rw-r--r--ACEXML/common/Exception.i7
-rw-r--r--ACEXML/common/FileCharStream.cpp80
-rw-r--r--ACEXML/common/FileCharStream.h67
-rw-r--r--ACEXML/common/InputSource.cpp100
-rw-r--r--ACEXML/common/InputSource.h82
-rw-r--r--ACEXML/common/Locator.h32
-rw-r--r--ACEXML/common/LocatorImpl.cpp53
-rw-r--r--ACEXML/common/LocatorImpl.h79
-rw-r--r--ACEXML/common/LocatorImpl.i29
-rw-r--r--ACEXML/common/Makefile50
-rw-r--r--ACEXML/common/NamespaceSupport.cpp276
-rw-r--r--ACEXML/common/NamespaceSupport.h158
-rw-r--r--ACEXML/common/NamespaceSupport.i16
-rw-r--r--ACEXML/common/SAXExceptions.cpp269
-rw-r--r--ACEXML/common/SAXExceptions.h134
-rw-r--r--ACEXML/common/SAXExceptions.i33
-rw-r--r--ACEXML/common/Transcode.cpp83
-rw-r--r--ACEXML/common/Transcode.h74
-rw-r--r--ACEXML/common/Transcode.i234
-rw-r--r--ACEXML/common/XMLFilter.h22
-rw-r--r--ACEXML/common/XMLFilterImpl.cpp380
-rw-r--r--ACEXML/common/XMLFilterImpl.h313
-rw-r--r--ACEXML/common/XMLFilterImpl.i14
-rw-r--r--ACEXML/common/XMLReader.h110
-rw-r--r--ACEXML/common/XML_Common.dsp251
-rw-r--r--ACEXML/common/XML_Types.h57
-rw-r--r--ACEXML/examples/SAXPrint/Makefile49
-rw-r--r--ACEXML/examples/SAXPrint/Print_Handler.cpp209
-rw-r--r--ACEXML/examples/SAXPrint/Print_Handler.h179
-rw-r--r--ACEXML/examples/SAXPrint/Print_Handler.i1
-rw-r--r--ACEXML/examples/SAXPrint/SAXPrint.dsp130
-rw-r--r--ACEXML/examples/SAXPrint/SAXPrint.dsw29
-rw-r--r--ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp222
-rw-r--r--ACEXML/examples/SAXPrint/SAXPrint_Handler.h190
-rw-r--r--ACEXML/examples/SAXPrint/SAXPrint_Handler.i13
-rw-r--r--ACEXML/examples/SAXPrint/main.cpp49
-rw-r--r--ACEXML/examples/SAXPrint/ns.svc.conf.xml46
-rw-r--r--ACEXML/examples/SAXPrint/svc.conf.xml47
-rw-r--r--ACEXML/parser/parser/Entity_Manager.cpp48
-rw-r--r--ACEXML/parser/parser/Entity_Manager.h59
-rw-r--r--ACEXML/parser/parser/Entity_Manager.i21
-rw-r--r--ACEXML/parser/parser/Makefile40
-rw-r--r--ACEXML/parser/parser/Parser.cpp1208
-rw-r--r--ACEXML/parser/parser/Parser.dsp123
-rw-r--r--ACEXML/parser/parser/Parser.dsw28
-rw-r--r--ACEXML/parser/parser/Parser.h285
-rw-r--r--ACEXML/parser/parser/Parser.i128
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLogs/ChangeLog-02a4
-rw-r--r--ChangeLogs/ChangeLog-03a4
72 files changed, 7806 insertions, 0 deletions
diff --git a/ACEXML/ACEXML.dsw b/ACEXML/ACEXML.dsw
new file mode 100644
index 00000000000..51d90412162
--- /dev/null
+++ b/ACEXML/ACEXML.dsw
@@ -0,0 +1,44 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ACEXML_Parser"=.\parser\parser\Parser.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name XML_Common
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "XML_Common"=.\COMMON\XML_Common.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/ACEXML/Makefile b/ACEXML/Makefile
new file mode 100644
index 00000000000..a3785a71053
--- /dev/null
+++ b/ACEXML/Makefile
@@ -0,0 +1,19 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Makefile for the client programs that test the ACE network services
+#----------------------------------------------------------------------------
+
+DIRS = Common \
+ Basic_Parser \
+ tests
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU
diff --git a/ACEXML/README b/ACEXML/README
new file mode 100644
index 00000000000..1e65588029e
--- /dev/null
+++ b/ACEXML/README
@@ -0,0 +1,17 @@
+$Id$
+
+ACE XML PARSER Framework README file
+
+* Character set
+
+ACE XML only deal with pure unicode encoding. I.e., ACE XML
+does not care about language specific encoding information.
+
+* SAX - The Simple API for XML
+
+ACE XML Parser interfaces follows the the design of SAX 2.0, which is
+a public domain specification for Java. The major difference between
+ACE XML Parser interfaces and SAX is that we added an reference of
+ACEXML_Env to every SAX method to accomodate platforms/compilers that
+don't support C++ exceptions. SAX is defined by David Megginson
+<david@megginson.com>
diff --git a/ACEXML/common/ACEXML_Export.h b/ACEXML/common/ACEXML_Export.h
new file mode 100644
index 00000000000..f88db61c605
--- /dev/null
+++ b/ACEXML/common/ACEXML_Export.h
@@ -0,0 +1,44 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef ACEXML_EXPORT_H
+#define ACEXML_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (ACEXML_HAS_DLL)
+# define ACEXML_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && ACEXML_HAS_DLL */
+
+#if defined (ACE_HAS_DLL)
+# if !defined (ACEXML_HAS_DLL)
+# define ACEXML_HAS_DLL 1
+# endif /* ! ACEXML_HAS_DLL */
+#else
+# if !defined (ACEXML_HAS_DLL)
+# define ACEXML_HAS_DLL 0
+# endif /* ! ACEXML_HAS_DLL */
+#endif
+
+#if defined (ACEXML_HAS_DLL) && (ACEXML_HAS_DLL == 1)
+# if defined (ACEXML_BUILD_DLL)
+# define ACEXML_Export ACE_Proper_Export_Flag
+# define ACEXML_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define ACEXML_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* ACEXML_BUILD_DLL */
+# define ACEXML_Export ACE_Proper_Import_Flag
+# define ACEXML_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define ACEXML_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* ACEXML_BUILD_DLL */
+#else /* ACEXML_HAS_DLL == 1 */
+# define ACEXML_Export
+# define ACEXML_SINGLETON_DECLARATION(T)
+# define ACEXML_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* ACEXML_HAS_DLL == 1 */
+
+#endif /* ACEXML_EXPORT_H */
+
+// End of auto generated file.
diff --git a/ACEXML/common/Attributes.h b/ACEXML/common/Attributes.h
new file mode 100644
index 00000000000..53cb66eef23
--- /dev/null
+++ b/ACEXML/common/Attributes.h
@@ -0,0 +1,76 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_ATTRIBUTES_H_
+#define _ACEXML_ATTRIBUTES_H_
+
+#include "Common/XML_Types.h"
+
+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,
+ const ACEXML_Char *localPart) = 0;
+};
+#endif /* _ACEXML_ ATTRIBUTES_H_ */
diff --git a/ACEXML/common/AttributesImpl.cpp b/ACEXML/common/AttributesImpl.cpp
new file mode 100644
index 00000000000..03b508482da
--- /dev/null
+++ b/ACEXML/common/AttributesImpl.cpp
@@ -0,0 +1,285 @@
+// -*- C++ -*- $Id$
+
+#include "Common/AttributesImpl.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/AttributesImpl.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_AttributesImpl::ACEXML_AttributesImpl (int size)
+ : attrs_ (size)
+{
+ this->attrs_.size (0); // attrs array contains nothing
+}
+
+ACEXML_AttributesImpl::ACEXML_AttributesImpl (const
+ ACEXML_AttributesImpl &attrs)
+ : ACEXML_Attributes (attrs),
+ attrs_ (attrs.attrs_.size ())
+{
+ for (size_t i = 0; i < attrs.attrs_.size (); i++)
+ this->attrs_[i] = attrs.attrs_[i];
+}
+
+ACEXML_AttributesImpl::~ACEXML_AttributesImpl (void)
+{
+}
+
+int
+ACEXML_AttributesImpl::addAttribute (const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ const ACEXML_Char *value)
+{
+ // @@ How do I check for the name here? Which name should
+ // I use to check for duplication?
+
+ int length = this->attrs_.size ();
+
+ this->attrs_.size (length+1);
+ this->setAttribute (length,
+ uri,
+ localName,
+ qName,
+ type,
+ value);
+ return length;
+}
+
+int
+ACEXML_AttributesImpl::addAttribute (const ACEXML_Attribute &att)
+{
+ // @@ How do I check for the name here? Which name should
+ // I use to check for duplication?
+
+ int length = this->attrs_.size ();
+
+ this->attrs_.size (length+1);
+ this->attrs_[length] = att;
+ return length;
+}
+
+int
+ACEXML_AttributesImpl::removeAttribute (size_t index)
+{
+ size_t length = this->attrs_.size ();
+
+ if (index >= length)
+ return -1;
+
+ this->attrs_[index] = this->attrs_[length - 1];
+ this->attrs_.size (length - 1);
+
+ return 0;
+}
+
+
+int
+ACEXML_AttributesImpl::getIndex (const ACEXML_Char *qName)
+{
+ for (size_t i = 0; i < this->attrs_.size (); i++)
+ if (ACE_OS::strcmp (qName, this->attrs_[i].qName ()) == 0)
+ return i;
+
+ return -1;
+}
+
+int
+ACEXML_AttributesImpl::getIndex (const ACEXML_Char *uri,
+ const ACEXML_Char *localPart)
+{
+ for (size_t i = 0; i < this->attrs_.size (); i++)
+ if (ACE_OS::strcmp (uri, this->attrs_[i].uri ()) == 0 &&
+ ACE_OS::strcmp (localPart, this->attrs_[i].localName ()) == 0)
+ return i;
+
+ return -1;
+}
+
+ACEXML_INLINE size_t
+ACEXML_AttributesImpl::getLength (void)
+{
+ return this->attrs_.size ();
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_AttributesImpl::getLocalName (size_t index)
+{
+ if (index < this->attrs_.size ())
+ return this->attrs_[index].localName ();
+ return 0;
+}
+
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_AttributesImpl::getQName (size_t index)
+{
+ if (index < this->attrs_.size ())
+ return this->attrs_[index].qName ();
+ return 0;
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_AttributesImpl::getType (size_t index)
+{
+ if (index < this->attrs_.size ())
+ return this->attrs_[index].type ();
+ return 0;
+}
+
+
+const ACEXML_Char *
+ACEXML_AttributesImpl::getType (const ACEXML_Char *qName)
+{
+ for (size_t i = 0; i < this->attrs_.size (); i++)
+ if (ACE_OS::strcmp (qName, this->attrs_[i].qName ()) == 0)
+ return this->attrs_[i].type ();
+
+ return 0;
+}
+
+const ACEXML_Char *
+ACEXML_AttributesImpl::getType (const ACEXML_Char *uri,
+ const ACEXML_Char *localPart)
+{
+ for (size_t i = 0; i < this->attrs_.size (); i++)
+ if (ACE_OS::strcmp (uri, this->attrs_[i].uri ()) == 0 &&
+ ACE_OS::strcmp (localPart, this->attrs_[i].localName ()) == 0)
+ return this->attrs_[i].type ();
+
+ return 0;
+}
+
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_AttributesImpl::getURI (size_t index)
+{
+ if (index < this->attrs_.size ())
+ return this->attrs_[index].uri ();
+ return 0;
+}
+
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_AttributesImpl::getValue (size_t index)
+{
+ if (index < this->attrs_.size ())
+ return this->attrs_[index].value ();
+ return 0;
+}
+
+const ACEXML_Char *
+ACEXML_AttributesImpl::getValue (const ACEXML_Char *qName)
+{
+ for (size_t i = 0; i < this->attrs_.size (); i++)
+ if (ACE_OS::strcmp (qName, this->attrs_[i].qName ()) == 0)
+ return this->attrs_[i].value ();
+
+ return 0;
+}
+
+const ACEXML_Char *
+ACEXML_AttributesImpl::getValue (const ACEXML_Char *uri,
+ const ACEXML_Char *localPart)
+{
+ for (size_t i = 0; i < this->attrs_.size (); i++)
+ if (ACE_OS::strcmp (uri, this->attrs_[i].uri ()) == 0 &&
+ ACE_OS::strcmp (localPart, this->attrs_[i].localName ()) == 0)
+ return this->attrs_[i].value ();
+
+ return 0;
+}
+
+ACEXML_INLINE int
+ACEXML_AttributesImpl::setAttribute (size_t index,
+ const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ const ACEXML_Char *value)
+{
+ if (index < this->attrs_.size ())
+ {
+ this->attrs_[index].setAttribute (uri,
+ localName,
+ qName,
+ type,
+ value);
+ return 0;
+ }
+
+ return -1;
+}
+
+
+ACEXML_INLINE int
+ACEXML_AttributesImpl::setLocalName (size_t index,
+ const ACEXML_Char *localName)
+{
+ if (index < this->attrs_.size ())
+ {
+ this->attrs_[index].localName (localName);
+ return 0;
+ }
+ return -1;
+}
+
+ACEXML_INLINE int
+ACEXML_AttributesImpl::setQName (size_t index,
+ const ACEXML_Char *qName)
+{
+ if (index < this->attrs_.size ())
+ {
+ this->attrs_[index].qName (qName);
+ return 0;
+ }
+ return -1;
+}
+
+
+ACEXML_INLINE int
+ACEXML_AttributesImpl::setURI (size_t index,
+ const ACEXML_Char *uri)
+{
+ if (index < this->attrs_.size ())
+ {
+ this->attrs_[index].uri (uri);
+ return 0;
+ }
+ return -1;
+}
+
+ACEXML_INLINE int
+ACEXML_AttributesImpl::setType (size_t index,
+ const ACEXML_Char *type)
+{
+ if (index < this->attrs_.size ())
+ {
+ this->attrs_[index].type (type);
+ return 0;
+ }
+ return -1;
+}
+
+ACEXML_INLINE int
+ACEXML_AttributesImpl::setValue (size_t index,
+ const ACEXML_Char *value)
+{
+ if (index < this->attrs_.size ())
+ {
+ this->attrs_[index].value (value);
+ return 0;
+ }
+ return -1;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Array_Base<ACEXML_Attribute>;
+template class ACE_Array<ACEXML_Attribute>;
+template class ACE_Array_Iterator<ACEXML_Attribute>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Array_Base<ACEXML_Attribute>
+#pragma instantiate ACE_Array<ACEXML_Attribute>
+#pragma instantiate ACE_Array_Iterator<ACEXML_Attribute>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/ACEXML/common/AttributesImpl.h b/ACEXML/common/AttributesImpl.h
new file mode 100644
index 00000000000..9d4b6cf52fe
--- /dev/null
+++ b/ACEXML/common/AttributesImpl.h
@@ -0,0 +1,220 @@
+// -*- C++ -*- $Id$
+
+#ifndef ACEXML_ATTRIBUTESIMPL_H
+#define ACEXML_ATTRIBUTESIMPL_H
+
+#include "Common/Attributes.h"
+#include "ace/Containers_T.h"
+
+#if !defined ACEXML_AttributesImpl_Default_Size
+#define ACEXML_AttributesImpl_Default_Size 20
+#endif /* ACEXML_AttributesImpl_Default_Size */
+
+class ACEXML_AttributesImpl;
+
+class ACEXML_Export ACEXML_Attribute
+{
+public:
+ friend class ACEXML_AttributesImpl;
+
+ ACEXML_Attribute (void);
+ ACEXML_Attribute (const ACEXML_Attribute &attr);
+ ACEXML_Attribute (const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ const ACEXML_Char *value);
+
+ ~ACEXML_Attribute (void);
+
+ void setAttribute (const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ const ACEXML_Char *value);
+
+ const ACEXML_Char *uri (void) const;
+ void uri (const ACEXML_Char *uri);
+
+ const ACEXML_Char *localName (void) const;
+ void localName (const ACEXML_Char *localName);
+
+ const ACEXML_Char *qName (void) const;
+ void qName (const ACEXML_Char *qName);
+
+ const ACEXML_Char *type (void) const;
+ void type (const ACEXML_Char *type);
+
+ const ACEXML_Char *value (void) const;
+ void value (const ACEXML_Char *value);
+
+ ACEXML_Attribute &operator= (const ACEXML_Attribute &rhs);
+ int operator!= (const ACEXML_Attribute&rhs) const;
+
+private:
+ ACEXML_Char *uri_;
+ ACEXML_Char *localName_;
+ ACEXML_Char *qName_;
+ ACEXML_Char *type_;
+ ACEXML_Char *value_;
+};
+
+typedef ACE_Array<ACEXML_Attribute> ACEXML_Attribute_Array;
+
+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.
+ */
+ virtual int addAttribute (const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ 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.)
+ */
+ 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.
+ */
+ virtual int setAttribute (size_t index,
+ const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ 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:
+ ACEXML_Attribute_Array attrs_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/AttributesImpl.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_ATTRIBUTESIMPL_H */
diff --git a/ACEXML/common/AttributesImpl.i b/ACEXML/common/AttributesImpl.i
new file mode 100644
index 00000000000..8e9b5ef2d6e
--- /dev/null
+++ b/ACEXML/common/AttributesImpl.i
@@ -0,0 +1,151 @@
+// -*- C++ -*- $Id$
+
+#include "ace/ACE.h"
+
+ACEXML_INLINE
+ACEXML_Attribute::ACEXML_Attribute (void)
+ : uri_ (0),
+ localName_ (0),
+ qName_ (0),
+ type_ (0),
+ value_ (0)
+{
+}
+
+ACEXML_INLINE
+ACEXML_Attribute::ACEXML_Attribute (const ACEXML_Attribute &attr)
+ : uri_ (ACE::strnew (attr.uri_)),
+ localName_ (ACE::strnew (attr.localName_)),
+ qName_ (ACE::strnew (attr.qName_)),
+ type_ (ACE::strnew (attr.type_)),
+ value_ (ACE::strnew (attr.value_))
+{
+}
+
+ACEXML_INLINE
+ACEXML_Attribute::ACEXML_Attribute (const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ const ACEXML_Char *value)
+ : uri_ (ACE::strnew (uri)),
+ localName_ (ACE::strnew (localName)),
+ qName_ (ACE::strnew (qName)),
+ type_ (ACE::strnew (type)),
+ value_ (ACE::strnew (value))
+{
+}
+
+ACEXML_INLINE
+ACEXML_Attribute::~ACEXML_Attribute (void)
+{
+ delete this->uri_;
+ delete this->localName_;
+ delete this->qName_;
+ delete this->type_;
+ delete this->value_;
+}
+
+ACEXML_INLINE void
+ACEXML_Attribute::setAttribute (const ACEXML_Char *uri,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ const ACEXML_Char *type,
+ const ACEXML_Char *value)
+{
+ this->uri (uri);
+ this->qName (qName);
+ this->localName (localName);
+ this->type (type);
+ this->value (value);
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_Attribute::uri (void) const
+{
+ return this->uri_;
+}
+
+ACEXML_INLINE void
+ACEXML_Attribute::uri (const ACEXML_Char *uri)
+{
+ delete this->uri_;
+ this->uri_ = ACE::strnew (uri);
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_Attribute::localName (void) const
+{
+ return this->localName_;
+}
+
+ACEXML_INLINE void
+ACEXML_Attribute::localName (const ACEXML_Char *localName)
+{
+ delete this->localName_;
+ this->localName_ = ACE::strnew (localName);
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_Attribute::qName (void) const
+{
+ return this->qName_;
+}
+
+ACEXML_INLINE void
+ACEXML_Attribute::qName (const ACEXML_Char *qName)
+{
+ delete this->qName_;
+ this->qName_ = ACE::strnew (qName);
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_Attribute::type (void) const
+{
+ return this->type_;
+}
+
+ACEXML_INLINE void
+ACEXML_Attribute::type (const ACEXML_Char *type)
+{
+ delete this->type_;
+ this->type_ = ACE::strnew (type);
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_Attribute::value (void) const
+{
+ return this->value_;
+}
+
+ACEXML_INLINE void
+ACEXML_Attribute::value (const ACEXML_Char *value)
+{
+ delete this->value_;
+ this->value_ = ACE::strnew (value);
+}
+
+ACEXML_INLINE ACEXML_Attribute &
+ACEXML_Attribute::operator= (const ACEXML_Attribute &rhs)
+{
+ if (this != &rhs) // Check for self assignment
+ {
+ this->uri (rhs.uri ());
+ this->qName (rhs.qName ());
+ this->localName (rhs.localName ());
+ this->type (rhs.type ());
+ this->value (rhs.value ());
+ }
+ return *this;
+}
+
+ACEXML_INLINE int
+ACEXML_Attribute::operator!= (const ACEXML_Attribute &rhs) const
+{
+ return (ACE_OS::strcmp (this->uri_, rhs.uri ()) == 0 &&
+ ACE_OS::strcmp (this->localName_, rhs.localName ()) == 0 &&
+ ACE_OS::strcmp (this->qName_, rhs .qName ()) == 0 &&
+ ACE_OS::strcmp (this->type_, rhs.type ()) == 0 &&
+ ACE_OS::strcmp (this->value_, rhs.value ()) == 0 ? 0 : 1);
+
+}
diff --git a/ACEXML/common/CharStream.cpp b/ACEXML/common/CharStream.cpp
new file mode 100644
index 00000000000..3b3baf4ba88
--- /dev/null
+++ b/ACEXML/common/CharStream.cpp
@@ -0,0 +1,7 @@
+// -*- C++ -*- $Id$
+
+#include "Common/CharStream.h"
+
+ACEXML_CharStream::~ACEXML_CharStream (void)
+{
+}
diff --git a/ACEXML/common/CharStream.h b/ACEXML/common/CharStream.h
new file mode 100644
index 00000000000..2e52418d303
--- /dev/null
+++ b/ACEXML/common/CharStream.h
@@ -0,0 +1,51 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_CHARSTREAM_H_
+#define _ACEXML_CHARSTREAM_H_
+
+#include "Common/XML_Types.h"
+
+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:
+
+ /**
+ * Virtual destructor, must have.
+ */
+ virtual ~ACEXML_CharStream () = 0;
+
+ /**
+ * Returns the available ACEXML_Char in the buffer. -1
+ * if the object is not initialized properly.
+ */
+ virtual int available (void) = 0;
+
+ /**
+ * Close this stream and release all resources used by it.
+ */
+ virtual int close (void) = 0;
+
+ /**
+ * Read the next ACEXML_Char. Return -1 if we are not able to
+ * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed.
+ */
+ virtual int get (ACEXML_Char& ch) = 0;
+
+ /**
+ * Read the next batch of ACEXML_Char strings
+ */
+ virtual int read (ACEXML_Char *str,
+ size_t len) = 0;
+
+ /**
+ * Peek the next ACEXML_Char in the CharStream. Return the
+ * character if succeess, -1 if EOS is reached.
+ */
+ virtual int peek (void) = 0;
+
+};
+
+#endif /* _ACEXML_CHARSTREAM_H_ */
diff --git a/ACEXML/common/ContentHandler.h b/ACEXML/common/ContentHandler.h
new file mode 100644
index 00000000000..020c5a250e9
--- /dev/null
+++ b/ACEXML/common/ContentHandler.h
@@ -0,0 +1,110 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_CONTENTHANDLER_H_
+#define _ACEXML_CONTENTHANDLER_H_
+
+#include "Common/Env.h"
+#include "Common/SAXExceptions.h"
+#include "Common/Locator.h"
+#include "Common/Attributes.h"
+
+class ACEXML_Export ACEXML_ContentHandler
+{
+public:
+ /*
+ * Receive notification of character data.
+ */
+ virtual void characters (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // 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,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * End the scope of a prefix-URI mapping.
+ */
+ virtual void endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Receive notification of ignorable whitespace in element content.
+ */
+ virtual void ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Receive notification of a processing instruction.
+ */
+ virtual void processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // 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,
+ ACEXML_Env &xmlenv)
+ // 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,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *atts,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Begin the scope of a prefix-URI Namespace mapping.
+ */
+ virtual void startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+};
+
+#endif /* _ACEXML_CONTENTHANDLER_H_ */
diff --git a/ACEXML/common/DTDHandler.h b/ACEXML/common/DTDHandler.h
new file mode 100644
index 00000000000..97e7ee7aafb
--- /dev/null
+++ b/ACEXML/common/DTDHandler.h
@@ -0,0 +1,34 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_DTDHANDLER_H_
+#define _ACEXML_DTDHANDLER_H_
+
+#include "Common/Env.h"
+#include "Common/SAXExceptions.h"
+
+class ACEXML_Export ACEXML_DTDHandler
+{
+public:
+ /*
+ * Receive notification of a notation declaration event.
+ */
+ virtual void notationDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Receive notification of an unparsed entity declaration event.
+ */
+ virtual void unparsedEntityDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ const ACEXML_Char *notationName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+};
+
+#endif /* _ACEXML_DTDHANDLER_H_ */
diff --git a/ACEXML/common/DefaultHandler.cpp b/ACEXML/common/DefaultHandler.cpp
new file mode 100644
index 00000000000..7d09d61ddf0
--- /dev/null
+++ b/ACEXML/common/DefaultHandler.cpp
@@ -0,0 +1,176 @@
+// -*- C++ -*- $Id$
+
+#include "Common/DefaultHandler.h"
+#if !defined (__ACEXML_INLINE__)
+# include "Common/DefaultHandler.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_DefaultHandler::ACEXML_DefaultHandler (void)
+{
+ // no-op
+}
+
+ACEXML_DefaultHandler::~ACEXML_DefaultHandler (void)
+{
+ // no-op
+}
+
+void
+ACEXML_DefaultHandler::characters (const ACEXML_Char *,
+ int,
+ int,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::endDocument (ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::endElement (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::endPrefixMapping (const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::ignorableWhitespace (const ACEXML_Char *,
+ int,
+ int,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::processingInstruction (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::setDocumentLocator (ACEXML_Locator *,
+ ACEXML_Env &)
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::skippedEntity (const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::startDocument (ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::startElement (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Attributes *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::startPrefixMapping (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+ // *** Methods inherit from ACEXML_DTDHandler.
+
+void
+ACEXML_DefaultHandler::notationDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::unparsedEntityDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+ // Methods inherit from ACEXML_EnitityResolver.
+
+ACEXML_InputSource *
+ACEXML_DefaultHandler::resolveEntity (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+ return 0;
+}
+
+ // Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+void
+ACEXML_DefaultHandler::error (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::fatalError (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_DefaultHandler::warning (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
diff --git a/ACEXML/common/DefaultHandler.h b/ACEXML/common/DefaultHandler.h
new file mode 100644
index 00000000000..8e86950476e
--- /dev/null
+++ b/ACEXML/common/DefaultHandler.h
@@ -0,0 +1,189 @@
+// -*- C++ -*- $Id$
+
+#ifndef ACEXML_DEFAULTHANDLER_H
+#define ACEXML_DEFAULTHANDLER_H
+
+#include "Common/ContentHandler.h"
+#include "Common/DTDHandler.h"
+#include "Common/EntityResolver.h"
+#include "Common/ErrorHandler.h"
+
+class ACEXML_Export ACEXML_DefaultHandler
+ : public ACEXML_ContentHandler,
+ public ACEXML_DTDHandler,
+ public ACEXML_EntityResolver,
+ public ACEXML_ErrorHandler
+{
+public:
+ /*
+ * Default constructor.
+ */
+ ACEXML_DefaultHandler (void);
+
+ /*
+ * Default destructor.
+ */
+ virtual ~ACEXML_DefaultHandler (void);
+
+ // Methods inherit from ACEXML_ContentHandler.
+
+ /*
+ * Receive notification of character data.
+ */
+ virtual void characters (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of a document.
+ */
+ virtual void endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of an element.
+ */
+ virtual void endElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * End the scope of a prefix-URI mapping.
+ */
+ virtual void endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of ignorable whitespace in element content.
+ */
+ virtual void ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a processing instruction.
+ */
+ virtual void processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive an object for locating the origin of SAX document events.
+ */
+ virtual void setDocumentLocator (ACEXML_Locator *locator,
+ ACEXML_Env &xmlenv) ;
+
+ /*
+ * Receive notification of a skipped entity.
+ */
+ virtual void skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of a document.
+ */
+ virtual void startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of an element.
+ */
+ virtual void startElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *atts,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Begin the scope of a prefix-URI Namespace mapping.
+ */
+ virtual void startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // *** Methods inherit from ACEXML_DTDHandler.
+
+ /*
+ * Receive notification of a notation declaration event.
+ */
+ virtual void notationDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of an unparsed entity declaration event.
+ */
+ virtual void unparsedEntityDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ const ACEXML_Char *notationName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_EnitityResolver.
+
+ /*
+ * Allow the application to resolve external entities.
+ */
+ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+ virtual void error (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a non-recoverable error.
+ */
+ virtual void fatalError (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a warning.
+ */
+ virtual void warning (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/DefaultHandler.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_DEFAULTHANDLER_H */
diff --git a/ACEXML/common/DefaultHandler.i b/ACEXML/common/DefaultHandler.i
new file mode 100644
index 00000000000..77b4466a3cb
--- /dev/null
+++ b/ACEXML/common/DefaultHandler.i
@@ -0,0 +1 @@
+// -*- C++ -*- $Id$
diff --git a/ACEXML/common/EntityResolver.h b/ACEXML/common/EntityResolver.h
new file mode 100644
index 00000000000..8716e8cbeb7
--- /dev/null
+++ b/ACEXML/common/EntityResolver.h
@@ -0,0 +1,22 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_ENTITYHANDLER_H_
+#define _ACEXML_ENTITYHANDLER_H_
+
+#include "Common/Env.h"
+#include "Common/InputSource.h"
+
+class ACEXML_Export ACEXML_EntityResolver
+{
+public:
+ /*
+ * Allow the application to resolve external entities.
+ */
+ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+};
+
+#endif /* _ACEXML_ENTITYHANDLER_H_ */
diff --git a/ACEXML/common/Env.cpp b/ACEXML/common/Env.cpp
new file mode 100644
index 00000000000..326dcbe2a4c
--- /dev/null
+++ b/ACEXML/common/Env.cpp
@@ -0,0 +1,22 @@
+// -*- C++ -*- $Id$
+
+#include "Common/Env.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/Env.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_Env::ACEXML_Env (void)
+ : exception_ (0)
+{
+}
+
+ACEXML_Env::ACEXML_Env (const ACEXML_Env &ev)
+ : exception_ (ev.exception_->duplicate ())
+{
+}
+
+ACEXML_Env::~ACEXML_Env (void)
+{
+ delete this->exception_;
+}
diff --git a/ACEXML/common/Env.h b/ACEXML/common/Env.h
new file mode 100644
index 00000000000..ff3cc8a063f
--- /dev/null
+++ b/ACEXML/common/Env.h
@@ -0,0 +1,46 @@
+// -*- C++ -*- $Id$
+//
+
+#ifndef _ACEXML_ENV_H_
+#define _ACEXML_ENV_H_
+#include "Common/Exception.h"
+
+class ACEXML_Export ACEXML_Env
+{
+ /**
+ *
+ *
+ */
+public:
+ ACEXML_Env ();
+ ACEXML_Env (const ACEXML_Env &ev);
+
+ ~ACEXML_Env (void);
+
+ /// Check if exception has occured.
+ int exception_occured (void) const;
+
+ /// Clear the exception and reset the evnrionment.
+ void reset (void);
+
+ /// Return the underlying exception for examination
+ ACEXML_Exception *exception (void) const;
+
+ /// Set the underlying exception. ACEXML_Env assumes
+ /// ownership of the exception.
+ void exception (ACEXML_Exception *exception);
+
+private:
+ /// Place holder for exception (if one occurs.)
+ ACEXML_Exception *exception_;
+};
+
+// = These macros are used to speed up programming. I hope to
+// merge them with ACE_CHECK macros someday.
+#define ACEXML_CHECK if (xmlenv.exception ()) return;
+#define ACEXML_CHECK_RETURN(VAL) if (xmlenv.exception ()) return VAL;
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/Env.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* _ACEXML_ENV_H_ */
diff --git a/ACEXML/common/Env.i b/ACEXML/common/Env.i
new file mode 100644
index 00000000000..e3b149089b1
--- /dev/null
+++ b/ACEXML/common/Env.i
@@ -0,0 +1,26 @@
+// -*- C++ -*- $Id$
+
+ACEXML_INLINE int
+ACEXML_Env::exception_occured (void) const
+{
+ return this->exception_ != 0;
+}
+
+ACEXML_INLINE void
+ACEXML_Env::reset (void)
+{
+ this->exception (0);
+}
+
+ACEXML_INLINE ACEXML_Exception *
+ACEXML_Env::exception (void) const
+{
+ return this->exception_;
+}
+
+ACEXML_INLINE void
+ACEXML_Env::exception (ACEXML_Exception *ex)
+{
+ delete this->exception_;
+ this->exception_ = ex;
+}
diff --git a/ACEXML/common/ErrorHandler.h b/ACEXML/common/ErrorHandler.h
new file mode 100644
index 00000000000..b8c7004980b
--- /dev/null
+++ b/ACEXML/common/ErrorHandler.h
@@ -0,0 +1,37 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_ERRORHANDLER_H_
+#define _ACEXML_ERRORHANDLER_H_
+
+#include "Common/Env.h"
+#include "Common/SAXExceptions.h"
+
+class ACEXML_Export ACEXML_ErrorHandler
+{
+public:
+ /*
+ * Receive notification of a recoverable error.
+ */
+ virtual void error (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Receive notification of a non-recoverable error.
+ */
+ virtual void fatalError (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Receive notification of a warning.
+ */
+ virtual void warning (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+};
+
+#endif /* _ACEXML_ERRORHANDLER_H_ */
diff --git a/ACEXML/common/Exception.cpp b/ACEXML/common/Exception.cpp
new file mode 100644
index 00000000000..307dfd8d4b2
--- /dev/null
+++ b/ACEXML/common/Exception.cpp
@@ -0,0 +1,69 @@
+// -*- C++ -*- $Id$
+
+#include "Common/Exception.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/Exception.i"
+#endif /* __ACEXML_INLINE__ */
+
+static const ACEXML_Char ACEXML_Exception_name[] = {
+ 'A', 'C', 'E', 'X', 'M', 'L',
+ '_', 'E', 'x', 'c', 'e', 'p',
+ 't', 'i', 'o', 'n', 0};
+const ACEXML_Char *ACEXML_Exception::exception_name_ = ACEXML_Exception_name;
+
+static const ACEXML_Char ACEXML_Exception_null [] = {0};
+const ACEXML_Char *ACEXML_Exception::null_ = ACEXML_Exception_null;
+
+ACEXML_Exception::ACEXML_Exception (void)
+{
+}
+
+ACEXML_Exception::ACEXML_Exception (const ACEXML_Exception &)
+{
+}
+
+
+ACEXML_Exception::~ACEXML_Exception (void)
+{
+}
+
+const ACEXML_Char *
+ACEXML_Exception::id (void)
+{
+ return ACEXML_Exception::exception_name_;
+}
+
+// @@ An example of how duplicate should be implemented.
+
+// ACEXML_Exception *
+// ACEXML_Exception::duplicate (void)
+// {
+// ACEXML_Exception *tmp;
+// ACE_NEW_RETURN (tmp,
+// ACEXML_Exception (*this),
+// // Replace ACEXML_Exception with appropriate type.
+// 0);
+// }
+
+int
+ACEXML_Exception::is_a (const ACEXML_Char *name)
+{
+ if (name == ACEXML_Exception::exception_name_
+ || ACE_OS::strcmp (ACEXML_Exception::exception_name_,
+ name) == 0)
+ return 1;
+
+ return 0;
+}
+
+void
+ACEXML_Exception::print (void)
+{
+ // @@ Nanbor, I don't know how to handle the case
+ // when we define ACEXML_UTF16 as ACEXML_Char
+ ACE_DEBUG ((LM_DEBUG,
+ "Exception: ACEXML_Exception\n"));
+}
diff --git a/ACEXML/common/Exception.h b/ACEXML/common/Exception.h
new file mode 100644
index 00000000000..28e0de377b2
--- /dev/null
+++ b/ACEXML/common/Exception.h
@@ -0,0 +1,41 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_EXCEPTION_H_
+#define _ACEXML_EXCEPTION_H_
+
+#include "Common/XML_Types.h"
+
+class ACEXML_Export ACEXML_Exception
+{
+public:
+ ACEXML_Exception (void);
+ ACEXML_Exception (const ACEXML_Exception &ex);
+
+ virtual ~ACEXML_Exception (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) = 0;
+ // Dynamically create a copy of this exception.
+
+ virtual int is_a (const ACEXML_Char *name) = 0;
+ // Check whether this is an exception of type specify by
+ // <name>.
+
+ virtual void print (void) = 0;
+ // Print out exception using ACE_DEBUG.
+
+protected:
+ static const ACEXML_Char *exception_name_;
+
+ static const ACEXML_Char *null_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/Exception.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* _ACEXML_EXCEPTION_H_ */
diff --git a/ACEXML/common/Exception.i b/ACEXML/common/Exception.i
new file mode 100644
index 00000000000..5e5438921b6
--- /dev/null
+++ b/ACEXML/common/Exception.i
@@ -0,0 +1,7 @@
+// -*- C++ -*- $Id$
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_Exception::name (void)
+{
+ return ACEXML_Exception::exception_name_;
+}
diff --git a/ACEXML/common/FileCharStream.cpp b/ACEXML/common/FileCharStream.cpp
new file mode 100644
index 00000000000..e872f5c8e43
--- /dev/null
+++ b/ACEXML/common/FileCharStream.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#include "Common/FileCharStream.h"
+#include "ace/ACE.h"
+
+ACEXML_FileCharStream::ACEXML_FileCharStream (void)
+ : filename_ (0),
+ istream_ ()
+{
+}
+
+ACEXML_FileCharStream::ACEXML_FileCharStream (const ACEXML_Char *name)
+ : filename_ (),
+ istream_ ()
+{
+ this->open (name);
+}
+
+
+ACEXML_FileCharStream::~ACEXML_FileCharStream (void)
+{
+ delete this->filename_;
+}
+
+int
+ACEXML_FileCharStream::open (const ACEXML_Char *name)
+{
+ delete this->filename_;
+ this->filename_ = 0;
+
+ this->istream_.open (name, ios::in);
+ if (this->istream_.bad ())
+ return -1;
+
+ this->filename_ = ACE::strnew (name);
+ return 0;
+}
+
+int
+ACEXML_FileCharStream::available (void)
+{
+ // Should return # of char available.
+
+ if (this->istream_.is_open ())
+ return 0;
+
+ return -1;
+}
+
+int
+ACEXML_FileCharStream::close (void)
+{
+ delete this->filename_;
+ this->filename_ = 0;
+ this->istream_.close ();
+ return 0;
+}
+
+int
+ACEXML_FileCharStream::get (ACEXML_Char& ch)
+{
+ // @@ Error checking?
+ ch = this->istream_.get ();
+ return 0;
+}
+
+int
+ACEXML_FileCharStream::read (ACEXML_Char *str,
+ size_t len)
+{
+ // @@ Error Checking?
+ this->istream_.read (str, len);
+ return 0;
+}
+
+int
+ACEXML_FileCharStream::peek (void)
+{
+ return this->istream_.peek ();
+}
diff --git a/ACEXML/common/FileCharStream.h b/ACEXML/common/FileCharStream.h
new file mode 100644
index 00000000000..0be3a14217c
--- /dev/null
+++ b/ACEXML/common/FileCharStream.h
@@ -0,0 +1,67 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_FILECHARSTREAM_H_
+#define _ACEXML_FILECHARSTREAM_H_
+
+#include "Common/CharStream.h"
+#include "ace/streams.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
+{
+public:
+ /// Default constructor.
+ ACEXML_FileCharStream (void);
+
+ /// Construct and opening a file.
+ ACEXML_FileCharStream (const ACEXML_Char *name);
+
+ /// Destructor
+ virtual ~ACEXML_FileCharStream (void);
+
+ /// Open a file.
+ int open (const ACEXML_Char *name);
+
+ /**
+ * Returns the available ACEXML_Char in the buffer. -1
+ * if the object is not initialized properly.
+ */
+ virtual int available (void);
+
+ /**
+ * Close this stream and release all resources used by it.
+ */
+ virtual int close (void);
+
+ /**
+ * Read the next ACEXML_Char. Return -1 if we are not able to
+ * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed.
+ */
+ virtual int get (ACEXML_Char& ch);
+
+ /**
+ * Read the next batch of ACEXML_Char strings
+ */
+ virtual int read (ACEXML_Char *str,
+ size_t len);
+
+ /**
+ * Peek the next ACEXML_Char in the CharStream. Return the
+ * character if succeess, -1 if EOS is reached.
+ */
+ virtual int peek (void);
+
+private:
+ ACEXML_Char *filename_;
+
+ ifstream istream_;
+
+};
+
+#endif /* _ACEXML_FILECHARSTREAM_H_ */
diff --git a/ACEXML/common/InputSource.cpp b/ACEXML/common/InputSource.cpp
new file mode 100644
index 00000000000..c350531f656
--- /dev/null
+++ b/ACEXML/common/InputSource.cpp
@@ -0,0 +1,100 @@
+// -*- C++ -*- $Id$
+
+#include "Common/InputSource.h"
+#include "ace/ACE.h"
+
+ACEXML_InputSource::ACEXML_InputSource (void)
+ : publicId_ (0),
+ systemId_ (0),
+ charStream_ (0),
+ encoding_ (0)
+{
+}
+
+ACEXML_InputSource::ACEXML_InputSource (ACEXML_CharStream *stm)
+ : publicId_ (0),
+ systemId_ (0),
+ charStream_ (stm),
+ encoding_ (0)
+{
+}
+
+ /*
+ * Create a new input source with a character stream.
+ * /
+ InputSource (Reader);
+ */
+
+ACEXML_InputSource::ACEXML_InputSource (const ACEXML_Char *systemId)
+ : systemId_ (ACE::strnew (systemId))
+{
+}
+
+ACEXML_InputSource::~ACEXML_InputSource (void)
+{
+ delete this->publicId_;
+ delete this->systemId_;
+ delete this->charStream_;
+ delete this->encoding_;
+}
+
+ACEXML_CharStream *
+ACEXML_InputSource::getCharStream (void)
+{
+ return this->charStream_;
+}
+
+ /*
+ * Get the character stream for this input source.
+ * /
+ virtual Reader *getCharacterStream (void);
+ */
+
+const ACEXML_Char *
+ACEXML_InputSource::getEncoding (void)
+{
+ return this->encoding_;
+}
+
+const ACEXML_Char *
+ACEXML_InputSource::getPublicId (void)
+{
+ return this->publicId_;
+}
+
+const ACEXML_Char *
+ACEXML_InputSource::getSystemId (void)
+{
+ return this->systemId_;
+}
+
+void
+ACEXML_InputSource::setCharStream (ACEXML_CharStream *stm)
+{
+ delete this->charStream_;
+ this->charStream_ = stm;
+}
+
+ /*
+ * Set the character stream for this input source.
+ * /
+ virtual void setCharacterStream (Reader *characterStream);
+ */
+
+void
+ACEXML_InputSource::setEncoding (const ACEXML_Char *encoding)
+{
+ this->encoding_ = ACE::strnew (encoding);
+}
+
+void
+ACEXML_InputSource::setPublicId (const ACEXML_Char *publicId)
+{
+ this->publicId_ = ACE::strnew (publicId);
+}
+
+void
+ACEXML_InputSource::setSystemId (const ACEXML_Char *systemId)
+{
+ this->systemId_ = ACE::strnew (systemId);
+}
diff --git a/ACEXML/common/InputSource.h b/ACEXML/common/InputSource.h
new file mode 100644
index 00000000000..396b7626e52
--- /dev/null
+++ b/ACEXML/common/InputSource.h
@@ -0,0 +1,82 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_INPUTSOURCE_H_
+#define _ACEXML_INPUTSOURCE_H_
+
+#include "Common/CharStream.h"
+
+class ACEXML_Export ACEXML_InputSource
+{
+public:
+ /*
+ * Default constructor.
+ */
+ ACEXML_InputSource (void);
+
+ /*
+ * Create a new input source with a ACEXML_Char stream.
+ * Notice that ACEXML_InputSource assumes the ownership
+ * of <stream>
+ */
+ ACEXML_InputSource (ACEXML_CharStream *stream);
+
+ /*
+ * Create a new input source with a system identifier.
+ */
+ ACEXML_InputSource (const ACEXML_Char *systemId);
+
+ /*
+ * Default destructor.
+ */
+ virtual ~ACEXML_InputSource (void);
+
+ /*
+ * Get the ACEXML_Char stream for this input source.
+ */
+ virtual ACEXML_CharStream *getCharStream (void);
+
+ /*
+ * Get the character encoding for a byte stream or URI.
+ */
+ virtual const ACEXML_Char *getEncoding (void);
+
+ /*
+ * Get the public identifier for this input source.
+ */
+ virtual const ACEXML_Char *getPublicId (void);
+
+ /*
+ * Get the system identifier for this input source.
+ */
+ virtual const ACEXML_Char *getSystemId (void);
+
+ /*
+ * Set the ACEXML_Char stream for this input source.
+ * Notice that ACEXML_InputSource assumes the ownership
+ * of <stream>
+ */
+ virtual void setCharStream (ACEXML_CharStream *charStream);
+
+ /*
+ * Set the character encoding, if known.
+ */
+ virtual void setEncoding (const ACEXML_Char *encoding);
+
+ /*
+ * Set the public identifier for this input source.
+ */
+ virtual void setPublicId (const ACEXML_Char *publicId);
+
+ /*
+ * Set the public identifier for this input source.
+ */
+ virtual void setSystemId (const ACEXML_Char *systemId);
+
+private:
+ ACEXML_Char *publicId_;
+ ACEXML_Char *systemId_;
+ ACEXML_CharStream *charStream_;
+ ACEXML_Char *encoding_;
+};
+
+#endif /* _ACEXML_INPUTSOURCE_H_ */
diff --git a/ACEXML/common/Locator.h b/ACEXML/common/Locator.h
new file mode 100644
index 00000000000..31e55c4563e
--- /dev/null
+++ b/ACEXML/common/Locator.h
@@ -0,0 +1,32 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_LOCATOR_H_
+#define _ACEXML_LOCATOR_H_
+
+#include "Common/XML_Types.h"
+
+class ACEXML_Export ACEXML_Locator
+{
+public:
+ /*
+ * Return the column number where the current document event ends.
+ */
+ virtual int getColumnNumber (void) const = 0;
+
+ /*
+ * Return the line number where the current document event ends.
+ */
+ virtual int getLineNumber (void) const = 0;
+
+ /*
+ * Return the public identifier for the current document event.
+ */
+ virtual const ACEXML_Char *getPublicId (void) const = 0;
+
+ /*
+ * Return the system identifier for the current document event.
+ */
+ virtual const ACEXML_Char *getSystemId (void) const = 0;
+};
+
+#endif /* _ACEXML_LOCATOR_H_ */
diff --git a/ACEXML/common/LocatorImpl.cpp b/ACEXML/common/LocatorImpl.cpp
new file mode 100644
index 00000000000..ba5c1944458
--- /dev/null
+++ b/ACEXML/common/LocatorImpl.cpp
@@ -0,0 +1,53 @@
+// -*- C++ -*- $Id$
+
+#include "Common/LocatorImpl.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/LocatorImpl.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_LocatorImpl::ACEXML_LocatorImpl (void)
+ : publicId_ (0),
+ systemId_ (0),
+ lineNumber_ (0),
+ columnNumber_ (0)
+{
+}
+
+ACEXML_LocatorImpl::ACEXML_LocatorImpl (const ACEXML_Locator *locator)
+ : publicId_ (ACE::strnew (locator->getPublicId ())),
+ systemId_ (ACE::strnew (locator->getSystemId ())),
+ lineNumber_ (locator->getLineNumber ()),
+ columnNumber_ (locator->getColumnNumber ())
+{
+}
+
+ACEXML_LocatorImpl::~ACEXML_LocatorImpl (void)
+{
+ delete this->publicId_;
+ delete this->systemId_;
+}
+
+int
+ACEXML_LocatorImpl::getColumnNumber (void) const
+{
+ return this->columnNumber_;
+}
+
+int
+ACEXML_LocatorImpl::getLineNumber (void) const
+{
+ return this->lineNumber_;
+}
+
+const ACEXML_Char *
+ACEXML_LocatorImpl::getPublicId (void) const
+{
+ return this->publicId_;
+}
+
+const ACEXML_Char *
+ACEXML_LocatorImpl::getSystemId (void) const
+{
+ return this->systemId_;
+}
diff --git a/ACEXML/common/LocatorImpl.h b/ACEXML/common/LocatorImpl.h
new file mode 100644
index 00000000000..302333757c3
--- /dev/null
+++ b/ACEXML/common/LocatorImpl.h
@@ -0,0 +1,79 @@
+// -*- C++ -*- $Id$
+
+#ifndef ACEXML_LOCALTORIMPL_H
+#define ACEXML_LOCALTORIMPL_H
+
+#include "Common/Locator.h"
+
+class ACEXML_Export ACEXML_LocatorImpl : public ACEXML_Locator
+{
+public:
+ /*
+ * Default constructor.
+ */
+ ACEXML_LocatorImpl (void);
+
+ /*
+ * Copy constructor. Create a persistent copy of the current state
+ * of a locator. When the original locator changes, this copy will
+ * still keep the original values (and it can be used outside the
+ * scope of DocumentHandler methods).
+ */
+ ACEXML_LocatorImpl (const ACEXML_Locator *locator);
+
+ /*
+ * Destructor.
+ */
+ virtual ~ACEXML_LocatorImpl (void);
+
+ /*
+ * Return the column number where the current document event ends.
+ */
+ virtual int getColumnNumber (void) const;
+
+ /*
+ * Return the line number where the current document event ends.
+ */
+ virtual int getLineNumber (void) const;
+
+ /*
+ * Return the public identifier for the current document event.
+ */
+ virtual const ACEXML_Char *getPublicId (void) const;
+
+ /*
+ * Return the system identifier for the current document event.
+ */
+ virtual const ACEXML_Char *getSystemId (void) const;
+
+ /*
+ * Set the column number of this locator.
+ */
+ void setColumnNumber (int cn);
+
+ /*
+ * Set the line number of this locator.
+ */
+ void setLineNumber (int ln);
+
+ /*
+ * Set the public identifier of this locator.
+ */
+ void setPublicId (const ACEXML_Char *id);
+
+ /*
+ * Set the system identifier of this locator.
+ */
+ void setSystemId (const ACEXML_Char *id);
+
+private:
+ ACEXML_Char *publicId_;
+ ACEXML_Char *systemId_;
+ int lineNumber_;
+ int columnNumber_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/LocatorImpl.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_LOCALTORIMPL_H */
diff --git a/ACEXML/common/LocatorImpl.i b/ACEXML/common/LocatorImpl.i
new file mode 100644
index 00000000000..13871d0707d
--- /dev/null
+++ b/ACEXML/common/LocatorImpl.i
@@ -0,0 +1,29 @@
+// -*- C++ -*- $Id$
+
+#include "ace/ACE.h"
+
+ACEXML_INLINE void
+ACEXML_LocatorImpl::setColumnNumber (int cn)
+{
+ this->columnNumber_ = cn;
+}
+
+ACEXML_INLINE void
+ACEXML_LocatorImpl::setLineNumber (int ln)
+{
+ this->lineNumber_ = ln;
+}
+
+ACEXML_INLINE void
+ACEXML_LocatorImpl::setPublicId (const ACEXML_Char *id)
+{
+ delete this->publicId_;
+ this->publicId_ = ACE::strnew (id);
+}
+
+ACEXML_INLINE void
+ACEXML_LocatorImpl::setSystemId (const ACEXML_Char *id)
+{
+ delete this->systemId_;
+ this->systemId_ = ACE::strnew (id);
+}
diff --git a/ACEXML/common/Makefile b/ACEXML/common/Makefile
new file mode 100644
index 00000000000..2d2b08b9534
--- /dev/null
+++ b/ACEXML/common/Makefile
@@ -0,0 +1,50 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Makefile for the server-side ACE network services
+#----------------------------------------------------------------------------
+
+LIB = libACEXML.a
+SHLIB = libACEXML.$(SOEXT)
+
+FILES = CharStream \
+ Env \
+ Exception \
+ FileCharStream \
+ Transcode \
+ InputSource \
+ SAXExceptions \
+ AttributesImpl \
+ DefaultHandler \
+ LocatorImpl \
+ NamespaceSupport \
+ XMLFilterImpl
+
+DEFS = $(addsuffix .h,$(FILES))
+LSRC = $(addsuffix .cpp,$(FILES))
+
+LIBS += $(ACELIB)
+CCFLAGS += -I..
+
+BUILD = $(VLIB) $(VSHLIB)
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
diff --git a/ACEXML/common/NamespaceSupport.cpp b/ACEXML/common/NamespaceSupport.cpp
new file mode 100644
index 00000000000..ba3221bc133
--- /dev/null
+++ b/ACEXML/common/NamespaceSupport.cpp
@@ -0,0 +1,276 @@
+// -*- C++ -*- $Id$
+
+#include "Common/NamespaceSupport.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/NamespaceSupport.i"
+#endif /* __ACEXML_INLINE__ */
+
+static const ACEXML_Char ACEXML_XMLNS_PREFIX_name[] = {'x', 'm', 'l', 'n', 's', 0};
+const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS_PREFIX = ACEXML_XMLNS_PREFIX_name;
+
+static const ACEXML_Char ACEXML_DEFAULT_NS_PREFIX[] = {0};
+
+static const ACEXML_Char ACEXML_NS_SEPARATOR[] = {':', 0};
+
+static const ACEXML_Char ACEXML_TABOO_NS_PREFIX[] = {'x', 'm', 'l', 0};
+
+static const ACEXML_Char ACEXML_XMLNS_URI_name[] = {
+ 'h', 't', 't', 'p', ':', '/', '/',
+ 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
+ 'X', 'M', 'L', '/', '1', '9', '9', '8', '/',
+ 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', 0};
+const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS = ACEXML_XMLNS_URI_name;
+
+
+
+
+ACEXML_Namespace_Context_Stack::ACEXML_Namespace_Context_Stack (void)
+ : head_ (0)
+{
+}
+
+ACEXML_Namespace_Context_Stack::~ACEXML_Namespace_Context_Stack (void)
+{
+ // Clean up stuff.
+}
+
+int
+ACEXML_Namespace_Context_Stack::push (ACEXML_NS_CONTEXT *nsc)
+{
+ struct NS_Node_T *temp = 0;
+ ACE_NEW_RETURN (temp, struct NS_Node_T, -1);
+
+ temp->item_ = nsc;
+ temp->next_ = this->head_;
+
+ this->head_ = temp;
+ return 0;
+}
+
+ACEXML_NS_CONTEXT *
+ACEXML_Namespace_Context_Stack::pop (void)
+{
+ if (this->head_ != 0)
+ {
+ struct NS_Node_T *temp = this->head_;
+ this->head_ = temp->next_;
+
+ ACEXML_NS_CONTEXT* retv = temp->item_;
+ delete temp;
+ return retv;
+ }
+ return 0;
+}
+
+
+ACEXML_NamespaceSupport::ACEXML_NamespaceSupport (void)
+ : ns_stack_ (),
+ effective_context_ (0)
+{
+ // @@ No way to tell if the new fails.
+ ACE_NEW (effective_context_,
+ ACEXML_NS_CONTEXT ());
+
+ ACEXML_String prefix (ACEXML_TABOO_NS_PREFIX, 0, 0);
+ ACEXML_String uri (ACEXML_XMLNS_URI_name, 0, 0);
+ this->effective_context_->bind (prefix, uri);
+}
+
+ACEXML_NamespaceSupport::~ACEXML_NamespaceSupport (void)
+{
+ while (this->popContext () == 0)
+ ;
+}
+
+int
+ACEXML_NamespaceSupport::declarePrefix (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri)
+{
+ // Unless predefined by w3.org(?) NS prefix can never start with
+ // "xml".
+ if (ACE_OS_String::strcmp (ACEXML_TABOO_NS_PREFIX, prefix) == 0)
+ return -1;
+
+ // @@ No way to check new failure.
+ ACEXML_String ns_prefix (prefix, 0, 0);
+ ACEXML_String ns_uri (uri, 0, 0);
+
+ return this->effective_context_->bind (ns_prefix,
+ ns_uri);
+}
+
+int
+ACEXML_NamespaceSupport::getDeclaredPrefixes (ACEXML_STR_LIST &prefixes) const
+{
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ // The prefix for default namespace (empty string) is included in
+ // the return list.
+ for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_);
+ iter.next (entry) != 0;
+ iter.advance ())
+ prefixes.enqueue_tail (entry->ext_id_.c_str ());
+
+ return 0;
+}
+
+const ACEXML_Char *
+ACEXML_NamespaceSupport::getPrefix (const ACEXML_Char *uri) const
+{
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_);
+ iter.next (entry) != 0;
+ iter.advance ())
+ if (entry->int_id_ == ACEXML_String (uri, 0, 0) &&
+ entry->ext_id_ != ACEXML_String (ACEXML_DEFAULT_NS_PREFIX, 0, 0))
+ return entry->ext_id_.c_str ();
+
+ return 0; // Nothing found.
+}
+
+int
+ACEXML_NamespaceSupport::getPrefixes (ACEXML_STR_LIST &prefixes) const
+{
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ // The prefix for default namespace (empty string) is not included
+ // in the return list.
+ for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_);
+ iter.next (entry) != 0;
+ iter.advance ())
+ if (entry->ext_id_ != ACEXML_String(ACEXML_DEFAULT_NS_PREFIX, 0, 0))
+ prefixes.enqueue_tail (entry->ext_id_.c_str ());
+ else
+ continue;
+
+ return 0;
+}
+
+int
+ACEXML_NamespaceSupport::getPrefixes (const ACEXML_Char *uri,
+ ACEXML_STR_LIST &prefixes) const
+{
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_);
+ iter.next (entry) != 0;
+ iter.advance ())
+ if (entry->int_id_ == ACEXML_String (uri, 0, 0) &&
+ entry->ext_id_ != ACEXML_String (ACEXML_DEFAULT_NS_PREFIX, 0, 0))
+ prefixes.enqueue_tail (entry->ext_id_.c_str ());
+ else
+ continue;
+
+ return 0; // Nothing found.
+}
+
+const ACEXML_Char *
+ACEXML_NamespaceSupport::getURI (const ACEXML_Char *prefix) const
+{
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ if (this->effective_context_->find (ACEXML_String (prefix, 0, 0),
+ entry) == 0)
+ return entry->int_id_.c_str ();
+ return 0;
+}
+
+int
+ACEXML_NamespaceSupport::popContext (void)
+{
+ delete this->effective_context_;
+
+ if ((this->effective_context_ = this->ns_stack_.pop ()) == 0)
+ return -1;
+ return 0;
+}
+
+int
+ACEXML_NamespaceSupport::pushContext (void)
+{
+ ACEXML_NS_CONTEXT *temp = this->effective_context_;
+ this->ns_stack_.push (temp);
+ ACE_NEW_RETURN (this->effective_context_,
+ ACEXML_NS_CONTEXT (),
+ -1);
+
+ // @@ Copy everything from the old context the the new one.
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ for (ACEXML_NS_CONTEXT_ITER iter (*temp);
+ iter.next (entry) != 0;
+ iter.advance ())
+ this->effective_context_->bind (entry->ext_id_,
+ entry->int_id_);
+
+ return 0;
+}
+
+
+int
+ACEXML_NamespaceSupport::processName (const ACEXML_Char *qName,
+ const ACEXML_Char *&uri,
+ const ACEXML_Char *&name,
+ int is_attribute) const
+{
+ int qlen = ACE_OS_String::strlen (qName);
+ int len = -1;
+ for (int i = 0; i < qlen; ++i)
+ if (qName [i] == ':')
+ {
+ len = i;
+ break;
+ }
+
+ ACEXML_String prefix;
+
+ if (len == -1)
+ {
+ name = qName;
+ }
+ else
+ {
+ prefix.set (qName, len, 1);
+ name = qName + len + 1;
+ }
+ ACEXML_NS_CONTEXT_ENTRY *entry;
+
+ if (this->effective_context_->find (prefix, entry) == 0)
+ uri = entry->int_id_.c_str ();
+ else
+ {
+ uri = ACEXML_DEFAULT_NS_PREFIX;
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+ACEXML_NamespaceSupport::reset (void)
+{
+ // Not implemented.
+ return 0;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Hash_Map_Entry<ACEXML_String, ACEXML_String>;
+template class ACE_Hash_Map_Manager_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>;
+template class ACE_Unbounded_Queue<const ACEXML_Char *>;
+template class ACE_Unbounded_Queue_Iterator<const ACEXML_Char *>;
+template class ACE_Node<const ACEXML_Char *>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Hash_Map_Entry<ACEXML_String, ACEXML_String>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String, ACEXML_String, ACE_Hash<ACEXML_String>, ACE_Equal_To<ACEXML_String>, ACE_Null_Mutex>
+#pragma instantiate ACE_Unbounded_Queue<const ACEXML_Char *>
+#pragma instantiate ACE_Unbounded_Queue_Iterator<const ACEXML_Char *>
+#pragma instantiate ACE_Node<const ACEXML_Char *>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/ACEXML/common/NamespaceSupport.h b/ACEXML/common/NamespaceSupport.h
new file mode 100644
index 00000000000..df8c659aaa8
--- /dev/null
+++ b/ACEXML/common/NamespaceSupport.h
@@ -0,0 +1,158 @@
+// -*- C++ -*- $Id$
+
+#ifndef ACEXML_NAMESPACESUPPORT_H
+#define ACEXML_NAMESPACESUPPORT_H
+
+#include "Common/XML_Types.h"
+#include "ace/Functor.h"
+#include "ace/Hash_Map_Manager.h"
+#include "ace/Containers_T.h"
+
+typedef ACE_Hash_Map_Entry<ACEXML_String,
+ ACEXML_String> ACEXML_NS_CONTEXT_ENTRY;
+
+typedef ACE_Hash_Map_Manager_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_NS_CONTEXT;
+
+typedef ACE_Hash_Map_Iterator_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_NS_CONTEXT_ITER;
+
+typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_NS_CONTEXT_REVERSE_ITER;
+
+typedef ACE_Unbounded_Queue<const ACEXML_Char *> ACEXML_STR_LIST;
+
+class ACEXML_Export ACEXML_Namespace_Context_Stack
+{
+public:
+ ACEXML_Namespace_Context_Stack (void);
+ ~ACEXML_Namespace_Context_Stack (void);
+
+ int push (ACEXML_NS_CONTEXT * old);
+ ACEXML_NS_CONTEXT *pop (void);
+
+private:
+ struct NS_Node_T {
+ ACEXML_NS_CONTEXT *item_;
+ struct NS_Node_T *next_;
+ };
+
+ NS_Node_T *head_;
+};
+
+class ACEXML_Export ACEXML_NamespaceSupport
+{
+public:
+ /**
+ * Default constructor.
+ */
+ ACEXML_NamespaceSupport (void);
+
+ /**
+ * Default destructor.
+ */
+ ~ACEXML_NamespaceSupport (void);
+
+ /**
+ * XMLNS default prefix and URI strings.
+ */
+ static const ACEXML_Char *XMLNS_PREFIX;
+ static const ACEXML_Char *XMLNS;
+
+ /**
+ * Declare a Namespace prefix. Return -1 if the prefix was illegal
+ * or an internal error occured. Return 0 if the prefix gets declared
+ * successfully, 1 if the prefix replaces an existing prefix definition.
+ */
+ int declarePrefix (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri);
+
+ /**
+ * Return all prefixes declared in current context in
+ * the user-supplied list @a prefixes. It is user's reponsibility
+ * to ensure the list was empty originally.
+ */
+ int getDeclaredPrefixes (ACEXML_STR_LIST &prefixes) const;
+
+ /**
+ * Return one of the prefixes mapped to a Namespace URI.
+ */
+ const ACEXML_Char *getPrefix (const ACEXML_Char *uri) const;
+
+ /**
+ * Return all prefixes currently declared in the user-supplied list.
+ * @@ Known bug: This function should only return user-defined prefixes.
+ */
+ int getPrefixes (ACEXML_STR_LIST &prefixes) const;
+
+ /**
+ * Return all prefixes currently declared for a URI in the
+ * user-supplied list.
+ */
+ int getPrefixes (const ACEXML_Char *uri,
+ ACEXML_STR_LIST &prefixes) const;
+
+ /**
+ * Look up a prefix and get the currently-mapped Namespace URI.
+ */
+ const ACEXML_Char *getURI (const ACEXML_Char *prefix) const;
+
+ /**
+ * Revert to the previous namespace context.
+ */
+ int popContext (void);
+
+ /**
+ * Process a raw XML 1.0 name.
+ * @a qName is the raw XML name we want to parse,
+ * @a uri contains the URI string of the raw name. It points to a null
+ * string if the namespace is not valid or there's no namespace defined.
+ * @a name contains the original name without the prefix.
+ * @a is_attribute specifies whether the name is an attribute or not.
+ * Attributes have different scoping rules from elements.
+ */
+ int processName (const ACEXML_Char *qName,
+ const ACEXML_Char *&uri,
+ const ACEXML_Char *&name,
+ int is_attribute) const;
+
+ /**
+ * Start a new Namespace context. Prefixes defined in previous
+ * context are copied over to the new context.
+ */
+ int pushContext (void);
+
+ /**
+ * Reset this Namespace support object for reuse.
+ * @todo Not implemented.
+ */
+ int reset (void);
+
+private:
+ /**
+ * Namespace Context stack. When we entering a new namespace
+ * context, the old context is duplicated and pushed into
+ * this stack.
+ */
+ ACEXML_Namespace_Context_Stack ns_stack_;
+
+ /**
+ * The effective namespace context.
+ */
+ ACEXML_NS_CONTEXT *effective_context_;
+};
+
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/NamespaceSupport.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_NAMESPACESUPPORT_H */
diff --git a/ACEXML/common/NamespaceSupport.i b/ACEXML/common/NamespaceSupport.i
new file mode 100644
index 00000000000..e565785c59b
--- /dev/null
+++ b/ACEXML/common/NamespaceSupport.i
@@ -0,0 +1,16 @@
+// -*- C++ -*- $Id$
+
+ACE_TEMPLATE_METHOD_SPECIALIZATION
+ACEXML_INLINE int
+ACE_Equal_To<ACEXML_String>::operator () (const ACEXML_String &lhs,
+ const ACEXML_String &rhs) const
+{
+ return lhs == rhs;
+}
+
+ACE_TEMPLATE_METHOD_SPECIALIZATION
+ACE_INLINE u_long
+ACE_Hash<ACEXML_String>::operator () (const ACEXML_String &t) const
+{
+ return ACE::hash_pjw (t.c_str ());
+}
diff --git a/ACEXML/common/SAXExceptions.cpp b/ACEXML/common/SAXExceptions.cpp
new file mode 100644
index 00000000000..7505ee778eb
--- /dev/null
+++ b/ACEXML/common/SAXExceptions.cpp
@@ -0,0 +1,269 @@
+// -*- C++ -*- $Id$
+
+#include "Common/SAXExceptions.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/SAXExceptions.i"
+#endif /* __ACEXML_INLINE__ */
+
+static const ACEXML_Char ACEXML_SAXException_name[] = {
+ 'A', 'C', 'E', 'X', 'M', 'L',
+ 'S', 'A', 'X',
+ '_', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0};
+const ACEXML_Char *ACEXML_SAXException::exception_name_ = ACEXML_SAXException_name;
+
+ACEXML_SAXException::ACEXML_SAXException (void)
+ : message_ (0)
+{
+}
+
+ACEXML_SAXException::ACEXML_SAXException (const ACEXML_Char *msg)
+ : message_ (ACE::strnew (msg))
+{
+}
+
+ACEXML_SAXException::ACEXML_SAXException (const ACEXML_SAXException &ex)
+ : ACEXML_Exception (ex),
+ message_ (ACE::strnew (ex.message_))
+
+{
+}
+
+
+ACEXML_SAXException::~ACEXML_SAXException (void)
+{
+ delete this->message_;
+}
+
+const ACEXML_Char *
+ACEXML_SAXException::id (void)
+{
+ return ACEXML_SAXException::exception_name_;
+}
+
+ACEXML_Exception *
+ACEXML_SAXException::duplicate (void)
+{
+ ACEXML_Exception *tmp;
+ ACE_NEW_RETURN (tmp,
+ ACEXML_SAXException (*this),
+ // Replace ACEXML_Exception with appropriate type.
+ 0);
+ return tmp;
+}
+
+int
+ACEXML_SAXException::is_a (const ACEXML_Char *name)
+{
+ if (name == ACEXML_SAXException::exception_name_
+ || ACE_OS::strcmp (ACEXML_Exception::exception_name_,
+ name) == 0)
+ return 1;
+ else
+ return this->ACEXML_Exception::is_a (name);
+
+ ACE_NOTREACHED (return 0;)
+}
+
+void
+ACEXML_SAXException::print (void)
+{
+ // @@ Nanbor, I don't know how to handle the case
+ // when we define ACEXML_UTF16 as ACEXML_Char
+ ACE_DEBUG ((LM_DEBUG,
+ "Exception: ACEXML_SAXException -- %s\n",
+ this->message_));
+}
+
+static const ACEXML_Char ACEXML_SAXNotSupportedException_name[] = {
+ 'A', 'C', 'E', 'X', 'M', 'L',
+ 'S', 'A', 'X',
+ 'N', 'o', 't',
+ 'S', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd',
+ '_', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0};
+const ACEXML_Char *ACEXML_SAXNotSupportedException::exception_name_ = ACEXML_SAXNotSupportedException_name;
+
+ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (void)
+{
+}
+
+ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex)
+ : ACEXML_SAXException (ex)
+{
+}
+
+
+ACEXML_SAXNotSupportedException::~ACEXML_SAXNotSupportedException (void)
+{
+ delete this->message_;
+}
+
+const ACEXML_Char *
+ACEXML_SAXNotSupportedException::id (void)
+{
+ return ACEXML_SAXNotSupportedException::exception_name_;
+}
+
+ACEXML_Exception *
+ACEXML_SAXNotSupportedException::duplicate (void)
+{
+ ACEXML_Exception *tmp;
+ ACE_NEW_RETURN (tmp,
+ ACEXML_SAXNotSupportedException (*this),
+ // Replace ACEXML_Exception with appropriate type.
+ 0);
+ return tmp;
+}
+
+int
+ACEXML_SAXNotSupportedException::is_a (const ACEXML_Char *name)
+{
+ if (name == ACEXML_SAXNotSupportedException::exception_name_
+ || ACE_OS::strcmp (ACEXML_Exception::exception_name_,
+ name) == 0)
+ return 1;
+ else
+ return this->ACEXML_SAXException::is_a (name);
+
+ ACE_NOTREACHED (return 0;)
+}
+
+void
+ACEXML_SAXNotSupportedException::print (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "Exception: ACEXML_SAXNotSupportedException -- %s\n",
+ this->message_));
+}
+
+static const ACEXML_Char ACEXML_SAXNotRecognizedException_name[] = {
+ 'A', 'C', 'E', 'X', 'M', 'L',
+ 'S', 'A', 'X',
+ 'N', 'o', 't',
+ 'R', 'e', 'c', 'o', 'g', 'n', 'i', 'z', 'e', 'd',
+ '_', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0};
+const ACEXML_Char *ACEXML_SAXNotRecognizedException::exception_name_ = ACEXML_SAXNotRecognizedException_name;
+
+ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (void)
+{
+}
+
+ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML_Char *msg)
+ : ACEXML_SAXException (msg)
+{
+}
+
+ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex)
+ : ACEXML_SAXException (ex)
+{
+}
+
+
+ACEXML_SAXNotRecognizedException::~ACEXML_SAXNotRecognizedException (void)
+{
+ delete this->message_;
+}
+
+const ACEXML_Char *
+ACEXML_SAXNotRecognizedException::id (void)
+{
+ return ACEXML_SAXNotRecognizedException::exception_name_;
+}
+
+ACEXML_Exception *
+ACEXML_SAXNotRecognizedException::duplicate (void)
+{
+ ACEXML_Exception *tmp;
+ ACE_NEW_RETURN (tmp,
+ ACEXML_SAXNotRecognizedException (*this),
+ // Replace ACEXML_Exception with appropriate type.
+ 0);
+ return tmp;
+}
+
+int
+ACEXML_SAXNotRecognizedException::is_a (const ACEXML_Char *name)
+{
+ if (name == ACEXML_SAXNotRecognizedException::exception_name_
+ || ACE_OS::strcmp (ACEXML_Exception::exception_name_,
+ name) == 0)
+ return 1;
+ else
+ return this->ACEXML_SAXException::is_a (name);
+
+ ACE_NOTREACHED (return 0;)
+}
+
+void
+ACEXML_SAXNotRecognizedException::print (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "Exception: ACEXML_SAXNotRecognizedException -- %s\n",
+ this->message_));
+}
+
+static const ACEXML_Char ACEXML_SAXParseException_name[] = {
+ 'A', 'C', 'E', 'X', 'M', 'L',
+ 'S', 'A', 'X',
+ 'P', 'a', 'r', 's', 'e',
+ '_', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0};
+const ACEXML_Char *ACEXML_SAXParseException::exception_name_ = ACEXML_SAXParseException_name;
+
+ACEXML_SAXParseException::ACEXML_SAXParseException (void)
+{
+}
+
+ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_Char *msg)
+ : ACEXML_SAXException (msg)
+{
+}
+
+ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_SAXParseException &ex)
+ : ACEXML_SAXException (ex)
+{
+}
+
+
+ACEXML_SAXParseException::~ACEXML_SAXParseException (void)
+{
+}
+
+const ACEXML_Char *
+ACEXML_SAXParseException::id (void)
+{
+ return ACEXML_SAXParseException::exception_name_;
+}
+
+ACEXML_Exception *
+ACEXML_SAXParseException::duplicate (void)
+{
+ ACEXML_Exception *tmp;
+ ACE_NEW_RETURN (tmp,
+ ACEXML_SAXParseException (*this),
+ // Replace ACEXML_Exception with appropriate type.
+ 0);
+ return tmp;
+}
+
+int
+ACEXML_SAXParseException::is_a (const ACEXML_Char *name)
+{
+ if (name == ACEXML_SAXParseException::exception_name_
+ || ACE_OS::strcmp (ACEXML_Exception::exception_name_,
+ name) == 0)
+ return 1;
+ else
+ return this->ACEXML_SAXException::is_a (name);
+
+ ACE_NOTREACHED (return 0;)
+}
+
+void
+ACEXML_SAXParseException::print (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "Exception: ACEXML_SAXParseException -- %s\n",
+ this->message_));
+}
diff --git a/ACEXML/common/SAXExceptions.h b/ACEXML/common/SAXExceptions.h
new file mode 100644
index 00000000000..b2535ab6994
--- /dev/null
+++ b/ACEXML/common/SAXExceptions.h
@@ -0,0 +1,134 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_SAXEXCEPTIONS_H_
+#define _ACEXML_SAXEXCEPTIONS_H_
+
+#include "Common/Exception.h"
+
+class ACEXML_Export ACEXML_SAXException : public ACEXML_Exception
+{
+public:
+ ACEXML_SAXException (void);
+ ACEXML_SAXException (const ACEXML_Char *msg);
+ ACEXML_SAXException (const ACEXML_SAXException &ex);
+
+ 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.)
+
+ 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_;
+
+ ACEXML_Char *message_;
+};
+
+class ACEXML_Export ACEXML_SAXNotSupportedException
+ : public ACEXML_SAXException
+{
+public:
+ ACEXML_SAXNotSupportedException (void);
+ ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex);
+
+ 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_Export ACEXML_SAXNotRecognizedException
+ : public ACEXML_SAXException
+{
+public:
+ ACEXML_SAXNotRecognizedException (void);
+ ACEXML_SAXNotRecognizedException (const ACEXML_Char *msg);
+ ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex);
+
+ 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_Export ACEXML_SAXParseException
+ : public ACEXML_SAXException
+{
+public:
+ ACEXML_SAXParseException (void);
+ ACEXML_SAXParseException (const ACEXML_Char *msg);
+ ACEXML_SAXParseException (const ACEXML_SAXParseException &ex);
+
+ 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_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/SAXExceptions.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* _ACEXML_SAXEXCEPTIONS_H_ */
diff --git a/ACEXML/common/SAXExceptions.i b/ACEXML/common/SAXExceptions.i
new file mode 100644
index 00000000000..fc1514c2f12
--- /dev/null
+++ b/ACEXML/common/SAXExceptions.i
@@ -0,0 +1,33 @@
+// -*- C++ -*- $Id$
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_SAXException::message (void)
+{
+ return (this->message_ == 0 ?
+ ACEXML_Exception::null_ :
+ this->message_);
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_SAXException::name (void)
+{
+ return ACEXML_SAXException::exception_name_;
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_SAXNotSupportedException::name (void)
+{
+ return ACEXML_SAXNotSupportedException::exception_name_;
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_SAXNotRecognizedException::name (void)
+{
+ return ACEXML_SAXNotRecognizedException::exception_name_;
+}
+
+ACEXML_INLINE const ACEXML_Char *
+ACEXML_SAXParseException::name (void)
+{
+ return ACEXML_SAXParseException::exception_name_;
+}
diff --git a/ACEXML/common/Transcode.cpp b/ACEXML/common/Transcode.cpp
new file mode 100644
index 00000000000..1a957634d24
--- /dev/null
+++ b/ACEXML/common/Transcode.cpp
@@ -0,0 +1,83 @@
+// -*- C++ -*- $Id$
+
+#include "Common/Transcode.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/Transcode.i"
+#endif /* __ACEXML_INLINE__ */
+
+int
+ACEXML_Transcoder::utf8s2utf16s (const ACEXML_UTF8 *src,
+ ACEXML_UTF16 *dst,
+ size_t len)
+{
+ if (src == 0 || dst == 0)
+ return INVALID_ARGS;
+
+ size_t src_len = ACE_OS::strlen (src) + 1;
+
+ size_t total_len = 0;
+ int forward;
+ ACEXML_UCS4 temp;
+
+ while (src_len > 0)
+ {
+ if ((forward = ACEXML_Transcoder::utf82ucs4 (src,
+ src_len,
+ temp)) <= 0)
+ return forward;
+
+ src += forward;
+ src_len -= forward;
+
+ if ((forward = ACEXML_Transcoder::ucs42utf16 (temp,
+ dst,
+ len)) <= 0)
+ return forward;
+
+ total_len += forward;
+ dst += forward;
+ len -= forward;
+ }
+
+ return total_len;
+}
+
+int
+ACEXML_Transcoder::utf16s2utf8s (const ACEXML_UTF16 *src,
+ ACEXML_UTF8 *dst,
+ size_t len)
+{
+ if (src == 0 || dst == 0)
+ return INVALID_ARGS;
+
+ size_t src_len = 1;
+ for (const ACEXML_UTF16 *p = src; *p++ != 0; ++src_len)
+ ;
+
+ size_t total_len = 0;
+ int forward;
+ ACEXML_UCS4 temp;
+
+ while (src_len > 0)
+ {
+ if ((forward = ACEXML_Transcoder::utf162ucs4 (src,
+ src_len,
+ temp)) <= 0)
+ return forward;
+
+ src += forward;
+ src_len -= forward;
+
+ if ((forward = ACEXML_Transcoder::ucs42utf8 (temp,
+ dst,
+ len)) <= 0)
+ return forward;
+
+ total_len += forward;
+ dst += forward;
+ len -= forward;
+ }
+
+ return total_len;
+}
diff --git a/ACEXML/common/Transcode.h b/ACEXML/common/Transcode.h
new file mode 100644
index 00000000000..8547921aca3
--- /dev/null
+++ b/ACEXML/common/Transcode.h
@@ -0,0 +1,74 @@
+// -*- C++ -*- $Id$
+// This file declares functions to convert char string among different
+// unicode encoding (utf8, utf16, utf32)
+
+#ifndef _ACEXML_TRANSCODE_H_
+#define _ACEXML_TRANSCODE_H_
+#include "Common/XML_Types.h"
+
+class ACEXML_Export ACEXML_Transcoder
+{
+public:
+ enum
+ {
+ SUCCESS = 0,
+ DESTINATION_TOO_SHORT = -1,
+ END_OF_SOURCE = -2,
+ INVALID_ARGS = -3,
+ IS_SURROGATE = -4,
+ NON_UNICODE = -5
+ };
+
+
+ // The following functions translate a unicode characters
+ // into different encoding. Return number of characters put into
+ // destination or consumed from src if success without
+ // error, otherwise, return corresponding error code.
+ static int utf162utf8 (ACEXML_UTF16 src,
+ ACEXML_UTF8 *dst,
+ size_t len);
+
+ static int ucs42utf8 (ACEXML_UCS4 src,
+ ACEXML_UTF8 *dst,
+ size_t len);
+
+ static int ucs42utf16 (ACEXML_UCS4 src,
+ ACEXML_UTF16 *dst,
+ size_t len);
+
+ static int surrogate2utf8 (ACEXML_UTF16 high,
+ ACEXML_UTF16 low,
+ ACEXML_UTF8 *dst,
+ size_t len);
+
+ static int surrogate2ucs4 (ACEXML_UTF16 high,
+ ACEXML_UTF16 low,
+ ACEXML_UCS4 &dst);
+
+ static int utf82ucs4 (const ACEXML_UTF8 *src,
+ size_t len,
+ ACEXML_UCS4 &dst);
+
+ static int utf162ucs4 (const ACEXML_UTF16 *src,
+ size_t len,
+ ACEXML_UCS4 &dst);
+
+// static int utf82utf16 (const ACEXML_UTF8 *src,
+// size_t len,
+// ACEXML_UTF16 &dst);
+ // This function does not handle surrogates.
+
+ // The following functions are non-inlined:
+ static int utf8s2utf16s (const ACEXML_UTF8 *src,
+ ACEXML_UTF16 *dst,
+ size_t len);
+
+ static int utf16s2utf8s (const ACEXML_UTF16 *src,
+ ACEXML_UTF8 *dst,
+ size_t len);
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/Transcode.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* _ACEXML_TRANSCODE_H_ */
diff --git a/ACEXML/common/Transcode.i b/ACEXML/common/Transcode.i
new file mode 100644
index 00000000000..e9ec3936e80
--- /dev/null
+++ b/ACEXML/common/Transcode.i
@@ -0,0 +1,234 @@
+// -*- C++ -*- $Id$
+
+ACEXML_INLINE int
+ACEXML_Transcoder::utf162utf8 (ACEXML_UTF16 src,
+ ACEXML_UTF8 *dst,
+ size_t len)
+{
+ // Check for valid argument first...
+
+ if (dst == 0)
+ return INVALID_ARGS;
+
+ if (src < 0x80)
+ {
+ if (len < 1)
+ return DESTINATION_TOO_SHORT;
+
+ *dst = ACE_static_cast (ACEXML_UTF8, src);
+ return 1;
+ }
+ else if (src < 0x800)
+ {
+ if (len < 2)
+ return DESTINATION_TOO_SHORT;
+
+ *dst = 0xc0 | (src / 0x40);
+ *(dst+1) = 0x80 | (src % 0x40);
+ return 2;
+ }
+ else
+ {
+ if (len < 3)
+ return DESTINATION_TOO_SHORT;
+
+ // Surrogates (0xD800 - 0xDFFF) are not valid unicode values
+ if (src >= 0xD800 && src < 0xE000)
+ return IS_SURROGATE;
+
+ *dst = 0xe0 | (src / 0x1000);
+ *(dst+1) = 0x80 | ((src % 0x1000) / 0x40);
+ *(dst+2) = 0x80 | (src % 0x40);
+ return 3;
+ }
+ ACE_NOTREACHED (return NON_UNICODE;)
+}
+
+ACEXML_INLINE int
+ACEXML_Transcoder::ucs42utf8 (ACEXML_UCS4 src,
+ ACEXML_UTF8 *dst,
+ size_t len)
+{
+ if (src < 0x10000)
+ {
+ int retv = ACEXML_Transcoder::utf162utf8
+ (ACE_static_cast (ACEXML_UTF16, src),
+ dst, len);
+ return (retv == IS_SURROGATE ? NON_UNICODE : retv);
+ }
+ else if (src >= 0x100000 && src < 0x110000)
+ {
+ if (len < 4)
+ return DESTINATION_TOO_SHORT;
+
+ if (dst == 0)
+ return INVALID_ARGS;
+
+ *dst = 0xf0 | (src / 0x40000);
+ *(dst+1) = 0x80 | ((src % 0x40000) / 0x1000);
+ *(dst+2) = 0x80 | ((src % 0x1000) / 0x40);
+ *(dst+3) = 0x80 | (src % 0x40);
+ return 4;
+ }
+ return NON_UNICODE;
+}
+
+
+ACEXML_INLINE int
+ACEXML_Transcoder::ucs42utf16 (ACEXML_UCS4 src,
+ ACEXML_UTF16 *dst,
+ size_t len)
+{
+ if (dst == 0)
+ return INVALID_ARGS;
+
+ if (src < 0x10000)
+ {
+ if (len < 1)
+ return DESTINATION_TOO_SHORT;
+
+ if (src >= 0xD800 && src < 0xE000)
+ return NON_UNICODE; // Surrogates are not valid unicode value
+
+ *dst = ACE_static_cast (ACEXML_UTF16, src);
+ return 1;
+ }
+ else if (src >= 0x100000 && src < 0x110000)
+ // Scalar values are encoded into surrogates
+ {
+ if (len < 2)
+ return DESTINATION_TOO_SHORT;
+
+ *dst = 0xD800 | (src / 0x400);
+ *(dst+1) = 0xDC00 | (src % 0x400);
+ return 2;
+ }
+
+ return NON_UNICODE;
+}
+
+ACEXML_INLINE int
+ACEXML_Transcoder::surrogate2utf8 (ACEXML_UTF16 high,
+ ACEXML_UTF16 low,
+ ACEXML_UTF8 *dst,
+ size_t len)
+{
+ if (len < 3)
+ return DESTINATION_TOO_SHORT;
+
+ if (dst == 0 ||
+ (high >= 0xD800 && high < 0xDC00) ||
+ (low >= 0xDC00 && low < 0xE000))
+ return INVALID_ARGS;
+
+ ACEXML_UCS4 src = (high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000;
+ *dst = 0xD800 | (src / 0x400);
+ *(dst+1) = 0xDC00 | (src % 0x400);
+ return 2;
+}
+
+ACEXML_INLINE int
+ACEXML_Transcoder::surrogate2ucs4 (ACEXML_UTF16 high,
+ ACEXML_UTF16 low,
+ ACEXML_UCS4 &dst)
+{
+ if ((high >= 0xD800 && high < 0xDC00) ||
+ (low >= 0xDC00 && low < 0xE000))
+ return INVALID_ARGS;
+
+ dst = (high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000;
+ return SUCCESS;
+}
+
+ACEXML_INLINE int
+ACEXML_Transcoder::utf82ucs4 (const ACEXML_UTF8 *the_src,
+ size_t len,
+ ACEXML_UCS4 &dst)
+{
+ if (the_src == 0)
+ return INVALID_ARGS;
+
+ const unsigned char *src = ACE_reinterpret_cast (const unsigned char *,
+ the_src);
+
+ size_t forward = 1;
+
+ if (forward > len)
+ return END_OF_SOURCE;
+
+ if (ACE_static_cast (unsigned char, *src) < 0x80)
+ dst = *src;
+ else if ((*src & 0xE0) == 0xC0)
+ {
+ dst = (*(src++) & 0x1f) * 0x40;
+ if (++forward > len)
+ return END_OF_SOURCE;
+ if ((*src & 0xC0) != 0x80)
+ return NON_UNICODE; // Error transcoding unicode scalar
+ dst += *src & 0x3f;
+ }
+ else if ((*src & 0xF0) == 0xE0)
+ {
+ dst = (*src++ & 0x0f) * 0x40;
+ if (++forward > len)
+ return END_OF_SOURCE;
+ if ((*src & 0xC0) != 0x80)
+ return NON_UNICODE;
+ dst = (dst + (*src++ & 0x3f)) * 0x40;
+ if (++forward > len)
+ return END_OF_SOURCE;
+ if ((*src & 0xC0) != 0x80)
+ return NON_UNICODE;
+ dst += *src & 0x3f;
+ }
+ else if ((*src & 0xF8) == 0xF0)
+ {
+ dst = (*src++ & 0x0f) * 0x40;
+ if (++forward > len)
+ return END_OF_SOURCE;
+ if ((*src & 0xC0) != 0x80)
+ return NON_UNICODE;
+ dst = (dst + (*src++ & 0x3f)) * 0x40;
+ if (++forward > len)
+ return END_OF_SOURCE;
+ if ((*src & 0xC0) != 0x80)
+ return NON_UNICODE;
+ dst = (dst + (*src++ & 0x3f)) * 0x40;
+ if (++forward > len)
+ return END_OF_SOURCE;
+ if ((*src & 0xC0) != 0x80)
+ return NON_UNICODE;
+ dst += *src & 0x3f;
+ }
+ else
+ return NON_UNICODE;
+
+ return forward;
+}
+
+ACEXML_INLINE int
+ACEXML_Transcoder::utf162ucs4 (const ACEXML_UTF16 *src,
+ size_t len,
+ ACEXML_UCS4 &dst)
+{
+ if (src == 0)
+ return INVALID_ARGS;
+
+ size_t forward = 1;
+ if (*src >= 0xDC00 && *src < 0xE000)
+ {
+ if (len < 2)
+ return END_OF_SOURCE;
+ return ACEXML_Transcoder::surrogate2ucs4 (*src,
+ *(src+1),
+ dst);
+ }
+ else
+ {
+ if (len < 1)
+ return END_OF_SOURCE;
+ dst = *src;
+ }
+
+ return forward;
+}
diff --git a/ACEXML/common/XMLFilter.h b/ACEXML/common/XMLFilter.h
new file mode 100644
index 00000000000..5b600505b5a
--- /dev/null
+++ b/ACEXML/common/XMLFilter.h
@@ -0,0 +1,22 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_XMLFILTER_H_
+#define _ACEXML_XMLFILTER_H_
+
+#include "Common/XMLReader.h"
+
+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;
+};
+
+#endif /* _ACEXML_XMLFILTER_H_ */
diff --git a/ACEXML/common/XMLFilterImpl.cpp b/ACEXML/common/XMLFilterImpl.cpp
new file mode 100644
index 00000000000..436843a0ea6
--- /dev/null
+++ b/ACEXML/common/XMLFilterImpl.cpp
@@ -0,0 +1,380 @@
+// -*- C++ -*- $Id$
+
+#include "Common/XMLFilterImpl.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Common/XMLFilterImpl.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_XMLFilterImpl::ACEXML_XMLFilterImpl (void)
+ : parent_ (0),
+ locator_ (0),
+ entityResolver_ (0),
+ dtdHandler_ (0),
+ contentHandler_ (0),
+ errorHandler_ (0)
+{
+}
+
+ACEXML_XMLFilterImpl::ACEXML_XMLFilterImpl (ACEXML_XMLReader *parent)
+ : parent_ (parent),
+ locator_ (0),
+ entityResolver_ (0),
+ dtdHandler_ (0),
+ contentHandler_ (0),
+ errorHandler_ (0)
+{
+}
+
+ACEXML_XMLFilterImpl::~ACEXML_XMLFilterImpl (void)
+{
+ // @@ How are all the object lifecycles managed?
+}
+
+void
+ACEXML_XMLFilterImpl::parse (ACEXML_InputSource *input,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->setupParser () < 0)
+ {
+ xmlenv.exception (new ACEXML_SAXException ("No Parent available"));
+ return;
+ }
+ this->parent_->parse (input, xmlenv);
+ return;
+}
+
+void
+ACEXML_XMLFilterImpl::parse (const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->setupParser () < 0)
+ {
+ xmlenv.exception (new ACEXML_SAXException ("No Parent available"));
+ return;
+ }
+
+ this->parent_->parse (new ACEXML_InputSource (systemId),
+ xmlenv);
+ return;
+}
+
+int
+ACEXML_XMLFilterImpl::getFeature (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ if (this->parent_ != 0)
+ return this->parent_->getFeature (name,
+ xmlenv);
+
+ xmlenv.exception (new ACEXML_SAXNotRecognizedException (name));
+ return 0;
+}
+
+void *
+ACEXML_XMLFilterImpl::getProperty (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ if (this->parent_ != 0)
+ return this->parent_->getProperty (name,
+ xmlenv);
+
+ xmlenv.exception (new ACEXML_SAXNotRecognizedException (name));
+ return 0;
+}
+
+void
+ACEXML_XMLFilterImpl::setFeature (const ACEXML_Char *name,
+ int boolean_value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ if (this->parent_ != 0)
+ {
+ this->parent_->setFeature (name,
+ boolean_value,
+ xmlenv);
+ return;
+ }
+
+ xmlenv.exception (new ACEXML_SAXNotRecognizedException (name));
+}
+
+void
+ACEXML_XMLFilterImpl::setProperty (const ACEXML_Char *name,
+ void *value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ if (this->parent_ != 0)
+ {
+ this->parent_->setProperty (name,
+ value,
+ xmlenv);
+ return;
+ }
+
+ xmlenv.exception (new ACEXML_SAXNotRecognizedException (name));
+}
+
+ACEXML_XMLReader *
+ACEXML_XMLFilterImpl::getParent (void) const
+{
+ return this->parent_;
+}
+
+void
+ACEXML_XMLFilterImpl::setParent (ACEXML_XMLReader *parent)
+{
+ this->parent_ = parent;
+}
+
+void
+ACEXML_XMLFilterImpl::characters (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->characters (ch, start, length, xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->endDocument (xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::endElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->endElement (namespaceURI,
+ localName,
+ qName,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->endPrefixMapping (prefix, xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->ignorableWhitespace (ch,
+ start,
+ length,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->processingInstruction (target,
+ data,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::setDocumentLocator (ACEXML_Locator *locator,
+ ACEXML_Env &xmlenv)
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->setDocumentLocator (locator, xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->skippedEntity (name, xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->startDocument (xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::startElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *atts,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->startElement (namespaceURI,
+ localName,
+ qName,
+ atts,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->contentHandler_ != 0)
+ this->contentHandler_->startPrefixMapping (prefix,
+ uri,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::notationDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->dtdHandler_ != 0)
+ this->dtdHandler_->notationDecl (name,
+ publicId,
+ systemId,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::unparsedEntityDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ const ACEXML_Char *notationName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->dtdHandler_ != 0)
+ this->dtdHandler_->unparsedEntityDecl (name,
+ publicId,
+ systemId,
+ notationName,
+ xmlenv);
+}
+
+ACEXML_InputSource *
+ACEXML_XMLFilterImpl::resolveEntity (const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->entityResolver_ != 0)
+ return this->entityResolver_->resolveEntity (publicId,
+ systemId,
+ xmlenv);
+ return 0;
+}
+
+void
+ACEXML_XMLFilterImpl::error (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->errorHandler_ != 0)
+ this->errorHandler_->error (exception,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::fatalError (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->errorHandler_ != 0)
+ this->errorHandler_->fatalError (exception,
+ xmlenv);
+}
+
+void
+ACEXML_XMLFilterImpl::warning (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->errorHandler_ != 0)
+ this->errorHandler_->warning (exception,
+ xmlenv);
+}
+
+ACEXML_DTDHandler *
+ACEXML_XMLFilterImpl::getDTDHandler (void) const
+{
+ return this->dtdHandler_;
+}
+
+ACEXML_ContentHandler *
+ACEXML_XMLFilterImpl::getContentHandler (void) const
+{
+ return this->contentHandler_;
+}
+
+ACEXML_EntityResolver *
+ACEXML_XMLFilterImpl::getEntityResolver (void) const
+{
+ return this->entityResolver_;
+}
+
+ACEXML_ErrorHandler *
+ACEXML_XMLFilterImpl::getErrorHandler (void) const
+{
+ return this->errorHandler_;
+}
+
+void
+ACEXML_XMLFilterImpl::setDTDHandler (ACEXML_DTDHandler *handler)
+{
+ this->dtdHandler_ = handler;
+}
+
+void
+ACEXML_XMLFilterImpl::setContentHandler (ACEXML_ContentHandler *handler)
+{
+ this->contentHandler_ = handler;
+}
+
+void
+ACEXML_XMLFilterImpl::setEntityResolver (ACEXML_EntityResolver *handler)
+{
+ this->entityResolver_ = handler;
+}
+
+void
+ACEXML_XMLFilterImpl::setErrorHandler (ACEXML_ErrorHandler *handler)
+{
+ this->errorHandler_ = handler;
+}
diff --git a/ACEXML/common/XMLFilterImpl.h b/ACEXML/common/XMLFilterImpl.h
new file mode 100644
index 00000000000..417909b4886
--- /dev/null
+++ b/ACEXML/common/XMLFilterImpl.h
@@ -0,0 +1,313 @@
+// -*- C++ -*- $Id$
+
+#ifndef ACEXML_XMLFILTERIMPL_H
+#define ACEXML_XMLFILTERIMPL_H
+
+#include "Common/XMLFilter.h"
+#include "Common/XMLReader.h"
+#include "Common/Locator.h"
+#include "Common/ContentHandler.h"
+#include "Common/DTDHandler.h"
+#include "Common/EntityResolver.h"
+#include "Common/ErrorHandler.h"
+
+class ACEXML_Export ACEXML_XMLFilterImpl
+ : public ACEXML_XMLFilter,
+ public ACEXML_ContentHandler,
+ public ACEXML_DTDHandler,
+ public ACEXML_EntityResolver,
+ 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);
+
+ /*
+ * Look up the value of a feature.
+ */
+ virtual int getFeature (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Look up the value of a property.
+ */
+ virtual void * getProperty (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Parse an XML document.
+ */
+ virtual void parse (ACEXML_InputSource *input,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Parse an XML document from a system identifier (URI).
+ */
+ virtual void parse (const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // @@ throw IOException???
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Set the state of a feature.
+ */
+ virtual void setFeature (const ACEXML_Char *name,
+ int boolean_value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Set the value of a property.
+ */
+ virtual void setProperty (const ACEXML_Char *name,
+ void *value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Get the parent reader.
+ */
+ virtual ACEXML_XMLReader *getParent (void) const;
+
+ /*
+ * Set the parent reader.
+ */
+ virtual void setParent (ACEXML_XMLReader *parent);
+
+ /*
+ * Get the current DTD event handler.
+ */
+ virtual ACEXML_DTDHandler *getDTDHandler (void) const;
+
+ /*
+ * Get the current content event handler.
+ */
+ virtual ACEXML_ContentHandler *getContentHandler (void) const;
+
+ /*
+ * Get the current entity resolver.
+ */
+ virtual ACEXML_EntityResolver *getEntityResolver (void) const;
+
+ /*
+ * Get the current error event handler.
+ */
+ virtual ACEXML_ErrorHandler *getErrorHandler (void) const;
+
+ /*
+ * Set the DTD event handler.
+ */
+ virtual void setDTDHandler (ACEXML_DTDHandler *handler);
+
+ /*
+ * Set the content event handler.
+ */
+ virtual void setContentHandler (ACEXML_ContentHandler *handler);
+
+ /*
+ * Set the entity resolver.
+ */
+ virtual void setEntityResolver (ACEXML_EntityResolver *handler);
+
+ /*
+ * Set the error event handler.
+ */
+ virtual void setErrorHandler (ACEXML_ErrorHandler *handler);
+
+ /*
+ * Receive notification of character data.
+ */
+ virtual void characters (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of a document.
+ */
+ virtual void endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of an element.
+ */
+ virtual void endElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * End the scope of a prefix-URI mapping.
+ */
+ virtual void endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of ignorable whitespace in element content.
+ */
+ virtual void ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a processing instruction.
+ */
+ virtual void processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive an object for locating the origin of SAX document events.
+ */
+ virtual void setDocumentLocator (ACEXML_Locator *locator,
+ ACEXML_Env &xmlenv) ;
+
+ /*
+ * Receive notification of a skipped entity.
+ */
+ virtual void skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of a document.
+ */
+ virtual void startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of an element.
+ */
+ virtual void startElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *atts,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Begin the scope of a prefix-URI Namespace mapping.
+ */
+ virtual void startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // *** Methods inherit from ACEXML_DTDHandler.
+
+ /*
+ * Receive notification of a notation declaration event.
+ */
+ virtual void notationDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of an unparsed entity declaration event.
+ */
+ virtual void unparsedEntityDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ const ACEXML_Char *notationName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_EnitityResolver.
+
+ /*
+ * Allow the application to resolve external entities.
+ */
+ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+ virtual void error (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a non-recoverable error.
+ */
+ virtual void fatalError (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a warning.
+ */
+ virtual void warning (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+protected:
+ int setupParser (void);
+ // Set up the event handlers of parent parser to this.
+ // Returns -1 if no valid parent is set.
+
+private:
+ ACEXML_XMLReader *parent_;
+ ACEXML_Locator *locator_;
+ ACEXML_EntityResolver *entityResolver_;
+ ACEXML_DTDHandler *dtdHandler_;
+ ACEXML_ContentHandler *contentHandler_;
+ ACEXML_ErrorHandler *errorHandler_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Common/XMLFilterImpl.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_XMLFILTERIMPL_H */
diff --git a/ACEXML/common/XMLFilterImpl.i b/ACEXML/common/XMLFilterImpl.i
new file mode 100644
index 00000000000..4be2ceeceea
--- /dev/null
+++ b/ACEXML/common/XMLFilterImpl.i
@@ -0,0 +1,14 @@
+// -*- C++ -*- $Id$
+
+ACEXML_INLINE int
+ACEXML_XMLFilterImpl::setupParser (void)
+{
+ if (this->parent_ == 0)
+ return -1;
+
+ this->parent_->setEntityResolver (this);
+ this->parent_->setDTDHandler (this);
+ this->parent_->setContentHandler (this);
+ this->parent_->setErrorHandler (this);
+ return 0;
+}
diff --git a/ACEXML/common/XMLReader.h b/ACEXML/common/XMLReader.h
new file mode 100644
index 00000000000..936afe6b4e1
--- /dev/null
+++ b/ACEXML/common/XMLReader.h
@@ -0,0 +1,110 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_XMLREADER_H_
+#define _ACEXML_XMLREADER_H_
+
+#include "Common/ContentHandler.h"
+#include "Common/DTDHandler.h"
+#include "Common/EntityResolver.h"
+#include "Common/ErrorHandler.h"
+
+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,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ = 0;
+
+ /*
+ * Look up the value of a property.
+ */
+ virtual void * getProperty (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ = 0;
+
+ /*
+ * Parse an XML document.
+ */
+ virtual void parse (ACEXML_InputSource *input,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ = 0;
+
+ /*
+ * Parse an XML document from a system identifier (URI).
+ */
+ virtual void parse (const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // @@ throw IOException???
+ // 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,
+ int boolean_value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ = 0;
+
+ /*
+ * Set the value of a property.
+ */
+ virtual void setProperty (const ACEXML_Char *name,
+ void *value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ = 0;
+};
+
+#endif /* _ACEXML_XMLREADER_H_ */
diff --git a/ACEXML/common/XML_Common.dsp b/ACEXML/common/XML_Common.dsp
new file mode 100644
index 00000000000..549575a218f
--- /dev/null
+++ b/ACEXML/common/XML_Common.dsp
@@ -0,0 +1,251 @@
+# Microsoft Developer Studio Project File - Name="XML_Common" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=XML_Common - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "XML_Common.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "XML_Common.mak" CFG="XML_Common - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "XML_Common - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XML_Common - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "XML_Common - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_COMMON_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../.." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ACEXML_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 ace.lib /nologo /dll /machine:I386 /out:"../../bin/Release/ACEXML.dll" /libpath:"w:\ace_wrappers\ace"
+
+!ELSEIF "$(CFG)" == "XML_Common - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "XML_Common___Win32_Debug"
+# PROP BASE Intermediate_Dir "XML_Common___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_COMMON_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../.." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D ACEXML_HAS_DLL=1 /D "ACEXML_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /dll /debug /machine:I386 /out:"../../bin/ACEXMLD.dll" /pdbtype:sept /libpath:"w:\ace_wrappers\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "XML_Common - Win32 Release"
+# Name "XML_Common - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AttributesImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CharStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\DefaultHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Env.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Exception.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\FileCharStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\InputSource.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\LocatorImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NamespaceSupport.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SAXExceptions.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Transcode.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\XMLFilterImpl.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\ACEXML_Export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Attributes.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AttributesImpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CharStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ContentHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\DefaultHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\DTDHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\EntityResolver.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Env.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ErrorHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Exception.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FileCharStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\InputSource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Locator.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\LocatorImpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NamespaceSupport.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SAXExceptions.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Transcode.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XML_Types.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XMLFilter.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XMLFilterImpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XMLReader.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# Begin Source File
+
+SOURCE=.\Env.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\Exception.i
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/ACEXML/common/XML_Types.h b/ACEXML/common/XML_Types.h
new file mode 100644
index 00000000000..03abba599ba
--- /dev/null
+++ b/ACEXML/common/XML_Types.h
@@ -0,0 +1,57 @@
+// -*- C++ -*- $Id$
+// This file collects the type definitions for data types
+// used in ACE XML parser.
+
+#ifndef _ACEXML_XML_TYPES_H_
+#define _ACEXML_XML_TYPES_H_
+#include "ace/OS.h"
+#include "ace/SString.h"
+#include "Common/ACEXML_Export.h"
+
+#if defined (ACE_HAS_WCHAR) && (ACE_SIZEOF_WCHAR == 2)
+typedef wchar_t ACEXML_UTF16;
+#else
+typedef ACE_USHORT16 ACEXML_UTF16;
+#endif /* ACE_HAS_WCHAR && ACE_SIZEOF_WCHAR == 2 */
+
+#if defined (ACE_HAS_WCHAR) && (ACE_SIZEOF_WCHAR == 4)
+typedef wchar_t ACEXML_UCS4;
+#else
+typedef ACE_UINT32 ACEXML_UCS4;
+#endif /* ACE_HAS_WCHAR && ACE_SIZEOF_WCHAR == 4 */
+
+typedef char ACEXML_UTF8;
+
+typedef ACEXML_UTF8 ACEXML_Char;
+// Default XML character encoding. We can change this to either
+// ACEXML_UTF8 or ACEXML_UTF16
+
+#if 0 // defined (ACE_HAS_STANDARD_CPP_LIBRARY)
+typedef string ACEXML_String;
+#else
+typedef ACE_CString ACEXML_String;
+// Defulat XML strings will use UTF-8 encoding. We would like to use
+// the string classes in standard C++ Library here. But they are not
+// very portable yet (as far as I know,) and I'll just use ACE_CString
+// for now. Notice that you should never convert strings between
+// ACE_CString and ACE_WString using the built-in conversion functions
+// as they only perform simple copy without any encoding conversion.
+#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+
+#if (!defined (ACEXML_HAS_INLINE) && defined (__ACE_INLINE__)) || (ACEXML_HAS_INLINE == 1)
+# define __ACEXML_INLINE__ inline
+#else
+# if defined (__ACEXML_INLINE__)
+# undefine __ACEXML_INLINE__
+# endif /* __ACEXML_INLINE__ */
+#endif /* (!ACEXML_HAS_INLINE) && (__ACE_INLINE__) || (ACEXML_HAS_INLINE == 1) */
+
+#if defined (__ACEXML_INLINE__)
+# define ACEXML_INLINE inline
+#else
+# define ACEXML_INLINE
+#endif /* __ACEXML_INLINE */
+
+// As we always assume sizeof<char> on all platforms are 1 byte long,
+// so char == UTF8 char, and there is no need to define it again.
+#endif /* _ACEXML_XML_TYPE_H_ */
diff --git a/ACEXML/examples/SAXPrint/Makefile b/ACEXML/examples/SAXPrint/Makefile
new file mode 100644
index 00000000000..4dfd9239bc0
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/Makefile
@@ -0,0 +1,49 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Makefile for repeating token client application
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+LDLIBS = -lACEXML_Parser -lACEXML
+FILES = Print_Handler \
+ SAXPrint_Handler
+
+SRC = $(addsuffix .cpp,$(FILES))
+OBJ = $(LSRC:%.cpp=$(VDIR)%.o)
+CCFLAGS += -I ../..
+
+BIN = main
+
+BUILD = $(VBIN)
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/ACEXML/examples/SAXPrint/Print_Handler.cpp b/ACEXML/examples/SAXPrint/Print_Handler.cpp
new file mode 100644
index 00000000000..d1248a7f8ab
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/Print_Handler.cpp
@@ -0,0 +1,209 @@
+// -*- C++ -*- $Id$
+
+#include "Print_Handler.h"
+#include "ace/ACE.h"
+#if !defined (__ACEXML_INLINE__)
+# include "Print_Handler.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_Print_Handler::ACEXML_Print_Handler (void)
+{
+ // no-op
+}
+
+ACEXML_Print_Handler::~ACEXML_Print_Handler (void)
+{
+ // no-op
+}
+
+void
+ACEXML_Print_Handler::characters (const ACEXML_Char *cdata,
+ int start,
+ int end,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event characters () ** start: " << start
+ << " end: " << end << " ***************" << endl;
+ cout << cdata << endl;
+ cout << "- End event characters () ---------------" << endl;
+}
+
+void
+ACEXML_Print_Handler::endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event endDocument () ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::endElement (const ACEXML_Char *uri,
+ const ACEXML_Char *name,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event endElement (" << uri << ", " << name << ", "
+ << qName << ") ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event endPrefixMapping (" << prefix << ") ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::ignorableWhitespace (const ACEXML_Char *,
+ int,
+ int,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event ignorableWhitespace () ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event processingInstruction (" << target << ", "
+ << data << ") ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::setDocumentLocator (ACEXML_Locator *,
+ ACEXML_Env &xmlenv)
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event setDocumentLocator () ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event skippedEntity (" << name << ") ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event startDocument () ***************" << endl;
+}
+
+void
+ACEXML_Print_Handler::startElement (const ACEXML_Char *uri,
+ const ACEXML_Char *name,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event startElement (" << uri << ", "
+ << name << ", " << qName << ") ***************" << endl;
+ if (alist != 0)
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ cout << " " << alist->getQName (i) << " = \""
+ << alist->getValue (i) << "\"" << endl;
+ }
+}
+
+void
+ACEXML_Print_Handler::startPrefixMapping (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+// *** Methods inherit from ACEXML_DTDHandler.
+
+void
+ACEXML_Print_Handler::notationDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_Print_Handler::unparsedEntityDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+// Methods inherit from ACEXML_EnitityResolver.
+
+ACEXML_InputSource *
+ACEXML_Print_Handler::resolveEntity (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+ return 0;
+}
+
+// Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+void
+ACEXML_Print_Handler::error (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_Print_Handler::fatalError (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_Print_Handler::warning (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
diff --git a/ACEXML/examples/SAXPrint/Print_Handler.h b/ACEXML/examples/SAXPrint/Print_Handler.h
new file mode 100644
index 00000000000..ff943cdade7
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/Print_Handler.h
@@ -0,0 +1,179 @@
+// $Id$
+
+#ifndef ACEXML_PRINT_HANDLER_H
+#define ACEXML_PRINT_HANDLER_H
+
+#include "Common/DefaultHandler.h"
+
+class ACEXML_Print_Handler : public ACEXML_DefaultHandler
+{
+public:
+ /*
+ * Default constructor.
+ */
+ ACEXML_Print_Handler (void);
+
+ /*
+ * Default destructor.
+ */
+ virtual ~ACEXML_Print_Handler (void);
+
+ // Methods inherit from ACEXML_ContentHandler.
+
+ /*
+ * Receive notification of character data.
+ */
+ virtual void characters (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of a document.
+ */
+ virtual void endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of an element.
+ */
+ virtual void endElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * End the scope of a prefix-URI mapping.
+ */
+ virtual void endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of ignorable whitespace in element content.
+ */
+ virtual void ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a processing instruction.
+ */
+ virtual void processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive an object for locating the origin of SAX document events.
+ */
+ virtual void setDocumentLocator (ACEXML_Locator *locator,
+ ACEXML_Env &xmlenv) ;
+
+ /*
+ * Receive notification of a skipped entity.
+ */
+ virtual void skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of a document.
+ */
+ virtual void startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of an element.
+ */
+ virtual void startElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *atts,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Begin the scope of a prefix-URI Namespace mapping.
+ */
+ virtual void startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // *** Methods inherit from ACEXML_DTDHandler.
+
+ /*
+ * Receive notification of a notation declaration event.
+ */
+ virtual void notationDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of an unparsed entity declaration event.
+ */
+ virtual void unparsedEntityDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ const ACEXML_Char *notationName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_EnitityResolver.
+
+ /*
+ * Allow the application to resolve external entities.
+ */
+ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+ virtual void error (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a non-recoverable error.
+ */
+ virtual void fatalError (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a warning.
+ */
+ virtual void warning (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+};
+
+#endif /* ACEXML_PRINT_HANDLER_H */
diff --git a/ACEXML/examples/SAXPrint/Print_Handler.i b/ACEXML/examples/SAXPrint/Print_Handler.i
new file mode 100644
index 00000000000..77b4466a3cb
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/Print_Handler.i
@@ -0,0 +1 @@
+// -*- C++ -*- $Id$
diff --git a/ACEXML/examples/SAXPrint/SAXPrint.dsp b/ACEXML/examples/SAXPrint/SAXPrint.dsp
new file mode 100644
index 00000000000..06c3cc09b48
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/SAXPrint.dsp
@@ -0,0 +1,130 @@
+# Microsoft Developer Studio Project File - Name="SAXPrint" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=SAXPrint - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "SAXPrint.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "SAXPrint.mak" CFG="SAXPrint - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "SAXPrint - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "SAXPrint - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "SAXPrint - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ACEXML.lib ACEXML_Parser.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser"
+
+!ELSEIF "$(CFG)" == "SAXPrint - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACEXMLd.lib ACEXML_Parserd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser"
+
+!ENDIF
+
+# Begin Target
+
+# Name "SAXPrint - Win32 Release"
+# Name "SAXPrint - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Print_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SAXPrint_Handler.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Print_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SAXPrint_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# Begin Source File
+
+SOURCE=.\Print_Handler.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\SAXPrint_Handler.i
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/ACEXML/examples/SAXPrint/SAXPrint.dsw b/ACEXML/examples/SAXPrint/SAXPrint.dsw
new file mode 100644
index 00000000000..3ec5cb65624
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/SAXPrint.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "SAXPrint"=.\SAXPrint.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp b/ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp
new file mode 100644
index 00000000000..1cc30a5e958
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp
@@ -0,0 +1,222 @@
+// -*- C++ -*- $Id$
+
+#include "SAXPrint_Handler.h"
+#include "ace/ACE.h"
+#if !defined (__ACEXML_INLINE__)
+# include "SAXPrint_Handler.i"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_SAXPrint_Handler::ACEXML_SAXPrint_Handler (void)
+ : indent_ (0)
+{
+ // no-op
+}
+
+ACEXML_SAXPrint_Handler::~ACEXML_SAXPrint_Handler (void)
+{
+ // no-op
+}
+
+void
+ACEXML_SAXPrint_Handler::characters (const ACEXML_Char *cdata,
+ int start,
+ int end,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+ ACE_UNUSED_ARG (start);
+ ACE_UNUSED_ARG (end);
+
+ cout << cdata;
+}
+
+void
+ACEXML_SAXPrint_Handler::endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::endElement (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ this->dec_indent ();
+ this->print_indent ();
+ cout << "</" << qName << ">";
+}
+
+void
+ACEXML_SAXPrint_Handler::endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event endPrefixMapping (" << prefix << ") ***************" << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::ignorableWhitespace (const ACEXML_Char *,
+ int,
+ int,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event ignorableWhitespace () ***************" << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ this->print_indent ();
+ cout << "<?" << target << " "
+ << data << "?>" << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::setDocumentLocator (ACEXML_Locator *,
+ ACEXML_Env &xmlenv)
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event setDocumentLocator () ***************" << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event skippedEntity (" << name << ") ***************" << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ cout << "* Event startDocument () ***************" << endl;
+}
+
+void
+ACEXML_SAXPrint_Handler::startElement (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *alist,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ ACE_UNUSED_ARG (xmlenv);
+
+ this->print_indent ();
+
+ cout << "<" << qName;
+ if (alist != 0)
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ cout << " " << alist->getQName (i) << " = \""
+ << alist->getValue (i) << "\"";
+ }
+ cout << ">";
+ this->inc_indent ();
+}
+
+void
+ACEXML_SAXPrint_Handler::startPrefixMapping (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+// *** Methods inherit from ACEXML_DTDHandler.
+
+void
+ACEXML_SAXPrint_Handler::notationDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_SAXPrint_Handler::unparsedEntityDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+// Methods inherit from ACEXML_EnitityResolver.
+
+ACEXML_InputSource *
+ACEXML_SAXPrint_Handler::resolveEntity (const ACEXML_Char *,
+ const ACEXML_Char *,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+ return 0;
+}
+
+// Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+void
+ACEXML_SAXPrint_Handler::error (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_SAXPrint_Handler::fatalError (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_SAXPrint_Handler::warning (ACEXML_SAXParseException &,
+ ACEXML_Env &)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // No-op.
+}
+
+void
+ACEXML_SAXPrint_Handler::print_indent (void)
+{
+ cout << endl;
+ for (size_t i = 0; i < this->indent_; ++i)
+ cout << " ";
+}
diff --git a/ACEXML/examples/SAXPrint/SAXPrint_Handler.h b/ACEXML/examples/SAXPrint/SAXPrint_Handler.h
new file mode 100644
index 00000000000..e28ee471799
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/SAXPrint_Handler.h
@@ -0,0 +1,190 @@
+// $Id$
+
+#ifndef ACEXML_SAXPRINT_HANDLER_H
+#define ACEXML_SAXPRINT_HANDLER_H
+
+#include "Common/DefaultHandler.h"
+
+class ACEXML_SAXPrint_Handler : public ACEXML_DefaultHandler
+{
+public:
+ /*
+ * Default constructor.
+ */
+ ACEXML_SAXPrint_Handler (void);
+
+ /*
+ * Default destructor.
+ */
+ virtual ~ACEXML_SAXPrint_Handler (void);
+
+ // Methods inherit from ACEXML_ContentHandler.
+
+ /*
+ * Receive notification of character data.
+ */
+ virtual void characters (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of a document.
+ */
+ virtual void endDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the end of an element.
+ */
+ virtual void endElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * End the scope of a prefix-URI mapping.
+ */
+ virtual void endPrefixMapping (const ACEXML_Char *prefix,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of ignorable whitespace in element content.
+ */
+ virtual void ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a processing instruction.
+ */
+ virtual void processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive an object for locating the origin of SAX document events.
+ */
+ virtual void setDocumentLocator (ACEXML_Locator *locator,
+ ACEXML_Env &xmlenv) ;
+
+ /*
+ * Receive notification of a skipped entity.
+ */
+ virtual void skippedEntity (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of a document.
+ */
+ virtual void startDocument (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of the beginning of an element.
+ */
+ virtual void startElement (const ACEXML_Char *namespaceURI,
+ const ACEXML_Char *localName,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *atts,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Begin the scope of a prefix-URI Namespace mapping.
+ */
+ virtual void startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // *** Methods inherit from ACEXML_DTDHandler.
+
+ /*
+ * Receive notification of a notation declaration event.
+ */
+ virtual void notationDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of an unparsed entity declaration event.
+ */
+ virtual void unparsedEntityDecl (const ACEXML_Char *name,
+ const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ const ACEXML_Char *notationName,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_EnitityResolver.
+
+ /*
+ * Allow the application to resolve external entities.
+ */
+ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
+ const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ // Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+ virtual void error (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a non-recoverable error.
+ */
+ virtual void fatalError (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Receive notification of a warning.
+ */
+ virtual void warning (ACEXML_SAXParseException &exception,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ void inc_indent ();
+ void dec_indent ();
+ void print_indent ();
+
+private:
+ size_t indent_;
+
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "SAXPrint_Handler.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_SAXPRINT_HANDLER_H */
diff --git a/ACEXML/examples/SAXPrint/SAXPrint_Handler.i b/ACEXML/examples/SAXPrint/SAXPrint_Handler.i
new file mode 100644
index 00000000000..2102291ea68
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/SAXPrint_Handler.i
@@ -0,0 +1,13 @@
+// -*- C++ -*- $Id$
+
+ACEXML_INLINE void
+ACEXML_SAXPrint_Handler::inc_indent (void)
+{
+ this->indent_ += 1;
+}
+
+ACEXML_INLINE void
+ACEXML_SAXPrint_Handler::dec_indent (void)
+{
+ this->indent_ -= 1;
+}
diff --git a/ACEXML/examples/SAXPrint/main.cpp b/ACEXML/examples/SAXPrint/main.cpp
new file mode 100644
index 00000000000..97f74cf32b6
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/main.cpp
@@ -0,0 +1,49 @@
+// $Id$
+
+#include "Common/FileCharStream.h"
+#include "Basic_Parser/Basic_Parser.h"
+#include "Print_Handler.h"
+#include "SAXPrint_Handler.h"
+
+
+int
+main (int argc, char *argv[])
+{
+ {
+ if (argc != 2)
+ {
+ cerr << "Usage: SAXPrint <XML filename>" << endl;
+ return 1;
+ }
+
+ ACEXML_FileCharStream *fstm = 0;
+ ACE_NEW_RETURN (fstm,
+ ACEXML_FileCharStream (),
+ 1);
+
+ if (fstm->open (argv [1]) != 0)
+ {
+ cerr << "Fail to open XML file: " << argv[1] << endl;
+ return 1;
+ }
+
+ ACEXML_Basic_Parser parser;
+ ACEXML_Print_Handler handler;
+ ACEXML_InputSource input(fstm);
+
+ parser.setContentHandler (&handler);
+ parser.setDTDHandler (&handler);
+ parser.setErrorHandler (&handler);
+ parser.setEntityResolver (&handler);
+
+ ACEXML_Env xmlenv;
+
+ parser.parse (&input, xmlenv);
+ if (xmlenv.exception ())
+ xmlenv.exception ()->print ();
+
+ cout << "\r\r\r";
+
+ }
+ return 0;
+}
diff --git a/ACEXML/examples/SAXPrint/ns.svc.conf.xml b/ACEXML/examples/SAXPrint/ns.svc.conf.xml
new file mode 100644
index 00000000000..a7487dc360f
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/ns.svc.conf.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<ace:ACE_Svc_Conf xmlns:ace="http://ace.doc.wustl.edu/svcconf">
+<static id="ACE_Service_Manager">
+ <params>-d</params>
+ <params>-p 4911</params>
+</static>
+
+<dynamic id="Test_Task" type="service_object"> &#65; &amp;
+ <initializer path="CCM_App" init="_make_Test_Task">
+ <params>-p 3000</params>
+ </initializer>
+</dynamic>
+
+<ace:streamdef>
+ <dynamic id="CCM_App" type="stream" status="active">
+ <initializer path="CCM_App" init="make_stream"/>
+ </dynamic>
+ <module>
+ <dynamic id="Device_Adapter" type="module">
+ <initializer path="CCM_App" init="make_da"/>
+ </dynamic>
+ <dynamic id="Event_Analyzer" type="module">
+ <initializer path="CCM_App" init="make_ea"/>
+ </dynamic>
+ <dynamic id="Multicast_Router" type="module">
+ <initializer path="CCM_App" init="make_mr">
+ <params>-p</params>
+ <params>3001</params>
+ </initializer>
+ </dynamic>
+ </module>
+</ace:streamdef>
+
+<stream id="CCM_App">
+ <module>
+ <remove id="Device_Adapter"/>
+ <!-- <remove id="Event_Analyzer"/> -->
+ <!-- <remove id="Multicast_Router"/> -->
+ <![CDATA[Only a text string.
+Do you &amp;expect something more?]]>
+ </module>
+</stream>
+
+<!-- remove CCM_App -->
+<remove id="Test_&amp;Task&#x65;bc"/>
+</ace:ACE_Svc_Conf> \ No newline at end of file
diff --git a/ACEXML/examples/SAXPrint/svc.conf.xml b/ACEXML/examples/SAXPrint/svc.conf.xml
new file mode 100644
index 00000000000..356dbb5e654
--- /dev/null
+++ b/ACEXML/examples/SAXPrint/svc.conf.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!-- <!DOCTYPE ACE_Svc_Conf> -->
+<ACE_Svc_Conf>
+<static id="ACE_Service_Manager">
+ <params>-d</params>
+ <params>-p 4911</params>
+</static>
+
+<dynamic id="Test_Task" type="service_object"> &#65; &amp;
+ <initializer path="CCM_App" init="_make_Test_Task">
+ <params>-p 3000</params>
+ </initializer>
+</dynamic>
+
+<streamdef>
+ <dynamic id="CCM_App" type="stream" status="active">
+ <initializer path="CCM_App" init="make_stream"/>
+ </dynamic>
+ <module>
+ <dynamic id="Device_Adapter" type="module">
+ <initializer path="CCM_App" init="make_da"/>
+ </dynamic>
+ <dynamic id="Event_Analyzer" type="module">
+ <initializer path="CCM_App" init="make_ea"/>
+ </dynamic>
+ <dynamic id="Multicast_Router" type="module">
+ <initializer path="CCM_App" init="make_mr">
+ <params>-p</params>
+ <params>3001</params>
+ </initializer>
+ </dynamic>
+ </module>
+</streamdef>
+
+<stream id="CCM_App">
+ <module>
+ <remove id="Device_Adapter"/>
+ <!-- <remove id="Event_Analyzer"/> -->
+ <!-- <remove id="Multicast_Router"/> -->
+ <![CDATA[Only a text string.
+Do you &amp;expect something more?]]>
+ </module>
+</stream>
+
+<!-- remove CCM_App -->
+<remove id="Test_&amp;Task&#x65;bc"/>
+</ACE_Svc_Conf> \ No newline at end of file
diff --git a/ACEXML/parser/parser/Entity_Manager.cpp b/ACEXML/parser/parser/Entity_Manager.cpp
new file mode 100644
index 00000000000..97c1d18af0e
--- /dev/null
+++ b/ACEXML/parser/parser/Entity_Manager.cpp
@@ -0,0 +1,48 @@
+// $Id$
+
+#include "Entity_Manager.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Entity_Manager.i"
+#endif /* __ACEXML_INLINE__ */
+
+static const ACEXML_Char amp_name[] = {'a', 'm', 'p', 0 };
+static const ACEXML_Char amp_value[] = {'&', 0};
+static const ACEXML_Char lt_name[] = {'l', 't', 0};
+static const ACEXML_Char lt_value[] = {'<', 0};
+static const ACEXML_Char gt_name[] = {'g', 't', 0};
+static const ACEXML_Char gt_value[] = {'>', 0};
+static const ACEXML_Char apos_name[] = {'a', 'p', 'o', 's', 0};
+static const ACEXML_Char apos_value[] = {'\'', 0};
+static const ACEXML_Char quot_name[] = {'q', 'u', 'o', 't', 0};
+static const ACEXML_Char quot_value[] = {'"', 0};
+
+ACEXML_Entity_Manager::ACEXML_Entity_Manager (void)
+ : entities_ ()
+{
+ // @@ No way to know if these bindings success or not.
+
+ ACEXML_String ampname (amp_name, 0, 0);
+ ACEXML_String ampvalue (amp_value, 0, 0);
+ this->entities_.bind (ampname, ampvalue);
+
+ ACEXML_String ltname (lt_name, 0, 0);
+ ACEXML_String ltvalue (lt_value, 0, 0);
+ this->entities_.bind (ltname, ltvalue);
+
+ ACEXML_String gtname (gt_name, 0, 0);
+ ACEXML_String gtvalue (gt_value, 0, 0);
+ this->entities_.bind (gtname, gtvalue);
+
+ ACEXML_String aposname (apos_name, 0, 0);
+ ACEXML_String aposvalue (apos_value, 0, 0);
+ this->entities_.bind (aposname, aposvalue);
+
+ ACEXML_String quotname (quot_name, 0, 0);
+ ACEXML_String quotvalue (quot_value, 0, 0);
+ this->entities_.bind (quotname, quotvalue);
+}
+
+ACEXML_Entity_Manager::~ACEXML_Entity_Manager (void)
+{
+}
diff --git a/ACEXML/parser/parser/Entity_Manager.h b/ACEXML/parser/parser/Entity_Manager.h
new file mode 100644
index 00000000000..902b6553c42
--- /dev/null
+++ b/ACEXML/parser/parser/Entity_Manager.h
@@ -0,0 +1,59 @@
+// -*- C++ -*- $Id$
+
+#ifndef ACEXML_ENTITY_MANAGER_H
+#define ACEXML_ENTITY_MANAGER_H
+
+#include "Common/XML_Types.h"
+#include "Parser_export.h"
+#include "ace/Functor.h"
+#include "ace/Hash_Map_Manager.h"
+#include "ace/Containers_T.h"
+
+typedef ACE_Hash_Map_Entry<ACEXML_String,
+ ACEXML_String> ACEXML_ENTITY_ENTRY;
+
+typedef ACE_Hash_Map_Manager_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER;
+
+typedef ACE_Hash_Map_Iterator_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_ITER;
+
+typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_REVERSE_ITER;
+
+/**
+ * Class to manager and resolve entity references.
+ */
+class ACEXML_PARSER_Export ACEXML_Entity_Manager
+{
+public:
+ /// Default constructor.
+ ACEXML_Entity_Manager (void);
+
+ /// Destructor.
+ ~ACEXML_Entity_Manager (void);
+
+ /// Add a new entity declaration.
+ int add_entity (const ACEXML_Char *ref,
+ const ACEXML_Char *value);
+
+ /// Resolve an entity reference.
+ const ACEXML_String *resolve_entity (const ACEXML_Char *ref);
+
+private:
+ ACEXML_ENTITIES_MANAGER entities_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Entity_Manager.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* ACEXML_ENTITY_MANAGER_H */
diff --git a/ACEXML/parser/parser/Entity_Manager.i b/ACEXML/parser/parser/Entity_Manager.i
new file mode 100644
index 00000000000..696b82b64e4
--- /dev/null
+++ b/ACEXML/parser/parser/Entity_Manager.i
@@ -0,0 +1,21 @@
+// $Id$
+
+ACEXML_INLINE int
+ACEXML_Entity_Manager::add_entity (const ACEXML_Char *ref,
+ const ACEXML_Char *v)
+{
+ ACEXML_String name (ref, 0, 0);
+ ACEXML_String value (v, 0, 0);
+ return this->entities_.bind (name, value);
+}
+
+ACEXML_INLINE const ACEXML_String *
+ACEXML_Entity_Manager::resolve_entity (const ACEXML_Char *ref)
+{
+ ACEXML_ENTITY_ENTRY *entry;
+
+ if (this->entities_.find (ACEXML_String (ref, 0, 0),
+ entry) == 0)
+ return &entry->int_id_;
+ return 0;
+}
diff --git a/ACEXML/parser/parser/Makefile b/ACEXML/parser/parser/Makefile
new file mode 100644
index 00000000000..07f484df786
--- /dev/null
+++ b/ACEXML/parser/parser/Makefile
@@ -0,0 +1,40 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Makefile for the server-side ACE network services
+#----------------------------------------------------------------------------
+
+LIB = libACEXML_Parser.a
+SHLIB = libACEXML_Parser.$(SOEXT)
+
+FILES = Entity_Manager \
+ Basic_Parser
+
+DEFS = $(addsuffix .h,$(FILES))
+LSRC = $(addsuffix .cpp,$(FILES))
+
+LIBS += $(ACELIB)
+CCFLAGS += -I ..
+
+BUILD = $(VLIB) $(VSHLIB)
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
diff --git a/ACEXML/parser/parser/Parser.cpp b/ACEXML/parser/parser/Parser.cpp
new file mode 100644
index 00000000000..2ca3d417f3f
--- /dev/null
+++ b/ACEXML/parser/parser/Parser.cpp
@@ -0,0 +1,1208 @@
+// $Id$
+
+#include "Parser.h"
+#include "Common/Transcode.h"
+#include "Common/AttributesImpl.h"
+
+#if !defined (__ACEXML_INLINE__)
+# include "Parser.i"
+#endif /* __ACEXML_INLINE__ */
+
+/***
+TO-DO:
+
+END-OF-LINE handling: x read quoted string
+ ignore whitespace
+ processing instruction
+ x element contents
+
+Figure out how to handle namespace here:
+and when to invoke start/endPrefixMapping?
+
+Make sure we are freezing the obstack in all cases.
+
+***/
+
+static const ACEXML_Char default_attribute_type[] = {'C', 'D', 'A', 'T', 'A', 0};
+static const ACEXML_Char empty_string[] = { 0 };
+
+ACEXML_Parser::ACEXML_Parser (void)
+ : dtd_handler_ (0),
+ entity_resolver_ (0),
+ content_handler_ (0),
+ error_handler_ (0)
+{
+}
+
+ACEXML_Parser::~ACEXML_Parser (void)
+{
+}
+
+int
+ACEXML_Parser::getFeature (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ // Not implemented.
+
+ ACE_UNUSED_ARG (name);
+
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return -1;
+}
+
+void *
+ACEXML_Parser::getProperty (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ // @@ Not implemented.
+ ACE_UNUSED_ARG (name);
+
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return 0;
+}
+
+void
+ACEXML_Parser::setFeature (const ACEXML_Char *name,
+ int boolean_value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ // @@ Not implemented.
+ ACE_UNUSED_ARG (name);
+ ACE_UNUSED_ARG (boolean_value);
+
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+}
+
+void
+ACEXML_Parser::setProperty (const ACEXML_Char *name,
+ void *value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+{
+ // @@ Not implemented.
+ ACE_UNUSED_ARG (name);
+ ACE_UNUSED_ARG (value);
+
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+}
+
+
+void
+ACEXML_Parser::parse (ACEXML_InputSource *input,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (input == 0)
+ {
+ xmlenv.exception (new ACEXML_SAXException ("No valid input source available"));
+ return;
+ }
+
+ // @@ Set up Locator.
+
+ if ((this->instream_ = input->getCharStream ()) == 0)
+ {
+ xmlenv.exception (new ACEXML_SAXException ("No valid input source available"));
+ return;
+ }
+ this->parse_xml_prolog (xmlenv);
+ ACEXML_CHECK;
+
+ this->content_handler_->startDocument (xmlenv);
+ ACEXML_CHECK;
+
+ int doctype_defined = 0;
+
+ for (int prolog_done = 0; prolog_done == 0; )
+ {
+ if (this->skip_whitespace (0) != '<')
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Expecting '<'"));
+ return;
+
+ }
+ ACEXML_Char fwd = this->peek ();
+ switch (fwd)
+ {
+ case '!':
+ this->get (); // consume the '!'
+ fwd = this->peek ();
+ if (fwd == 'D' && !doctype_defined) // DOCTYPE
+ {
+ // This will also take care of the trailing MISC block if any.
+ this->parse_doctypedecl (xmlenv);
+ ACEXML_CHECK;
+ doctype_defined = 1;
+ break;
+ }
+ else if (fwd == '-') // COMMENT
+ {
+ if (this->grok_comment () < 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Invalid comment"));
+ return;
+ }
+ }
+ else
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Duplicate DOCTYPE definitions"));
+ return;
+ }
+ break;
+ case '?':
+ this->parse_processing_instruction (xmlenv);
+ ACEXML_CHECK;
+ break;
+ case 0:
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected EOF"));
+ break;
+ default: // Root element begins
+ prolog_done = 1;
+ break;
+ }
+ }
+
+ this->parse_element (xmlenv);
+ ACEXML_CHECK;
+
+ this->content_handler_->endDocument (xmlenv);
+ // ACEXML_CHECK;
+}
+
+void
+ACEXML_Parser::parse (const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // @@ Not implemented.
+ ACE_UNUSED_ARG (systemId);
+
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return ;
+}
+
+
+ACEXML_Char
+ACEXML_Parser::skip_whitespace (ACEXML_Char **whitespace)
+{
+ ACEXML_Char ch = this->get ();
+
+ if (this->is_whitespace (ch) == 0)
+ {
+ if (whitespace != 0)
+ *whitespace = 0;
+ return ch;
+ }
+
+ do
+ {
+ if (whitespace != 0)
+ this->obstack_.grow (ch);
+ ch = this->get ();
+ }
+ while (this->is_whitespace (ch));
+
+ if (whitespace != 0)
+ *whitespace = this->obstack_.freeze ();
+
+ return ch;
+}
+
+void
+ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->get () != '<' ||
+ this->get () != '?' ||
+ this->get () != 'x' ||
+ this->get () != 'm' ||
+ this->get () != 'l')
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unrecognized XML Decl"));
+ return;
+ }
+
+ ACEXML_Char *astring;
+
+ if (this->skip_whitespace (0) != 'v' || // Discard whitespace
+ this->get () != 'e' ||
+ this->get () != 'r' ||
+ this->get () != 's' ||
+ this->get () != 'i' ||
+ this->get () != 'o' ||
+ this->get () != 'n' ||
+ this->skip_equal () != 0 ||
+ this->get_quoted_string (astring) != 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unrecognized XML Decl"));
+ return;
+ }
+
+ // @@ Handle version number here.
+
+ int xmldecl_state = 0;
+ int seen_encoding = 0;
+
+ while (1)
+ {
+ ACEXML_Char fwd = this->peek ();
+ if (fwd != '?')
+ {
+ fwd = this->skip_whitespace (0); // Discard whitespace
+ if (fwd == '?')
+ {
+ // Do nothing. Fall down to consume the '?'
+ // and wrap up the XML Decl parsing.
+ }
+ else if (xmldecl_state == 0 && fwd == 'e')
+ {
+ if (this->get () == 'n' &&
+ this->get () == 'c' &&
+ this->get () == 'o' &&
+ this->get () == 'd' &&
+ this->get () == 'i' &&
+ this->get () == 'n' &&
+ this->get () == 'g' &&
+ this->skip_equal () == 0 &&
+ this->get_quoted_string (astring) == 0)
+ {
+ seen_encoding = 1;
+ // @@ Handle encoding here. We don't handle
+ // various encodings for this parser.
+
+ continue;
+ }
+ else
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unrecognized XML Decl"));
+ return;
+ }
+ }
+ else if (xmldecl_state < 2 && fwd == 's')
+ {
+ if (this->get () == 't' &&
+ this->get () == 'a' &&
+ this->get () == 'n' &&
+ this->get () == 'd' &&
+ this->get () == 'a' &&
+ this->get () == 'l' &&
+ this->get () == 'o' &&
+ this->get () == 'n' &&
+ this->get () == 'g' &&
+ this->skip_equal () == 0 &&
+ this->get_quoted_string (astring) == 0)
+ {
+ xmldecl_state = 2;
+ if (ACE_OS::strcmp (astring, "yes") == 0)
+ {
+ // @@ This is a standalone XML file.
+ continue;
+ }
+ else if (ACE_OS::strcmp (astring, "no") == 0)
+ {
+ // @@ This is not a stand alone XML file.
+ continue;
+ }
+ }
+ xmlenv.exception (new ACEXML_SAXParseException ("Unrecognized XML Decl"));
+ return;
+ }
+ else
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unrecognized XML Decl"));
+ return;
+ }
+ }
+
+
+ this->get (); // consume '?'
+
+ if (this->get() != '>')
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unrecognized XML Decl"));
+ return;
+ }
+ return;
+ }
+ // End parsing XML Decl.
+}
+
+int
+ACEXML_Parser::grok_comment (void)
+{
+ /// Simply filter out all the comment
+ int state = 0;
+
+ if (this->get () != '-' || // Skip the opening "<!--"
+ this->get () != '-' || // completely.
+ this->get () == '-') // and at least something not '-'.
+ return -1;
+
+ while (state < 3) // Waiting for the trailing three
+ // character '-->'. Notice that
+ // according to the spec, '--->'
+ // is not a valid closing comment
+ // sequence. But we'll let it pass
+ // anyway.
+ {
+ ACEXML_Char fwd = this->get ();
+ if ((fwd == '-' && state < 2) ||
+ (fwd == '>' && state == 2))
+ state += 1;
+ else
+ state = 0; // Reset parse state.
+ }
+ return 0;
+}
+
+ACEXML_Char *
+ACEXML_Parser::read_name (ACEXML_Char ch)
+{
+ if (ch == 0)
+ {
+ ch = this->get ();
+
+ if (this->is_whitespace (ch))
+ // No white space is allowed here.
+ return 0;
+ }
+ else if (this->is_nonname (ch))
+ return 0;
+
+ while (1)
+ {
+ this->obstack_.grow (ch);
+ ch = this->peek ();
+ if (this->is_nonname (ch))
+ break;
+ ch = this->get ();
+ };
+
+ return this->obstack_.freeze ();
+}
+
+int
+ACEXML_Parser::parse_processing_instruction (ACEXML_Env &xmlenv)
+{
+ if (this->get () != '?')
+ { // How did we get here?
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal error"));
+ return -1;
+ }
+ const ACEXML_Char *pitarget = this->read_name ();
+ ACEXML_Char *instruction = 0;
+
+ if (ACE_OS_String::strcasecmp ("xml", pitarget) != 0)
+ { // Invalid PITarget name.
+ xmlenv.exception
+ (new ACEXML_SAXParseException ("PITarget name cannot start with 'xml'"));
+ return -1;
+ }
+
+ int state = 0;
+ ACEXML_Char ch = this->skip_whitespace (0);
+
+ while (state < 2)
+ {
+ switch (ch)
+ {
+ case '?':
+ if (state == 0)
+ state = 1;
+ break;
+ case '>':
+ if (state == 1)
+ {
+ instruction = this->obstack_.freeze ();
+ this->content_handler_->processingInstruction (pitarget,
+ instruction,
+ xmlenv);
+ ACEXML_CHECK_RETURN (-1);
+ return 0;
+ }
+ break;
+ case 0x0D: // End-of-Line handling
+ ch = (this->peek () == 0x0A ? this->get () : 0x0A);
+ // Fall thru...
+ default:
+ if (state == 1)
+ this->obstack_.grow ('?');
+ this->obstack_.grow (ch);
+ state = 0;
+ }
+ ch = this->get ();
+ }
+ return -1;
+}
+
+int
+ACEXML_Parser::parse_doctypedecl (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ if (this->get () != 'D' ||
+ this->get () != 'O' ||
+ this->get () != 'C' ||
+ this->get () != 'T' ||
+ this->get () != 'Y' ||
+ this->get () != 'P' ||
+ this->get () != 'E')
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Expecting 'DOCTYPE'"));
+ return -1;
+ }
+
+ ACEXML_Char nextch = this->skip_whitespace (0);
+ if (nextch == 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Expecting a DOCTYPE name"));
+ return -1;
+ }
+
+ // ACEXML_Char *doctype =
+ this->read_name (nextch);
+
+ nextch = this->skip_whitespace (0);
+
+ switch (nextch)
+ {
+ case '[': // Internal DTD definitionl
+ if (this->parse_internal_dtd (xmlenv) < 0)
+ return -1; // Error in markupdecl
+ break;
+ case 'S': // SYSTEM
+ case 'P': // PUBLIC
+ {
+ // Error: We don't handle either system or public ID yet.
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return -1;
+ }
+ break;
+ case '>': // No DTD definition
+ // this is an XML document without a dectypedecl.
+ return 0;
+ case '0':
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected EOF"));
+ return -1;
+ default:
+ break;
+ }
+
+ nextch = this->skip_whitespace (0);
+
+ switch (nextch)
+ {
+ case '>':
+ return 0; // all is fine now.
+ default:
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal error"));
+ return -1;
+ }
+ return 0;
+}
+
+void
+ACEXML_Parser::parse_element (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+{
+ // Parse STag.
+
+ const ACEXML_Char *startname = this->read_name ();
+
+ if (startname == 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected EOF"));
+ return;
+ }
+
+ const ACEXML_Char *endname = 0;
+ ACEXML_AttributesImpl attributes;
+ ACEXML_Char ch;
+ int new_namespace = 0;
+ const ACEXML_Char *ns_uri, *ns_lname; // namespace URI and localName
+
+ for (int start_element_done = 0; start_element_done == 0;)
+ {
+ ch = this->skip_whitespace (0);
+
+ switch (ch)
+ {
+ case 0:
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal error"));
+ return;
+
+ case '/':
+ if (this->get () != '>')
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Expectint '>'"));
+ return;
+ }
+ else
+ {
+ this->xml_namespace_.processName (startname, ns_uri, ns_lname, 0);
+ this->content_handler_->startElement (ns_uri,
+ ns_lname,
+ startname,
+ &attributes,
+ xmlenv);
+ ACEXML_CHECK;
+ this->content_handler_->endElement (ns_uri, ns_lname, startname, xmlenv);
+ ACEXML_CHECK;
+ }
+ if (new_namespace != 0)
+ this->xml_namespace_.popContext ();
+ return;
+
+ case '>':
+ this->xml_namespace_.processName (startname, ns_uri, ns_lname, 0);
+ this->content_handler_->startElement (ns_uri,
+ ns_lname,
+ startname,
+ &attributes,
+ xmlenv);
+ ACEXML_CHECK;
+ start_element_done = 1;
+ break;
+ default:
+ {
+ ACEXML_Char *attvalue = 0;
+ ACEXML_Char *attname = this->read_name (ch);
+
+ if (attname == 0 ||
+ this->skip_equal () != 0 ||
+ this->get_quoted_string (attvalue) != 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Error reading attribute"));
+ return;
+ }
+
+ // Handling new namespace if any. Notice that the order of namespace
+ // declaration does matter.
+ if (attname[0] == 'x' &&
+ attname[1] == 'm' &&
+ attname[2] == 'l' &&
+ attname[3] == 'n' &&
+ attname[4] == 's')
+ {
+ if (new_namespace == 0)
+ {
+ this->xml_namespace_.pushContext ();
+ new_namespace = 1;
+ }
+
+ ACE_Tokenizer ns_att (attname);
+ ns_att.delimiter_replace (':', 0);
+ ACEXML_Char *xmlns_prefix, *ns_name;
+
+ xmlns_prefix = ns_att.next ();
+ ns_name = ns_att.next ();
+
+ if (ns_name == 0)
+ {
+ // @@ Check return value?
+ this->xml_namespace_.declarePrefix (empty_string,
+ attvalue);
+ }
+ else
+ {
+ // @@ Check return value?
+ this->xml_namespace_.declarePrefix (ns_name,
+ attvalue);
+ }
+ }
+ else
+ {
+ const ACEXML_Char *uri, *lName;
+ this->xml_namespace_.processName (attname, uri, lName, 1);
+
+ attributes.addAttribute (uri,
+ lName,
+ attname,
+ default_attribute_type,
+ attvalue);
+ }
+ }
+ break;
+ }
+ }
+
+ ACEXML_Char *cdata;
+ size_t cdata_length = 0;
+
+ // Parse element contents.
+ while (1)
+ {
+ ch = this->get ();
+
+ switch (ch)
+ {
+ case 0:
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal error"));
+ return;
+
+ case '<':
+ // Push out old 'characters' event.
+ if (cdata_length != 0)
+ {
+ cdata = this->obstack_.freeze ();
+ this->content_handler_->characters (cdata,
+ 0,
+ cdata_length,
+ xmlenv);
+ ACEXML_CHECK;
+ cdata_length = 0;
+ }
+
+ switch (this->peek ())
+ {
+ case '!': // a comment or a CDATA section.
+ this->get (); // consume '!'
+ ch = this->peek ();
+ if (ch == '-') // a comment
+ {
+ if (this->grok_comment () < 0)
+ {
+ xmlenv.exception
+ (new ACEXML_SAXParseException ("Error parsing comment"));
+ return ;
+ }
+ }
+ else if (ch == '[') // a CDATA section.
+ {
+ this->parse_cdata (xmlenv);
+ ACEXML_CHECK;
+ }
+ else
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected character"));
+ return;
+ }
+ break;
+ case '?': // a PI.
+ this->parse_processing_instruction (xmlenv);
+ ACEXML_CHECK;
+ break;
+ case '/': // an ETag.
+ this->get (); // consume '/'
+ endname = this->read_name ();
+ if (endname == 0 ||
+ ACE_OS_String::strcmp (startname, endname) != 0)
+ {
+ xmlenv.exception
+ (new ACEXML_SAXParseException ("Mismatched End-tag encountered"));
+ return ;
+ }
+ if (this->skip_whitespace (0) != '>')
+ {
+ xmlenv.exception
+ (new ACEXML_SAXParseException ("Expecting '>' in an end-tag"));
+ return;
+ }
+ this->content_handler_->endElement (ns_uri,
+ ns_lname,
+ endname,
+ xmlenv);
+ ACEXML_CHECK;
+
+ if (new_namespace != 0)
+ this->xml_namespace_.popContext ();
+ return;
+
+ default: // a new nested element?
+ this->parse_element (xmlenv);
+ ACEXML_CHECK;
+ break;
+ }
+ break;
+ case '&':
+ {
+ const ACEXML_String *replace = 0;
+ ACEXML_String charval;
+ char buffer[6];
+
+ if (this->peek () == '#')
+ {
+ if (this->parse_char_reference (buffer, 6) != 0)
+ {
+ // not referring to any character exception?
+ return;
+ }
+ charval.set (buffer, 0);
+ replace = &charval;
+ }
+ else
+ replace = this->parse_reference ();
+
+ if (replace == 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal Error?"));
+ return;
+ }
+ if (this->try_grow_cdata (replace->length (), cdata_length, xmlenv) == 0)
+ {
+ cdata_length = replace->length ();
+ for (size_t i = 0; i < replace->length (); ++i)
+ this->obstack_.grow ((*replace)[i]);
+ }
+ else
+ return;
+ }
+ break;
+ case 0x0D: // End-of-Line handling
+ ch = (this->peek () == 0x0A ? this->get () : 0x0A);
+ // Fall thru...
+ default:
+ ++cdata_length;
+ cdata = this->obstack_.grow (ch);
+ if (cdata == 0)
+ {
+ cdata = this->obstack_.freeze ();
+ this->content_handler_->characters (cdata,
+ 0,
+ cdata_length,
+ xmlenv);
+ ACEXML_CHECK;
+ this->obstack_.grow (ch);
+ cdata_length = 1; // the missing char.
+ }
+ }
+ }
+
+}
+
+int
+ACEXML_Parser::parse_char_reference (ACEXML_Char *buf, size_t len)
+{
+ if (this->get () != '#')
+ {
+ // Internal error.
+ return -1;
+ }
+
+ int hex = 0;
+
+ if (this->peek () == 'x')
+ {
+ hex = 1;
+ this->get ();
+ }
+
+ int more_digit = 0;
+ ACEXML_UCS4 sum = 0;
+
+ while (1)
+ {
+ ACEXML_Char ch = this->get ();
+ switch (ch)
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ sum = sum * (hex ? 16 : 10) + (ch - '0');
+ break;
+ case 'a':
+ case 'A':
+ if (!hex)
+ return -1;
+ sum = sum * 16 + 10;
+ break;
+ case 'b':
+ case 'B':
+ if (!hex)
+ return -1;
+ sum = sum * 16 + 11;
+ break;
+ case 'c':
+ case 'C':
+ if (!hex)
+ return -1;
+ sum = sum * 16 + 12;
+ break;
+ case 'd':
+ case 'D':
+ if (!hex)
+ return -1;
+ sum = sum * 16 + 13;
+ break;
+ case 'e':
+ case 'E':
+ if (!hex)
+ return -1;
+ sum = sum * 16 + 14;
+ break;
+ case 'f':
+ case 'F':
+ if (!hex)
+ return -1;
+ sum = sum * 16 + 15;
+ break;
+ case ';':
+ if (more_digit == 0) // no digit exist???
+ return -1;
+ int clen;
+#if 1 // depending on what we default char we are using here
+ // we assume UTF-8 here
+ if ((clen = ACEXML_Transcoder::ucs42utf8 (sum, buf, len)) < 0)
+ return -1;
+#elif 1 // or UTF-16, currently disabled.
+ if ((clen = ACEXML_Transcoder::ucs42utf16 (sum, buf, len)) < 0)
+ return -1;
+#elif 0 // UCS 4, not likely
+ buf [0] = sum;
+ buf [1] = 0;
+#endif
+ buf [clen] = 0;
+ return 0;
+ default:
+ return -1;
+ }
+ more_digit = 1;
+ }
+ return -1;
+}
+
+const ACEXML_String *
+ACEXML_Parser::parse_reference (void)
+{
+ // @@ We'll use a temporary buffer here as the Obstack are most likely
+ // be in use when we come here. This put a limit on the max length of
+ // a reference.
+ ACEXML_Char ref[MAXPATHLEN];
+
+ size_t loc = 0;
+
+ while (loc < MAXPATHLEN -1)
+ {
+ ACEXML_Char ch = this->get ();
+ if (ch == ';')
+ {
+ ref[loc] = 0;
+ break;
+ }
+ else
+ ref[loc++] = ch;
+ }
+
+ return this->entities_.resolve_entity (ref);
+}
+
+int
+ACEXML_Parser::parse_cdata (ACEXML_Env &xmlenv)
+{
+ if (this->get () != '[' ||
+ this->get () != 'C' ||
+ this->get () != 'D' ||
+ this->get () != 'A' ||
+ this->get () != 'T' ||
+ this->get () != 'A' ||
+ this->get () != '[')
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("'[CDATA[' expected"));
+ return -1;
+ }
+
+ int parse_state = 0;
+ size_t datalen = 0;
+
+ while (1)
+ {
+ ACEXML_Char ch;
+ ACEXML_Char *cdata;
+
+ ch = this->get ();
+ // Anything goes except the sequence "]]>".
+ switch (parse_state)
+ {
+ case 2:
+ if (ch == ']')
+ {
+ parse_state = 3;
+ continue;
+ }
+ break;
+ case 3:
+ if (ch == '>') // Yay!
+ {
+ cdata = this->obstack_.freeze ();
+ this->content_handler_->characters (cdata,
+ 0,
+ datalen,
+ xmlenv);
+ // ACEXML_CHECK_RETURN (-1);
+ return 0;
+ }
+ break;
+ default:
+ if (ch == ']')
+ {
+ parse_state = 2;
+ continue;
+ }
+ else
+ parse_state = 1;
+ }
+ while (parse_state > 0)
+ {
+ if (this->try_grow_cdata (1, datalen, xmlenv) < 0)
+ return -1;
+
+ if (parse_state != 1)
+ this->obstack_.grow (']');
+ else
+ {
+ if (ch == 0x0D)
+ ch = (this->peek () == 0x0A ? this->get () : 0x0A);
+ this->obstack_.grow (ch);
+ }
+ ++datalen;
+ --parse_state;
+ }
+ };
+ ACE_NOTREACHED (return -1);
+}
+
+int
+ACEXML_Parser::try_grow_cdata (size_t size, size_t &len, ACEXML_Env &xmlenv)
+{
+ if (this->obstack_.request (size) != 0)
+ {
+ if (len != 0)
+ {
+ ACEXML_Char *cdata = this->obstack_.freeze ();
+ if (cdata == 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal Error growing CDATA buffer"));
+ return -1;
+ }
+ this->content_handler_->characters (cdata,
+ 0,
+ len,
+ xmlenv);
+ ACEXML_CHECK_RETURN (-1);
+ len = 0; // reset counter
+ if (this->obstack_.request (size) == 0)
+ return 0;
+ }
+
+ xmlenv.exception (new ACEXML_SAXParseException ("Internal error, buffer overflowed"));
+ return -1;
+ }
+ return 0;
+}
+
+int
+ACEXML_Parser::skip_equal (void)
+{
+ if (this->skip_whitespace (0) != '=')
+ return -1;
+
+ while (this->is_whitespace (this->peek ()))
+ this->get ();
+ return 0;
+}
+
+int
+ACEXML_Parser::get_quoted_string (ACEXML_Char *&str)
+{
+ ACEXML_Char quote = this->get ();
+ if (quote != '\'' && quote != '"') // Not a quoted string found.
+ return -1;
+
+ while (1)
+ {
+ ACEXML_Char ch = this->get ();
+
+ // @@ Deoes not handle buffer overflow yet.
+ if (ch == quote)
+ {
+ str = this->obstack_.freeze ();
+ return 0;
+ }
+
+ const ACEXML_String *replace = 0;
+ ACEXML_String charval;
+ char buffer[6];
+ size_t i = 0;
+
+ switch (ch)
+ {
+ case '&':
+
+ if (this->peek () == '#')
+ {
+ if (this->parse_char_reference (buffer, 6) != 0)
+ {
+ // xmlenv.exception (new ACEXML_SAXParseException ("CharRef does not resolves to a valid character"));
+ return -1;
+ }
+ charval.set (buffer, 0);
+ replace = &charval;
+ }
+ else
+ replace = this->parse_reference ();
+
+ if (replace == 0)
+ {
+ // xmlenv.exception (new ACEXML_SAXParseException ("Undefined reference"));
+ return -1;
+ }
+ for (i = 0; i < replace->length (); ++i)
+ this->obstack_.grow ((*replace)[i]);
+ // handle reference here.
+ break;
+ case 0x0D: // End-of-Line handling
+ ch = (this->peek () == 0x0A ? this->get () : 0x0A);
+ // Fall thru...
+ default:
+ this->obstack_.grow (ch);
+ break;
+ }
+ }
+}
+
+int
+ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv)
+{
+ ACEXML_Char nextch = this->get ();
+
+ do {
+ switch (nextch)
+ {
+ case '<': // Start of markup Decl.
+ nextch = this->peek ();
+ switch (nextch)
+ {
+ case '!':
+ this->get (); // Discard '!'
+ nextch = this->peek ();
+ switch (nextch)
+ {
+ case 'E': // An ELEMENT or ENTITY decl
+ this->get ();
+ nextch = this->peek ();
+ switch (nextch)
+ {
+ case 'L':
+ if (this->parse_element_decl (xmlenv) < 0)
+ return -1;
+ break;
+
+ case 'N':
+ if (this->parse_entity_decl (xmlenv) < 0)
+ return -1;
+ break;
+
+ default:
+ xmlenv.exception (new ACEXML_SAXParseException ("Invalid decl spec"));
+ return -1;
+ }
+ break;
+
+ case 'A': // An ATTLIST decl
+ if (this->parse_attlist_decl (xmlenv) < 0)
+ return -1;
+ break;
+
+ case 'N': // A NOTATION decl
+ if (this->parse_notation_decl (xmlenv) < 0)
+ return -1;
+ break;
+
+ case '-': // a comment.
+ if (this->grok_comment () < 0)
+ {
+ xmlenv.exception (new ACEXML_SAXParseException ("Error parsing comment"));
+ return -1;
+ }
+ break;
+ case 0:
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected EOF"));
+ return -1;
+ default:
+ xmlenv.exception (new ACEXML_SAXParseException ("Invalid char. follows '<!' in markupdecl"));
+ return -1;
+ }
+ break;
+
+ case '?': // PI
+ this->parse_processing_instruction (xmlenv);
+ ACEXML_CHECK_RETURN (-1);
+ break;
+
+ case 0:
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected EOF"));
+ return -1;
+
+ default:
+ xmlenv.exception (new ACEXML_SAXParseException ("Invalid char. follow '<' in markupdecl"));
+ return -1;
+ }
+ break;
+
+ case '%': // DeclSep.
+ break;
+
+ case ']': // End of internal definitions.
+ return 0;
+
+ case 0:
+ xmlenv.exception (new ACEXML_SAXParseException ("Unexpected EOF"));
+ return -1;
+
+ default:
+ xmlenv.exception (new ACEXML_SAXParseException ("Expecting markupdecl or DecSep"));
+ return -1;
+ };
+
+ // To fully conform with the spec., whitespaces are only allowed
+ // following a 'DeclSep' section. However, I found it
+ // hard/impossible to eliminate all the whitespaces between
+ // markupdecls.
+
+ nextch = this->skip_whitespace (0);
+
+ } while (1);
+
+ ACE_NOTREACHED (return -1;)
+}
+
+int
+ACEXML_Parser::parse_element_decl (ACEXML_Env &xmlenv)
+{
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return -1;
+}
+
+int
+ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv)
+{
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return -1;
+}
+
+int
+ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv)
+{
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return -1;
+}
+
+int
+ACEXML_Parser::parse_notation_decl (ACEXML_Env &xmlenv)
+{
+ xmlenv.exception (new ACEXML_SAXNotSupportedException ());
+ return -1;
+}
diff --git a/ACEXML/parser/parser/Parser.dsp b/ACEXML/parser/parser/Parser.dsp
new file mode 100644
index 00000000000..ac4573b8429
--- /dev/null
+++ b/ACEXML/parser/parser/Parser.dsp
@@ -0,0 +1,123 @@
+# Microsoft Developer Studio Project File - Name="ACEXML_Parser" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ACEXML_Parser - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Parser.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Parser.mak" CFG="ACEXML_Parser - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ACEXML_Parser - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ACEXML_Parser - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ACEXML_Parser - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACEXML_PARSER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACEXML_PARSER_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 ace.lib ACEXML.lib /nologo /dll /machine:I386 /out:"../../../bin/Release/ACEXML_Parser.dll" /libpath:"../../../ace" /libpath:"../../Common"
+
+!ELSEIF "$(CFG)" == "ACEXML_Parser - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACEXML_PARSER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACEXML_PARSER_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACEXMLd.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/ACEXML_Parserd.dll" /pdbtype:sept /libpath:"../../../ace" /libpath:"../../Common"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ACEXML_Parser - Win32 Release"
+# Name "ACEXML_Parser - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Entity_Manager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Parser.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Entity_Manager.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Parser.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Parser_export.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/ACEXML/parser/parser/Parser.dsw b/ACEXML/parser/parser/Parser.dsw
new file mode 100644
index 00000000000..c2e1b8458e6
--- /dev/null
+++ b/ACEXML/parser/parser/Parser.dsw
@@ -0,0 +1,28 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Parser"=.\Parser.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
diff --git a/ACEXML/parser/parser/Parser.h b/ACEXML/parser/parser/Parser.h
new file mode 100644
index 00000000000..dccf43f9465
--- /dev/null
+++ b/ACEXML/parser/parser/Parser.h
@@ -0,0 +1,285 @@
+// -*- C++ -*- $Id$
+
+#ifndef _ACEXML_BASIC_PARSER_H_
+#define _ACEXML_BASIC_PARSER_H_
+
+#include "Common/XMLReader.h"
+#include "Common/LocatorImpl.h"
+#include "Common/NamespaceSupport.h"
+#include "Common/CharStream.h"
+#include "Parser_export.h"
+#include "ace/Obstack.h"
+#include "ace/Functor.h"
+#include "ace/SString.h"
+#include "ace/Hash_Map_Manager.h"
+#include "ace/Containers_T.h"
+#include "Entity_Manager.h"
+
+typedef ACE_Hash_Map_Entry<ACEXML_String,
+ ACEXML_String> ACEXML_ENTITY_ENTRY;
+
+typedef ACE_Hash_Map_Manager_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER;
+
+typedef ACE_Hash_Map_Iterator_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_ITER;
+
+typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String,
+ ACEXML_String,
+ ACE_Hash<ACEXML_String>,
+ ACE_Equal_To<ACEXML_String>,
+ ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_REVERSE_ITER;
+
+class ACEXML_PARSER_Export ACEXML_Parser : public ACEXML_XMLReader
+{
+public:
+ /// Default constructor.
+ ACEXML_Parser (void);
+
+ /// Destructor.
+ virtual ~ACEXML_Parser (void);
+
+ /*
+ * Return the current content handler.
+ */
+ virtual ACEXML_ContentHandler *getContentHandler (void) const;
+
+ /*
+ * Return the current DTD handler.
+ */
+ virtual ACEXML_DTDHandler *getDTDHandler (void) const;
+
+ /*
+ * Return the current entity resolver.
+ */
+ virtual ACEXML_EntityResolver *getEntityResolver (void) const;
+
+ /*
+ * Return the current error handler.
+ */
+ virtual ACEXML_ErrorHandler *getErrorHandler (void) const;
+
+ /*
+ * Look up the value of a feature.
+ */
+ virtual int getFeature (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Look up the value of a property.
+ */
+ virtual void * getProperty (const ACEXML_Char *name,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Parse an XML document.
+ */
+ virtual void parse (ACEXML_InputSource *input,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Parse an XML document from a system identifier (URI).
+ */
+ virtual void parse (const ACEXML_Char *systemId,
+ ACEXML_Env &xmlenv)
+ // @@ throw IOException???
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /*
+ * Allow an application to register a content event handler.
+ */
+ virtual void setContentHandler (ACEXML_ContentHandler *handler);
+
+ /*
+ * Allow an application to register a DTD event handler.
+ */
+ virtual void setDTDHandler (ACEXML_DTDHandler *handler);
+
+ /*
+ * Allow an application to register an entity resolver.
+ */
+ virtual void setEntityResolver (ACEXML_EntityResolver *resolver);
+
+ /*
+ * Allow an application to register an error event handler.
+ */
+ virtual void setErrorHandler (ACEXML_ErrorHandler *handler);
+
+ /*
+ * Set the state of a feature.
+ */
+ virtual void setFeature (const ACEXML_Char *name,
+ int boolean_value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ /*
+ * Set the value of a property.
+ */
+ virtual void setProperty (const ACEXML_Char *name,
+ void *value,
+ ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
+ // ACEXML_SAXNotSupportedException))
+ ;
+
+ // *** 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.
+ ACEXML_Char skip_whitespace (ACEXML_Char **whitespace);
+
+ /// Return 1 if @a c is a valid white space character. Otherwise,
+ /// return 0.
+ int is_whitespace (ACEXML_Char c);
+ int is_whitespace_or_equal (ACEXML_Char c);
+ int is_nonname (ACEXML_Char c);
+
+ /// Skip an equal sign. Return 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.
+ 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.
+ int parse_processing_instruction (ACEXML_Env &xmlenv);
+
+ /// Filter out 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.
+ ACEXML_Char *read_name (ACEXML_Char ch = 0);
+
+ /// 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".
+ void parse_element (ACEXML_Env &xmlenv)
+ // ACE_THROW_SPEC ((ACEXML_SAXException))
+ ;
+
+ /// Parse XML Prolog.
+ void parse_xml_prolog (ACEXML_Env &xmlenv);
+
+ /// Parse a character reference, i.e., "&#x20;" or "&#30;". 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.
+ int parse_char_reference (ACEXML_Char *buf, size_t len);
+
+ /// Parse an entity reference, i.e., "&amp;". Return a pointer to
+ /// the resolved const ACEXML_String if success (previously
+ /// defined), 0 otherwise. The first character encountered should be
+ /// the character following '&'.
+ 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.
+ int parse_cdata (ACEXML_Env &xmlenv);
+
+ /// 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".
+ 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".
+ 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".
+ 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".
+ int parse_notation_decl (ACEXML_Env &xmlenv);
+
+ /// 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.
+ 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.
+ int check_exception (ACEXML_Env &xmlenv);
+
+ /// Keeping track of the handlers. We do not manage
+ /// the memory for handlers.
+ ACEXML_DTDHandler *dtd_handler_;
+ ACEXML_EntityResolver *entity_resolver_;
+ ACEXML_ContentHandler *content_handler_;
+ ACEXML_ErrorHandler *error_handler_;
+
+ /// @@ Feature and properties management structure here.
+ // Current input char stream.
+ ACEXML_CharStream *instream_;
+
+ ACE_Obstack_T<ACEXML_Char> obstack_;
+
+ ACEXML_NamespaceSupport xml_namespace_;
+
+ ACEXML_Entity_Manager entities_;
+
+ // Locator
+ ACEXML_LocatorImpl locator_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Parser.i"
+#endif /* __ACEXML_INLINE__ */
+#endif /* _ACEXML_BASIC_PARSER_H_ */
diff --git a/ACEXML/parser/parser/Parser.i b/ACEXML/parser/parser/Parser.i
new file mode 100644
index 00000000000..562923e11c7
--- /dev/null
+++ b/ACEXML/parser/parser/Parser.i
@@ -0,0 +1,128 @@
+// $Id$
+
+ACEXML_INLINE ACEXML_ContentHandler *
+ACEXML_Parser::getContentHandler (void) const
+{
+ return this->content_handler_;
+}
+
+ACEXML_INLINE ACEXML_DTDHandler *
+ACEXML_Parser::getDTDHandler (void) const
+{
+ return this->dtd_handler_;
+}
+
+ACEXML_INLINE ACEXML_EntityResolver *
+ACEXML_Parser::getEntityResolver (void) const
+{
+ return this->entity_resolver_;
+}
+
+ACEXML_INLINE ACEXML_ErrorHandler *
+ACEXML_Parser::getErrorHandler (void) const
+{
+ return this->error_handler_;
+}
+
+ACEXML_INLINE void
+ACEXML_Parser::setContentHandler (ACEXML_ContentHandler *handler)
+{
+ this->content_handler_ = handler;
+}
+
+ACEXML_INLINE void
+ACEXML_Parser::setDTDHandler (ACEXML_DTDHandler *handler)
+{
+ this->dtd_handler_ = handler;
+}
+
+ACEXML_INLINE void
+ACEXML_Parser::setEntityResolver (ACEXML_EntityResolver *resolver)
+{
+ this->entity_resolver_ = resolver;
+}
+
+ACEXML_INLINE void
+ACEXML_Parser::setErrorHandler (ACEXML_ErrorHandler *handler)
+{
+ this->error_handler_ = handler;
+}
+
+ACEXML_INLINE int
+ACEXML_Parser::is_whitespace (ACEXML_Char c)
+{
+ switch (c)
+ {
+ case 0x20:
+ case 0x9:
+ case 0xd:
+ case 0xa:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+ACEXML_INLINE int
+ACEXML_Parser::is_whitespace_or_equal (ACEXML_Char c)
+{
+ switch (c)
+ {
+ case 0x20:
+ case 0x9:
+ case 0xd:
+ case 0xa:
+ case '=':
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+ACEXML_INLINE int
+ACEXML_Parser::is_nonname (ACEXML_Char c)
+{
+ switch (c)
+ {
+ case 0x20:
+ case 0x9:
+ case 0xd:
+ case 0xa:
+ case '=':
+ case '/':
+ case '?':
+ case '>':
+ case '<':
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+ACEXML_INLINE ACEXML_Char
+ACEXML_Parser::get (void)
+{
+ // Using an extra level of indirection so we can
+ // manage document location in the future.
+
+ if (this->instream_ != 0)
+ {
+ ACEXML_Char ch;
+ this->instream_->get (ch);
+ return ch;
+ }
+ return 0;
+}
+
+ACEXML_INLINE ACEXML_Char
+ACEXML_Parser::peek (void)
+{
+ // Using an extra level of indirection so we can
+ // manage document location in the future.
+
+ if (this->instream_ != 0)
+ return this->instream_->peek ();
+ return 0;
+
+}
diff --git a/ChangeLog b/ChangeLog
index 4ad4174d7ea..7791c98cdc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Nov 15 11:11:14 2001 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * XML/*: Merged in XML parser workspace.
+
Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/Makefile: Added String_Base into the list of template
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 4ad4174d7ea..7791c98cdc2 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,7 @@
+Thu Nov 15 11:11:14 2001 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * XML/*: Merged in XML parser workspace.
+
Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/Makefile: Added String_Base into the list of template
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 4ad4174d7ea..7791c98cdc2 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,7 @@
+Thu Nov 15 11:11:14 2001 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * XML/*: Merged in XML parser workspace.
+
Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/Makefile: Added String_Base into the list of template