aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-11-13 07:47:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-11-13 07:47:39 +0200
commit8510f324a53ffd2dac41feea520acdf4c2443765 (patch)
tree89d67b46d885c3b7c8c7881ba97ab55fc4dcd42d
parentd79dc02eab2a560dc075ebbbe3bf14f62082ab5f (diff)
Drop support for Xerces-C++ 2-series
-rw-r--r--xsd-frontend/parser.cxx38
-rw-r--r--xsd-frontend/schema-dom-parser.cxx22
-rw-r--r--xsd-frontend/schema-dom-parser.hxx14
-rw-r--r--xsd-frontend/version.hxx15
-rw-r--r--xsd-frontend/xml.hxx10
5 files changed, 21 insertions, 78 deletions
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 <cutl/compiler/type-id.hxx>
-#include <xsd-frontend/parser.hxx>
+#include <xsd-frontend/version.hxx> // Check Xerces-C++ version.
#include <xsd-frontend/xml.hxx>
+#include <xsd-frontend/parser.hxx>
#include <xsd-frontend/schema-dom-parser.hxx>
#include <xsd-frontend/semantic-graph.hxx>
@@ -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<DOMLSParser> 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<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::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<XMLAttr>& 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<unsigned long> (info.lineNumber));
unsigned long c (static_cast<unsigned long> (info.colNumber));
-#else
- unsigned long l (info.lineNumber == -1
- ? 0UL
- : static_cast<unsigned long> (info.lineNumber));
-
- unsigned long c (info.colNumber == -1
- ? 0UL
- : static_cast<unsigned long> (info.colNumber));
-#endif
fCurrentNode->setUserData (line_key, reinterpret_cast<void*> (l), 0);
fCurrentNode->setUserData (column_key, reinterpret_cast<void*> (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 <xercesc/validators/schema/XSDLocator.hpp>
#include <xercesc/validators/schema/XSDErrorReporter.hpp>
+#include <xsd-frontend/version.hxx> // 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<Xerces::XMLAttr>& 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 <boris@codesynthesis.com>
+// 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 <xercesc/util/XercesVersion.hpp>
+
+#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 <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
+#include <xsd-frontend/version.hxx> // Check Xerces-C++ version.
#include <xsd-frontend/types.hxx>
#include <xsd-frontend/schema-dom-parser.hxx>
@@ -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)
{