From 8510f324a53ffd2dac41feea520acdf4c2443765 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 13 Nov 2013 07:47:39 +0200 Subject: Drop support for Xerces-C++ 2-series --- xsd-frontend/parser.cxx | 38 ++------------------------------------ xsd-frontend/schema-dom-parser.cxx | 22 ---------------------- xsd-frontend/schema-dom-parser.hxx | 14 ++------------ xsd-frontend/version.hxx | 15 +++++++++++++++ xsd-frontend/xml.hxx | 10 ++-------- 5 files changed, 21 insertions(+), 78 deletions(-) create mode 100644 xsd-frontend/version.hxx diff --git a/xsd-frontend/parser.cxx b/xsd-frontend/parser.cxx index 65fb703..3f8200a 100644 --- a/xsd-frontend/parser.cxx +++ b/xsd-frontend/parser.cxx @@ -11,8 +11,9 @@ #include -#include +#include // Check Xerces-C++ version. #include +#include #include #include @@ -4891,11 +4892,7 @@ namespace XSDFrontend class EntityResolver: public Xerces::XMemory, -#if _XERCES_VERSION >= 30000 public Xerces::DOMLSResourceResolver -#else - public Xerces::DOMEntityResolver -#endif { public: EntityResolver (XSDFrontend::Context& ctx, LocationTranslator* t) @@ -4903,19 +4900,12 @@ namespace XSDFrontend { } -#if _XERCES_VERSION >= 30000 virtual Xerces::DOMLSInput* resolveResource(XMLCh const* const, XMLCh const* const, XMLCh const* const /*pub_id*/, XMLCh const* const prv_id, XMLCh const* const base_uri) -#else - virtual Xerces::DOMInputSource* - resolveEntity (XMLCh const* const /*pub_id*/, - XMLCh const* const prv_id, - XMLCh const* const base_uri) -#endif { /* XMLCh empty[1]; @@ -5036,7 +5026,6 @@ namespace XSDFrontend // Create a DOMBuilder. // -#if _XERCES_VERSION >= 30000 XML::AutoPtr parser ( impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); @@ -5068,29 +5057,6 @@ namespace XSDFrontend Wrapper4InputSource wrap (&input_source, false); parser->loadGrammar (&wrap, Grammar::SchemaGrammarType); -#else - XML::AutoPtr 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::fgDOMValidation, true); - parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); - parser->setFeature (XMLUni::fgXercesSchema, true); - parser->setFeature (XMLUni::fgXercesSchemaFullChecking, full_schema_check_); - parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true); - - ErrorHandler eh (valid_, ctx); - parser->setErrorHandler (&eh); - - EntityResolver er (ctx, loc_translator_); - parser->setEntityResolver (&er); - - Wrapper4InputSource wrap (&input_source, false); - parser->loadGrammar (wrap, Grammar::SchemaGrammarType); -#endif } if (!valid_) diff --git a/xsd-frontend/schema-dom-parser.cxx b/xsd-frontend/schema-dom-parser.cxx index 98033b2..7056039 100644 --- a/xsd-frontend/schema-dom-parser.cxx +++ b/xsd-frontend/schema-dom-parser.cxx @@ -44,11 +44,7 @@ namespace XSDFrontend const unsigned int url_id, const XMLCh* const prefix, const RefVectorOf& attributes, -#if _XERCES_VERSION >= 30000 const XMLSize_t attr_count, -#else - const unsigned int attr_count, -#endif const bool empty, const bool root) { @@ -77,18 +73,8 @@ namespace XSDFrontend ReaderMgr::LastExtEntityInfo info; ((ReaderMgr*) fScanner->getLocator())->getLastExtEntityInfo(info); -#if _XERCES_VERSION >= 30000 unsigned long l (static_cast (info.lineNumber)); unsigned long c (static_cast (info.colNumber)); -#else - unsigned long l (info.lineNumber == -1 - ? 0UL - : static_cast (info.lineNumber)); - - unsigned long c (info.colNumber == -1 - ? 0UL - : static_cast (info.colNumber)); -#endif fCurrentNode->setUserData (line_key, reinterpret_cast (l), 0); fCurrentNode->setUserData (column_key, reinterpret_cast (c), 0); @@ -124,11 +110,7 @@ namespace XSDFrontend void SchemaDOMParser:: docCharacters (const XMLCh* const s, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata) { // Ignore chars outside of content. @@ -177,11 +159,7 @@ namespace XSDFrontend void SchemaDOMParser:: ignorableWhitespace (const XMLCh* const s, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata) { // Ignore chars before the root element. diff --git a/xsd-frontend/schema-dom-parser.hxx b/xsd-frontend/schema-dom-parser.hxx index 46b0927..0be0aba 100644 --- a/xsd-frontend/schema-dom-parser.hxx +++ b/xsd-frontend/schema-dom-parser.hxx @@ -13,6 +13,8 @@ #include #include +#include // Check Xerces-C++ version. + namespace XSDFrontend { namespace XML @@ -35,11 +37,7 @@ namespace XSDFrontend const unsigned int url_id, const XMLCh* const prefix, const Xerces::RefVectorOf& attributes, -#if _XERCES_VERSION >= 30000 const XMLSize_t attribute_count, -#else - const unsigned int attribute_count, -#endif const bool empty, const bool root); @@ -51,11 +49,7 @@ namespace XSDFrontend virtual void docCharacters (const XMLCh* const, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata); virtual void @@ -69,11 +63,7 @@ namespace XSDFrontend virtual void ignorableWhitespace (const XMLCh* const, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata); private: SchemaDOMParser (SchemaDOMParser const&); diff --git a/xsd-frontend/version.hxx b/xsd-frontend/version.hxx new file mode 100644 index 0000000..1e147bf --- /dev/null +++ b/xsd-frontend/version.hxx @@ -0,0 +1,15 @@ +// file : xsd-frontend/version.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_VERSION_HXX +#define XSD_FRONTEND_VERSION_HXX + +#include + +#if _XERCES_VERSION < 30000 +# error Xerces-C++ 2-series is not supported +#endif + +#endif // XSD_FRONTEND_VERSION_HXX diff --git a/xsd-frontend/xml.hxx b/xsd-frontend/xml.hxx index a785eee..d8962a5 100644 --- a/xsd-frontend/xml.hxx +++ b/xsd-frontend/xml.hxx @@ -12,6 +12,7 @@ #include #include +#include // Check Xerces-C++ version. #include #include @@ -366,14 +367,7 @@ namespace XSDFrontend ns_prefix (Element const& e, String const& wns) { XMLChString ns (wns); - -#if _XERCES_VERSION >= 30000 - XMLCh const* p ( - e.dom_element ()->lookupPrefix (ns.c_str ())); -#else - XMLCh const* p ( - e.dom_element ()->lookupNamespacePrefix (ns.c_str (), false)); -#endif + XMLCh const* p (e.dom_element ()->lookupPrefix (ns.c_str ())); if (p == 0) { -- cgit v1.1