summaryrefslogtreecommitdiff
path: root/ACEXML/common
diff options
context:
space:
mode:
Diffstat (limited to 'ACEXML/common')
-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
45 files changed, 4610 insertions, 0 deletions
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_ */