diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a3e395d..c59c3b4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,7 +196,6 @@ set(PUBLIC_HEADER_FILES include/SAX/helpers/InputSourceResolver.hpp include/SAX/helpers/LocatorImpl.hpp include/SAX/helpers/NamespaceSupport.hpp - include/SAX/helpers/PropertyNames.hpp include/SAX/helpers/XMLBaseSupport.hpp include/SAX/helpers/XMLFilterImpl.hpp include/SAX/parsers/saxgarden.hpp diff --git a/examples/SAX/wrapper.cpp b/examples/SAX/wrapper.cpp index 628fe172..60272dfb 100644 --- a/examples/SAX/wrapper.cpp +++ b/examples/SAX/wrapper.cpp @@ -5,7 +5,6 @@ #include "SimpleHandler.hpp" #include #include -#include #include #include @@ -20,7 +19,6 @@ int main(int argc, char* argv[]) SimpleHandler myHandler; Arabica::SAX::FeatureNames fNames; - Arabica::SAX::PropertyNames pNames; for(int i = 1; i < argc; ++i) { diff --git a/include/DOM/SAX2DOM/SAX2DOM.hpp b/include/DOM/SAX2DOM/SAX2DOM.hpp index 229b79fc..19152c95 100644 --- a/include/DOM/SAX2DOM/SAX2DOM.hpp +++ b/include/DOM/SAX2DOM/SAX2DOM.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include namespace Arabica @@ -97,8 +96,6 @@ class Parser : protected Arabica::SAX::DefaultHandler pNames; - DOM::DOMImplementation di = Arabica::SimpleDOM::DOMImplementation::getDOMImplementation(); document_ = di.createDocument(string_adaptorT::construct_from_utf8(""), string_adaptorT::construct_from_utf8(""), 0); currentNode_ = document_; diff --git a/include/Makefile.am b/include/Makefile.am index 4e314711..bbe5a96b 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -42,7 +42,6 @@ sax_headers = SAX/SAXParseException.hpp \ SAX/helpers/LocatorImpl.hpp \ SAX/helpers/NamespaceSupport.hpp \ SAX/helpers/XMLFilterImpl.hpp \ - SAX/helpers/PropertyNames.hpp \ SAX/helpers/AttributesImpl.hpp \ SAX/helpers/DefaultHandler.hpp \ SAX/helpers/InputSourceResolver.hpp \ diff --git a/include/SAX/ArabicaConfig.hpp.in b/include/SAX/ArabicaConfig.hpp.in index 1934dc60..f7717a86 100644 --- a/include/SAX/ArabicaConfig.hpp.in +++ b/include/SAX/ArabicaConfig.hpp.in @@ -1,12 +1,94 @@ -#ifndef ARABICA_ARABICA_CONFIG_H -#define ARABICA_ARABICA_CONFIG_H - -#cmakedefine ARABICA_NO_WCHAR_T -#cmakedefine ARABICA_VS6_WORKAROUND -#cmakedefine ARABICA_NO_CODECVT_SPECIALISATIONS -#cmakedefine ARABICA_USE_WINSOCK -#cmakedefine ARABICA_WINDOWS -#cmakedefine ARABICA_HAVE_BOOST -#define ARABICA_@ARABICA_XML_BACKEND@ - -#endif // ARABICA_ARABICA_CONFIG_H +/* include/SAX/ArabicaConfig.hpp.in. Generated from configure.ac by autoheader. */ + +/* define if the Boost library is available */ +#undef HAVE_BOOST + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* define to use the Elephant memory leak detector */ +#undef HAVE_ELEPHANT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* defined if we don't need extra codecvt template specialisations */ +#undef NO_CODECVT_SPECIALISATIONS + +/* no mbstate_t */ +#undef NO_MBSTATE_T + +/* no std::mbstate_t */ +#undef NO_STD_MBSTATE_T + +/* disables wchar_t */ +#undef NO_WCHAR_T + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* define to build against Expat */ +#define USE_EXPAT + +/* define to build using Garden */ +#undef USE_GARDEN + +/* define to build against LibXML2 */ +#undef USE_LIBXML2 + +/* defined for Windows builds using Winsock rather than BSD-style sockets */ +#undef USE_WINSOCK + +/* define to build against Xerces */ +#undef USE_XERCES + +/* Version number of package */ +#undef VERSION diff --git a/include/SAX/XMLReader.hpp b/include/SAX/XMLReader.hpp index 159d096d..e7376c9d 100644 --- a/include/SAX/XMLReader.hpp +++ b/include/SAX/XMLReader.hpp @@ -336,106 +336,6 @@ public: * @see #setErrorHandler */ virtual void parse(InputSourceT& input) = 0; - - //////////////////////////////////////////////////// - // property implementation -protected: - class PropertyBase - { - public: - virtual ~PropertyBase() { } - }; // PropertyBase - - template - class Property : public PropertyBase - { - public: - Property(propertyTypeT wrappee) : wrappee_(wrappee) { } - - propertyTypeT get() { return wrappee_; } - - private: - propertyTypeT wrappee_; - }; // class Property - -public: - virtual std::auto_ptr doGetProperty(const string_type& name) = 0; - virtual void doSetProperty(const string_type& name, std::auto_ptr value) = 0; - - /** - * Look up the value of a property. - * - *

The property name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a property name but - * to be unable to return its state; this is especially true - * in the case of an adapter for a SAX1 {@link Parser - * Parser}.

- * - *

XMLReaders are not required to recognize any specific - * property names, though an initial core set is documented for - * SAX2.

- * - *

Some property values may be available only in specific - * contexts, such as before, during, or after a parse.

- * - *

Implementors are free (and encouraged) to invent their own properties, - * using names built on their own URIs.

- * - * @param name The property name, which is a fully-qualified URI. - * @return The current value of the property. - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the property name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the property name but - * cannot determine its value at this time. - * @see #setProperty - */ - template - propertyTypeT& getProperty(const string_type& name) const - { - std::auto_ptr pb = doGetProperty(name); - Property* prop = dynamic_cast* >(pb.get()); - - if(!prop) - throw SAX::SAXNotSupportedException("Property " + name + " is wrong type."); - - return prop->get(); - } // getProperty - - /** - * Set the value of a property. - * - *

The property name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a property name but - * to be unable to set its value; this is especially true - * in the case of an adapter for a SAX1 {@link Parser - * Parser}.

- * - *

XMLReaders are not required to recognize setting - * any specific property names, though a core set is provided with - * SAX2.

- * - *

Some property values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.

- * - *

This method is also the standard mechanism for setting - * extended handlers.

- * - * @param name The property name, which is a fully-qualified URI. - * @param value The requested value for the property. - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the property name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the property name but - * cannot set the requested value. - */ - template - void setProperty(const string_type& name, propertyTypeT& value) - { - Property* prop = new Property(value); - doSetProperty(name, std::auto_ptr(prop)); - } // setProperty }; // class XMLReaderInterface } // namespace SAX diff --git a/include/SAX/ext/DeclHandler.hpp b/include/SAX/ext/DeclHandler.hpp index 29125a91..6f433de6 100644 --- a/include/SAX/ext/DeclHandler.hpp +++ b/include/SAX/ext/DeclHandler.hpp @@ -31,13 +31,7 @@ namespace SAX * {@link LexicalHandler#endDTD endDTD} events.

* *

To set the DeclHandler for an XML reader, use the - * {@link XMLReader#setProperty setProperty} method - * with the propertyId "http://xml.org/sax/properties/declaration-handler". - * If the reader does not support declaration events, it will throw a - * {@link SAXNotRecognizedException SAXNotRecognizedException} - * or a - * {@link SAXNotSupportedException SAXNotSupportedException} - * when you attempt to register the handler.

+ * {@link XMLReader#setDeclHandler setDeclHandler}.

* * @since 2.0 * @author Jez Higgins, diff --git a/include/SAX/ext/LexicalHandler.hpp b/include/SAX/ext/LexicalHandler.hpp index 3e57576a..a5feb254 100644 --- a/include/SAX/ext/LexicalHandler.hpp +++ b/include/SAX/ext/LexicalHandler.hpp @@ -28,21 +28,13 @@ namespace SAX * endDocument events.

* *

To set the LexicalHandler for an XML reader, use the - * {@link XMLReader#setProperty setProperty} method - * with the propertyId "http://xml.org/sax/properties/lexical-handler". - * If the reader does not support lexical events, it will throw a - * {@link SAXNotRecognizedException SAXNotRecognizedException} - * or a - * {@link SAXNotSupportedException SAXNotSupportedException} - * when you attempt to register the handler.

+ * {@link XMLReader#setLexicalHandler setLexicalHandler} method.

* * @since 2.0 * @author Jez Higgins, * jez@jezuk.co.uk * @version 1.0 - * @see XMLReader#setProperty - * @see SAXNotRecognizedException - * @see SAXNotSupportedException + * @see XMLReader#setLexicalHandler */ template > class LexicalHandler diff --git a/include/SAX/filter/Writer.hpp b/include/SAX/filter/Writer.hpp index aab435e8..213f080c 100644 --- a/include/SAX/filter/Writer.hpp +++ b/include/SAX/filter/Writer.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -42,7 +41,6 @@ class Writer : public XMLFilterImpl typedef LexicalHandler LexicalHandlerT; typedef DeclHandler DeclHandlerT; typedef typename XMLReaderT::InputSourceT InputSourceT; - typedef typename XMLReaderT::PropertyBase PropertyBaseT; using XMLFilterT::getParent; public: @@ -167,8 +165,6 @@ class Writer : public XMLFilterImpl ostreamT* stream_; string_type encoding_; enum { startTag, endTag, docTag } lastTag_; - const SAX::PropertyNames properties_; - }; // class Writer template diff --git a/include/SAX/helpers/PropertyNames.hpp b/include/SAX/helpers/PropertyNames.hpp deleted file mode 100644 index 2d1f0d9a..00000000 --- a/include/SAX/helpers/PropertyNames.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef ARABICA_PROPERTY_NAMES_H -#define ARABICA_PROPERTY_NAMES_H -/* - * $Id$ - */ - -#include -#include -#include - -namespace Arabica -{ -namespace SAX -{ - -/** The core SAX 2 parser properties. */ -template > -struct PropertyNames -{ - /** @name SAX 2 Properties - * @{ */ - /** Register a lexical handler. - * - * The Lexical Handler is used to see some syntax events that are essential - * in some applications: comments, CDATA delimiters, selected general - * entity inclusions, and the start and end of the DTD (and declaration of - * document element name). - * - * The value assigned must implement SAX::LexicalHandler. - */ - const string_type lexicalHandler; - /** Register a Declaration Handler. - * - * Used to see most DTD declarations except those treated as lexical - * ("document element name is ...") or which are mandatory for all SAX - * parsers (DTDHandler). - * - * The value assigned must implement SAX::DeclHandler */ - const string_type declHandler; - /** @} */ - - PropertyNames() : - lexicalHandler(string_adaptor_type::construct_from_utf8("http://xml.org/sax/handlers/LexicalHandler")), - declHandler(string_adaptor_type::construct_from_utf8("http://xml.org/sax/handlers/DeclHandler")) - { - } // PropertyNames -}; // struct PropertyNames - -} // namespace SAX -} // namespace Arabica - -#endif -// end of file diff --git a/include/SAX/helpers/XMLFilterImpl.hpp b/include/SAX/helpers/XMLFilterImpl.hpp index 98abec27..b605b122 100644 --- a/include/SAX/helpers/XMLFilterImpl.hpp +++ b/include/SAX/helpers/XMLFilterImpl.hpp @@ -223,29 +223,6 @@ public: parent_->parse(input); } // parse - virtual std::auto_ptr doGetProperty(const string_type& name) - { - if(parent_) - return parent_->doGetProperty(name); - - string_type ex = string_adaptor::construct_from_utf8("Property: "); - string_adaptor::append(ex, name); - throw SAXNotRecognizedException(string_adaptor::asStdString(ex)); - } // doGetProperty - - virtual void doSetProperty(const string_type& name, typename std::auto_ptr value) - { - if(parent_) - { - parent_->doSetProperty(name, value); - return; - } // if(parent_) - - string_type ex = string_adaptor::construct_from_utf8("Property: "); - string_adaptor::append(ex, name); - throw SAXNotRecognizedException(string_adaptor::asStdString(ex)); - } // doSetProperty - public: ////////////////////////////////////////////////// // EntityResolver diff --git a/include/SAX/parsers/saxgarden.hpp b/include/SAX/parsers/saxgarden.hpp index 3708bb42..ae1b5197 100644 --- a/include/SAX/parsers/saxgarden.hpp +++ b/include/SAX/parsers/saxgarden.hpp @@ -48,7 +48,6 @@ public: typedef ErrorHandler ErrorHandlerT; typedef DeclHandler declHandlerT; typedef LexicalHandler lexicalHandlerT; - typedef typename XMLReaderT::PropertyBase PropertyBaseT; Garden(); @@ -70,9 +69,6 @@ public: virtual void parse(InputSourceT& input); - virtual std::auto_ptr doGetProperty(const string_type& name); - virtual void doSetProperty(const string_type& name, std::auto_ptr value); - private: void reportError(const std::string& message, bool fatal = false); @@ -256,20 +252,6 @@ void Garden::setFeature(const string_type& name, bool value throw SAXNotRecognizedException(string_adaptor::asStdString(name)); } // setFeature -/////////////////////////////////////// -// properties -template -std::auto_ptr::PropertyBaseT> Garden::doGetProperty(const string_type& name) -{ - throw SAXNotRecognizedException(string_adaptor::asStdString(name)); -} // doGetProperty - -template -void Garden::doSetProperty(const string_type& name, std::auto_ptr value) -{ - throw SAXNotRecognizedException(string_adaptor::asStdString(name)); -} // doSetProperty - ////////////////////////////////////////// // parse template diff --git a/include/SAX/wrappers/XercesPropertyNames.hpp b/include/SAX/wrappers/XercesPropertyNames.hpp index 1e9b864a..96a82b39 100644 --- a/include/SAX/wrappers/XercesPropertyNames.hpp +++ b/include/SAX/wrappers/XercesPropertyNames.hpp @@ -5,7 +5,6 @@ */ #include -#include namespace Arabica { @@ -13,8 +12,7 @@ namespace SAX { template > - struct XercesPropertyNames : public PropertyNames + struct XercesPropertyNames { /** \name Xerces properties. * @{ */ diff --git a/include/SAX/wrappers/saxexpat.hpp b/include/SAX/wrappers/saxexpat.hpp index ea8a4cd2..a7955500 100644 --- a/include/SAX/wrappers/saxexpat.hpp +++ b/include/SAX/wrappers/saxexpat.hpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -226,11 +225,6 @@ class expat_wrapper : typedef SAX::NamespaceSupport namespaceSupportT; typedef SAX::ErrorHandler errorHandlerT; typedef SAX::SAXParseException SAXParseExceptionT; - typedef typename XMLReaderT::PropertyBase PropertyBaseT; - typedef typename XMLReaderT::template Property getLexicalHandlerT; - typedef typename XMLReaderT::template Property setLexicalHandlerT; - typedef typename XMLReaderT::template Property getDeclHandlerT; - typedef typename XMLReaderT::template Property setDeclHandlerT; typedef XML::QualifiedName qualifiedNameT; expat_wrapper(); @@ -270,11 +264,6 @@ class expat_wrapper : virtual size_t getLineNumber() const; virtual size_t getColumnNumber() const; - /////////////////////////////////////////////////// - // properties - protected: - virtual std::auto_ptr doGetProperty(const string_type& name); - virtual void doSetProperty(const string_type& name, std::auto_ptr value); private: qualifiedNameT processName(const string_type& qName, bool isAttribute); void reportError(const std::string& message, bool fatal = false); @@ -347,7 +336,6 @@ class expat_wrapper : string_type emptyString_; const SAX::FeatureNames features_; - const SAX::PropertyNames properties_; const SAX::NamespaceConstants nsc_; const SAX::AttributeDefaults attrDefaults_; @@ -520,52 +508,6 @@ bool expat_wrapper::do_parse(inputSourceT& source, XML_Pars return true; } // do_parse -template -std::auto_ptr::PropertyBaseT> expat_wrapper::doGetProperty(const string_type& name) -{ - if(name == properties_.lexicalHandler) - { - getLexicalHandlerT* prop = new getLexicalHandlerT(lexicalHandler_); - return std::auto_ptr(prop); - } - if(name == properties_.declHandler) - { - getDeclHandlerT* prop = new getDeclHandlerT(declHandler_); - return std::auto_ptr(prop); - } - - throw SAX::SAXNotRecognizedException(std::string("Property not recognized ") + SA::asStdString(name)); -} // doGetProperty - -template -void expat_wrapper::doSetProperty(const string_type& name, std::auto_ptr value) -{ - if(name == properties_.lexicalHandler) - { - setLexicalHandlerT* prop = dynamic_cast(value.get()); - - if(!prop) - throw std::bad_cast(); - - lexicalHandler_ = &(prop->get()); - } - else if(name == properties_.declHandler) - { - setDeclHandlerT* prop = dynamic_cast(value.get()); - - if(!prop) - throw std::bad_cast(); - - declHandler_ = &(prop->get()); - } - else - { - std::ostringstream os; - os << "Property not recognized " << SA::asStdString(name); - throw SAX::SAXNotRecognizedException(os.str()); - } -} // doSetProperty - // Locator implementation template string_type expat_wrapper::getPublicId() const diff --git a/include/SAX/wrappers/saxlibxml2.hpp b/include/SAX/wrappers/saxlibxml2.hpp index 76072d83..b693b52e 100644 --- a/include/SAX/wrappers/saxlibxml2.hpp +++ b/include/SAX/wrappers/saxlibxml2.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -145,11 +144,6 @@ class libxml2_wrapper : typedef SAX::NamespaceSupport namespaceSupportT; typedef SAX::ErrorHandler errorHandlerT; typedef SAX::SAXParseException SAXParseExceptionT; - typedef typename XMLReaderT::PropertyBase PropertyBaseT; - typedef typename XMLReaderT::template Property getLexicalHandlerT; - typedef typename XMLReaderT::template Property setLexicalHandlerT; - typedef typename XMLReaderT::template Property getDeclHandlerT; - typedef typename XMLReaderT::template Property setDeclHandlerT; typedef XML::QualifiedName qualifiedNameT; libxml2_wrapper(); @@ -179,12 +173,6 @@ class libxml2_wrapper : // parsing virtual void parse(inputSourceT& source); - protected: - //////////////////////////////////////////////// - // properties - virtual std::auto_ptr doGetProperty(const string_type& name); - virtual void doSetProperty(const string_type& name, std::auto_ptr value); - public: virtual string_type getPublicId() const; virtual string_type getSystemId() const; @@ -245,7 +233,6 @@ class libxml2_wrapper : string_type emptyString_; const FeatureNames features_; - const PropertyNames properties_; const NamespaceConstants nsc_; const AttributeDefaults attrDefaults_; const AttributeTypes attrTypes_; @@ -354,48 +341,6 @@ void libxml2_wrapper::setFeature(const string_type& name, b } } // setFeature -template -std::auto_ptr::PropertyBaseT> libxml2_wrapper::doGetProperty(const string_type& name) -{ - if(name == properties_.declHandler) - { - getDeclHandlerT* prop = new getDeclHandlerT(declHandler_); - return std::auto_ptr(prop); - } - if(name == properties_.lexicalHandler) - { - getLexicalHandlerT* prop = new getLexicalHandlerT(lexicalHandler_); - return std::auto_ptr(prop); - } - - throw SAX::SAXNotRecognizedException(std::string("Property not recognized ") + string_adaptor::asStdString(name)); -} // doGetProperty - -template -void libxml2_wrapper::doSetProperty(const string_type& name, std::auto_ptr value) -{ - if(name == properties_.declHandler) - { - setDeclHandlerT* prop = dynamic_cast(value.get()); - - if(!prop) - throw std::bad_cast(); - - declHandler_ = &(prop->get()); - } - if(name == properties_.lexicalHandler) - { - setLexicalHandlerT* prop = dynamic_cast(value.get()); - - if(!prop) - throw std::bad_cast(); - - lexicalHandler_ = &(prop->get()); - } - - throw SAX::SAXNotRecognizedException(std::string("Property not recognized ") + string_adaptor::asStdString(name)); -} // doSetProperty - template typename XML::QualifiedName::string_adaptor> libxml2_wrapper::processName(const string_type& qName, bool isAttribute) { diff --git a/include/SAX/wrappers/saxmsxml2.hpp b/include/SAX/wrappers/saxmsxml2.hpp index 903a0c62..3c9bd07f 100644 --- a/include/SAX/wrappers/saxmsxml2.hpp +++ b/include/SAX/wrappers/saxmsxml2.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -118,48 +117,7 @@ class msxml2_wrapper : // Parsing virtual void parse(inputSourceT& input); - protected: - virtual std::auto_ptr doGetProperty(const string_type& name) - { - if(name == properties_.lexicalHandler) - { - Property* prop = new Property(lexicalHandler_.getLexicalHandler()); - return std::auto_ptr(prop); - } - if(name == properties_.declHandler) - { - Property* prop = new Property(declHandler_.getDeclHandler()); - return std::auto_ptr(prop); - } - throw SAX::SAXNotRecognizedException("Property not recognized "); - } // doGetProperty - - virtual void doSetProperty(const string_type& name, std::auto_ptr value) - { - if(name == properties_.lexicalHandler) - { - Property* prop = dynamic_cast*>(value.get()); - - if(!prop) - throw std::runtime_error("bad_cast: Property LexicalHandler is wrong type, should be SAX::LexicalHandler&"); - - lexicalHandler_.setLexicalHandler(prop->get()); - return; - } // if ... - if(name == properties_.declHandler) - { - Property* prop = dynamic_cast*>(value.get()); - - if(!prop) - throw std::runtime_error("bad_cast: Property DeclHandler is wrong type, should be SAX::DeclHandler&"); - - declHandler_.setDeclHandler(prop->get()); - return; - } // if ... - throw SAX::SAXNotRecognizedException("Property not recognized "); - } // doSetProperty - - private: + private: ////////////////////////////////////////////////////// // COM interface -> C++ interface adaptors class LocatorAdaptor : public locatorT @@ -987,7 +945,6 @@ class msxml2_wrapper : DeclHandlerAdaptor declHandler_; ISAXXMLReaderPtr reader_; - SAX::PropertyNames properties_; }; // class msxml template @@ -998,8 +955,7 @@ msxml2_wrapper::msxml2_wrapper() : contentHandler_(errorHandler_), lexicalHandler_(), declHandler_(), - reader_(), - properties_() + reader_() { reader_.CreateInstance("Msxml2.SAXXMLReader.6.0"); if(reader_.GetInterfacePtr() == 0) diff --git a/include/SAX/wrappers/saxxerces.hpp b/include/SAX/wrappers/saxxerces.hpp index 4d583cb3..4b7077c0 100644 --- a/include/SAX/wrappers/saxxerces.hpp +++ b/include/SAX/wrappers/saxxerces.hpp @@ -4,35 +4,6 @@ // A SAX2 wrapper class for Xerces. //--------------------------------------------------------------------------- -// Debugging code for the doSetProperty and doGetProperty methods. -// Since these methods use runtime casting, it is often helpful to -// know the exact type of a method's arguments to compare with -// what is expected. This is hard, even with current (2003) -// debuggers, so this code can print it out, assuming you've -// compiled with gcc 3.2 -// -// Example usage is given in doSetProperty - -// Use only with GCC 3.2 -#ifdef SAXXERCES_DEBUG - -#include -#include -#include - -// Demangle Run-Time Type Information std::type_info struct. -std::ostream& operator<<(std::ostream& o, const std::type_info& ti) -{ - int status; - char *realname = abi::__cxa_demangle(ti.name(), 0, 0, &status); - if (status != 0) - o.setstate(std::ios_base::failbit); - o << realname; - free(realname); - return o; -} -#endif - #include #include #include @@ -189,10 +160,6 @@ class xerces_wrapper : public ProgressiveParser doGetProperty(const string_type& name); - virtual void doSetProperty(const string_type& name, std::auto_ptr value); - private: /////////////////////////////// // String adaptor for XMLCh @@ -933,143 +900,6 @@ void xerces_wrapper::setFeature(const string_type& name, bo } // catch(SAXNotRecognizedException& e) } // setFeature -template -std::auto_ptr::XMLReaderT::PropertyBase> xerces_wrapper::doGetProperty(const string_type& name) -{ - if(name == properties_.lexicalHandler) - { - typedef typename XMLReaderT::template Property Prop; - Prop *prop = new Prop(lexicalHandlerAdaptor_.getLexicalHandler()); - return std::auto_ptr(prop); - } - if(name == properties_.declHandler) - { - typedef typename XMLReaderT::template Property Prop; - Prop* prop = new Prop(declHandlerAdaptor_.getDeclHandler()); - return std::auto_ptr(prop); - } - if (name == properties_.externalSchemaLocation) - { - typedef typename XMLReaderT::template Property StringPropertyType; - - XMLCh* xercesExternalSchemaLocation = - static_cast(xerces_->getProperty( - XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalSchemaLocation)); - - externalSchemaLocation_ = XSA::makeStringT(xercesExternalSchemaLocation); - std::auto_ptr toReturn(new StringPropertyType(externalSchemaLocation_)); -#ifdef SAXXERCES_DEBUG - std::cerr << "Returning " << typeid(toReturn) - << "(*(" << typeid(*toReturn.get()) << ")" - << toReturn.get() << ")" - << " containing value [" << externalSchemaLocation_ << "]" - << std::endl; -#endif - return toReturn; - } - if (name == properties_.externalNoNamespaceSchemaLocation) - { - typedef typename XMLReaderT::template Property StringPropertyType; - - XMLCh* xercesExternalNoNamespaceSchemaLocation = - static_cast(xerces_->getProperty( - XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation)); - - externalNoNamespaceSchemaLocation_ = XSA::makeStringT(xercesExternalNoNamespaceSchemaLocation); - return std::auto_ptr(new StringPropertyType(externalNoNamespaceSchemaLocation_)); - } - throw SAX::SAXNotRecognizedException("Property not recognized "); -} // doGetProperty - -template -void xerces_wrapper::doSetProperty(const string_type& name, std::auto_ptr value) -{ - if(name == properties_.lexicalHandler) - { - typedef typename XMLReaderT::template Property Prop; - Prop* prop = dynamic_cast(value.get()); - - if(!prop) - throw std::runtime_error("bad_cast: Property LexicalHandler is wrong type, should be SAX::LexicalHandler&"); - - lexicalHandlerAdaptor_.setLexicalHandler(prop->get()); - return; - } // if ... - - if(name == properties_.declHandler) - { - typedef typename XMLReaderT::template Property Prop; - Prop* prop = dynamic_cast(value.get()); - - if(!prop) - throw std::runtime_error("bad_cast: Property DeclHandler is wrong type, should be SAX::DeclHandler&"); - - declHandlerAdaptor_.setDeclHandler(prop->get()); - return; - } // if ... - - if (name == properties_.externalSchemaLocation) - { - typename XMLReaderT::PropertyBase* propBase = value.get(); -#ifdef SAXXERCES_DEBUG - std::cerr << "doSetProperty(externalSchemaLocation, &(" - << typeid(*propBase) << "))" << std::endl; -#endif - typedef typename XMLReaderT::template Property propertyType; - propertyType* prop = dynamic_cast(propBase); -#ifdef SAXXERCES_DEBUG - std::cerr << " Extracted property to " << typeid(prop) - << "(" << prop << ")" << std::endl; -#endif - if (prop) - { - externalSchemaLocation_ = prop->get(); -#ifdef SAXXERCES_DEBUG - std::cerr << " Setting property to " << externalSchemaLocation_ << std::endl; -#endif - xerces_string_janitor toDelete(XSA::asXMLChString(externalSchemaLocation_)); - xerces_->setProperty(XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalSchemaLocation, const_cast(toDelete.get())); - } - else - { - throw SAXNotSupportedException("Property ExternalShemaLocation is wrong type, should be string_type"); - } - return; - } - - if (name == properties_.externalNoNamespaceSchemaLocation) - { - typename XMLReaderT::PropertyBase* propBase = value.get(); - typedef typename XMLReaderT::template Property propertyType; -#ifdef SAXXERCES_DEBUG - std::cerr << "doSetProperty(externalNoNamespaceSchemaLocation, &(" - << typeid(*propBase) << "))" << std::endl; -#endif - propertyType* prop = dynamic_cast(propBase); -#ifdef SAXXERCES_DEBUG - std::cerr << " Extracted property to " << typeid(prop) - << "(" << prop << ")" << std::endl; -#endif - if (prop) - { - externalNoNamespaceSchemaLocation_ = prop->get(); -#ifdef SAXXERCES_DEBUG - std::cerr << " Setting property to " << externalNoNamespaceSchemaLocation_ << std::endl; -#endif - xerces_string_janitor toDelete(XSA::asXMLChString(externalNoNamespaceSchemaLocation_)); - xerces_->setProperty(XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, const_cast(toDelete.get())); - } - else - { - throw SAXNotSupportedException("Property ExternalNoNamespaceSchemaLocation is wrong type, should be string_type"); - } - return; - } - - throw SAX::SAXNotRecognizedException("Property not recognized "); -} - - template void xerces_wrapper::parse(InputSourceT& source) { diff --git a/include/Taggle/impl/Parser.hpp b/include/Taggle/impl/Parser.hpp index a6630540..41d4b0e1 100644 --- a/include/Taggle/impl/Parser.hpp +++ b/include/Taggle/impl/Parser.hpp @@ -396,90 +396,7 @@ public: CDATAElements = value; } // setFeature - typedef typename XMLReaderInterface::PropertyBase PropertyBaseT; - virtual std::auto_ptr doGetProperty(const string_type& /*name*/) - { - return std::auto_ptr(0); - } // doGetProperty - - virtual void doSetProperty(const string_type& /*name*/, std::auto_ptr /*value*/) - { - } // doSetProperty - - /* - Object getProperty (std::string name) - { - if(name.equals(lexicalHandlerProperty)) - { - return lexicalHandler_ == this ? null : lexicalHandler_; - } - else if(name.equals(scannerProperty)) - { - return scanner_; - } - else if(name.equals(schemaProperty)) - { - return schema_; - } - else if(name.equals(autoDetectorProperty)) - { - return theAutoDetector; - } - else - { - throw new SAXNotRecognizedException("Unknown property " + name); - } - } // getProperty - - void setProperty (std::string name, Object value) - { - if(name.equals(lexicalHandlerProperty)) - { - if(value == null) - { - lexicalHandler_ = this; - } - else if(value instanceof LexicalHandler) - { - lexicalHandler_ = (LexicalHandler)value; - } - else - { - throw new SAXNotSupportedException("Your lexical handler is not a LexicalHandler"); - } - } - else if(name.equals(scannerProperty)) - { - if(value instanceof Scanner) { - scanner_ = (Scanner)value; - } - else { - throw new SAXNotSupportedException("Your scanner is not a Scanner"); - } - } - else if(name.equals(schemaProperty)) { - if(value instanceof Schema) { - schema_ = (Schema)value; - } - else { - throw new SAXNotSupportedException("Your schema is not a Schema"); - } - } - else if(name.equals(autoDetectorProperty)) { - if(value instanceof AutoDetector) { - theAutoDetector = (AutoDetector)value; - } - else { - throw new SAXNotSupportedException("Your auto-detector is not an AutoDetector"); - } - } - else { - throw new SAXNotRecognizedException("Unknown property " + name); - } - } -*/ - - virtual void setEntityResolver(EntityResolverT& resolver) + virtual void setEntityResolver(EntityResolverT& resolver) { entityResolver_ = &resolver; } // setEntityResolver diff --git a/vs10/lib_arabica.vcxproj b/vs10/lib_arabica.vcxproj index eaf69987..f0fc1695 100644 --- a/vs10/lib_arabica.vcxproj +++ b/vs10/lib_arabica.vcxproj @@ -151,7 +151,6 @@ - diff --git a/vs2012/lib_arabica.vcxproj b/vs2012/lib_arabica.vcxproj index 86ae7a98..9c151d4e 100644 --- a/vs2012/lib_arabica.vcxproj +++ b/vs2012/lib_arabica.vcxproj @@ -153,7 +153,6 @@ - diff --git a/vs2013+/lib_arabica.vcxproj b/vs2013+/lib_arabica.vcxproj index a1b9f9e4..5cb4dc21 100644 --- a/vs2013+/lib_arabica.vcxproj +++ b/vs2013+/lib_arabica.vcxproj @@ -154,7 +154,6 @@ - diff --git a/vs2013+/lib_arabica_noboost.vcxproj b/vs2013+/lib_arabica_noboost.vcxproj index 196e3090..df24ffc9 100644 --- a/vs2013+/lib_arabica_noboost.vcxproj +++ b/vs2013+/lib_arabica_noboost.vcxproj @@ -154,7 +154,6 @@ - diff --git a/vs9/lib_arabica.vcproj b/vs9/lib_arabica.vcproj index 1a2df433..0151e2da 100644 --- a/vs9/lib_arabica.vcproj +++ b/vs9/lib_arabica.vcproj @@ -354,10 +354,6 @@ RelativePath="..\include\Sax\helpers\NamespaceSupport.hpp" > - - diff --git a/vs9/lib_arabica_noboost.vcproj b/vs9/lib_arabica_noboost.vcproj index 3a925450..19a39c84 100644 --- a/vs9/lib_arabica_noboost.vcproj +++ b/vs9/lib_arabica_noboost.vcproj @@ -354,10 +354,6 @@ RelativePath="..\include\Sax\helpers\NamespaceSupport.hpp" > - -