diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-11-13 07:46:45 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-11-13 07:46:45 +0200 |
commit | f2ec36ab5fa04e11dee655d9c623baac95db1eba (patch) | |
tree | f1f51bc34e749ca1f97e2e722a334fc599c8a124 /examples/cxx/tree/performance | |
parent | 6e9a647a859d9a95c96e75c77beaf41b166cc4e4 (diff) |
Drop support for Xerces-C++ 2-series
Diffstat (limited to 'examples/cxx/tree/performance')
-rw-r--r-- | examples/cxx/tree/performance/parsing.cxx | 54 | ||||
-rw-r--r-- | examples/cxx/tree/performance/serialization.cxx | 22 |
2 files changed, 3 insertions, 73 deletions
diff --git a/examples/cxx/tree/performance/parsing.cxx b/examples/cxx/tree/performance/parsing.cxx index 8d662eb..82279a1 100644 --- a/examples/cxx/tree/performance/parsing.cxx +++ b/examples/cxx/tree/performance/parsing.cxx @@ -8,11 +8,7 @@ #include <iostream> #include <xercesc/dom/DOM.hpp> -#if _XERCES_VERSION >= 30000 -# include <xercesc/dom/DOMLSParser.hpp> -#else -# include <xercesc/dom/DOMBuilder.hpp> -#endif +#include <xercesc/dom/DOMLSParser.hpp> #include <xercesc/dom/DOMImplementation.hpp> #include <xercesc/dom/DOMImplementationRegistry.hpp> @@ -67,8 +63,6 @@ parsing (const char* file, unsigned long iter, bool validate) xsd::cxx::tree::error_handler<char> eh; xsd::cxx::xml::dom::bits::error_handler_proxy<char> ehp (eh); -#if _XERCES_VERSION >= 30000 - xml_schema::dom::auto_ptr<DOMLSParser> parser ( impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); @@ -122,48 +116,6 @@ parsing (const char* file, unsigned long iter, bool validate) conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); -#else // _XERCES_VERSION >= 30000 - - // Same as above but for Xerces-C++ 2 series. - // - xml_schema::dom::auto_ptr<DOMBuilder> parser ( - impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0)); - - parser->setFeature (XMLUni::fgDOMComments, false); - parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); - parser->setFeature (XMLUni::fgDOMEntities, false); - parser->setFeature (XMLUni::fgDOMNamespaces, true); - parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); - - parser->setErrorHandler (&ehp); - - if (validate) - { - parser->setFeature (XMLUni::fgDOMValidation, true); - parser->setFeature (XMLUni::fgXercesSchema, true); - parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); - - if (!parser->loadGrammar ("test.xsd", Grammar::SchemaGrammarType, true)) - { - eh.handle ("test.xsd", 0, 0, - xsd::cxx::tree::error_handler<char>::severity::fatal, - "unable to load schema"); - } - - eh.throw_if_failed<xml_schema::parsing> (); - parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true); - } - else - { - parser->setFeature (XMLUni::fgDOMValidation, false); - parser->setFeature (XMLUni::fgXercesSchema, false); - parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); - } - - parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); - -#endif - // Create memory buffer input source. // MemBufInputSource is ( @@ -179,11 +131,7 @@ parsing (const char* file, unsigned long iter, bool validate) { // First parse XML to DOM reusing the parser we created above. // -#if _XERCES_VERSION >= 30000 xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (&wis)); -#else - xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (wis)); -#endif eh.throw_if_failed<xml_schema::parsing> (); // Then parse DOM to the object model. diff --git a/examples/cxx/tree/performance/serialization.cxx b/examples/cxx/tree/performance/serialization.cxx index 12c43ae..551d04b 100644 --- a/examples/cxx/tree/performance/serialization.cxx +++ b/examples/cxx/tree/performance/serialization.cxx @@ -8,12 +8,8 @@ #include <iostream> #include <xercesc/dom/DOM.hpp> -#if _XERCES_VERSION >= 30000 -# include <xercesc/dom/DOMLSOutput.hpp> -# include <xercesc/dom/DOMLSSerializer.hpp> -#else -# include <xercesc/dom/DOMWriter.hpp> -#endif +#include <xercesc/dom/DOMLSOutput.hpp> +#include <xercesc/dom/DOMLSSerializer.hpp> #include <xercesc/dom/DOMImplementation.hpp> #include <xercesc/dom/DOMImplementationRegistry.hpp> @@ -75,7 +71,6 @@ serialization (const char* file, unsigned long iter) xsd::cxx::tree::error_handler<char> eh; xsd::cxx::xml::dom::bits::error_handler_proxy<char> ehp (eh); -#if _XERCES_VERSION >= 30000 xml_schema::dom::auto_ptr<DOMLSSerializer> writer ( impl->createLSSerializer ()); @@ -87,14 +82,6 @@ serialization (const char* file, unsigned long iter) xml_schema::dom::auto_ptr<DOMLSOutput> out (impl->createLSOutput ()); out->setByteStream (&ft); -#else - // Same as above but for Xerces-C++ 2 series. - // - xml_schema::dom::auto_ptr<DOMWriter> writer (impl->createDOMWriter ()); - - writer->setErrorHandler (&ehp); - writer->setFeature (XMLUni::fgDOMXMLDeclaration, false); -#endif // Serialization loop. // @@ -110,12 +97,7 @@ serialization (const char* file, unsigned long iter) // Then serialize DOM to XML reusing the serializer we created above. // -#if _XERCES_VERSION >= 30000 writer->write (doc.get (), out.get ()); -#else - writer->writeNode (&ft, *doc); -#endif - eh.throw_if_failed<xml_schema::serialization> (); } |