aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-11-13 07:46:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-11-13 07:46:45 +0200
commitf2ec36ab5fa04e11dee655d9c623baac95db1eba (patch)
treef1f51bc34e749ca1f97e2e722a334fc599c8a124 /examples
parent6e9a647a859d9a95c96e75c77beaf41b166cc4e4 (diff)
Drop support for Xerces-C++ 2-series
Diffstat (limited to 'examples')
-rw-r--r--examples/cxx/parser/performance/driver.cxx3
-rw-r--r--examples/cxx/tree/caching/driver.cxx43
-rw-r--r--examples/cxx/tree/compression/compressed-format-target.cxx4
-rw-r--r--examples/cxx/tree/compression/compressed-format-target.hxx4
-rw-r--r--examples/cxx/tree/compression/compressed-input-source.cxx19
-rw-r--r--examples/cxx/tree/compression/compressed-input-source.hxx10
-rw-r--r--examples/cxx/tree/custom/comments/dom-parse.cxx31
-rw-r--r--examples/cxx/tree/embedded/driver.cxx40
-rw-r--r--examples/cxx/tree/embedded/grammar-input-stream.cxx19
-rw-r--r--examples/cxx/tree/embedded/grammar-input-stream.hxx12
-rw-r--r--examples/cxx/tree/embedded/xsdbin.cxx20
-rw-r--r--examples/cxx/tree/messaging/dom-parse.cxx31
-rw-r--r--examples/cxx/tree/messaging/dom-serialize.cxx25
-rw-r--r--examples/cxx/tree/multiroot/dom-parse.cxx31
-rw-r--r--examples/cxx/tree/performance/parsing.cxx54
-rw-r--r--examples/cxx/tree/performance/serialization.cxx22
-rw-r--r--examples/cxx/tree/streaming/parser.cxx36
-rw-r--r--examples/cxx/tree/streaming/serializer.cxx22
-rw-r--r--examples/cxx/tree/xpath/dom-parse.cxx31
19 files changed, 12 insertions, 445 deletions
diff --git a/examples/cxx/parser/performance/driver.cxx b/examples/cxx/parser/performance/driver.cxx
index 422f2b9..ed56f63 100644
--- a/examples/cxx/parser/performance/driver.cxx
+++ b/examples/cxx/parser/performance/driver.cxx
@@ -22,7 +22,6 @@
# include <xsd/cxx/xml/sax/bits/error-handler-proxy.hxx>
# include <xsd/cxx/parser/error-handler.hxx>
-
#endif
// No-op parser implementation.
@@ -256,7 +255,7 @@ main (int argc, char* argv[])
eh.throw_if_failed ();
parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true);
-#if _XERCES_VERSION >= 30000
+#if _XERCES_VERSION >= 30100
parser->setFeature (XMLUni::fgXercesLoadSchema, false);
#endif
}
diff --git a/examples/cxx/tree/caching/driver.cxx b/examples/cxx/tree/caching/driver.cxx
index a3877d8..d4f5ff7 100644
--- a/examples/cxx/tree/caching/driver.cxx
+++ b/examples/cxx/tree/caching/driver.cxx
@@ -51,10 +51,6 @@ main (int argc, char* argv[])
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
-
- // Xerces-C++ 3.0.0 and later.
- //
xml::dom::auto_ptr<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
@@ -128,41 +124,6 @@ main (int argc, char* argv[])
//
conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- xml::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->setFeature (XMLUni::fgDOMValidation, true);
- parser->setFeature (XMLUni::fgXercesSchema, true);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
-
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- parser->setErrorHandler (&ehp);
-
- if (!parser->loadGrammar ("library.xsd", Grammar::SchemaGrammarType, true))
- {
- eh.handle ("library.xsd", 0, 0,
- tree::error_handler<char>::severity::fatal,
- "unable to load schema");
- }
-
- eh.throw_if_failed<xml_schema::parsing> ();
- parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true);
-
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
-#endif // _XERCES_VERSION >= 30000
-
// Parse XML documents.
//
for (unsigned long i (0); i < 10; ++i)
@@ -178,11 +139,7 @@ main (int argc, char* argv[])
// Parse XML to DOM.
//
-#if _XERCES_VERSION >= 30000
xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap));
-#else
- xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
eh.throw_if_failed<xml_schema::parsing> ();
diff --git a/examples/cxx/tree/compression/compressed-format-target.cxx b/examples/cxx/tree/compression/compressed-format-target.cxx
index b4a8a85..61aeed3 100644
--- a/examples/cxx/tree/compression/compressed-format-target.cxx
+++ b/examples/cxx/tree/compression/compressed-format-target.cxx
@@ -81,11 +81,7 @@ compressed_format_target::
void compressed_format_target::
writeChars (const XMLByte* const buf,
-#if _XERCES_VERSION >= 30000
const XMLSize_t size,
-#else
- const unsigned int size,
-#endif
xercesc::XMLFormatter* const)
{
// Flush the buffer if the block is too large or if we don't have
diff --git a/examples/cxx/tree/compression/compressed-format-target.hxx b/examples/cxx/tree/compression/compressed-format-target.hxx
index 5d12e81..fd1ef54 100644
--- a/examples/cxx/tree/compression/compressed-format-target.hxx
+++ b/examples/cxx/tree/compression/compressed-format-target.hxx
@@ -60,11 +60,7 @@ public:
virtual void
writeChars (const XMLByte* const buf,
-#if _XERCES_VERSION >= 30000
const XMLSize_t size,
-#else
- const unsigned int size,
-#endif
xercesc::XMLFormatter* const);
virtual void
diff --git a/examples/cxx/tree/compression/compressed-input-source.cxx b/examples/cxx/tree/compression/compressed-input-source.cxx
index 22d09ff..2107d59 100644
--- a/examples/cxx/tree/compression/compressed-input-source.cxx
+++ b/examples/cxx/tree/compression/compressed-input-source.cxx
@@ -111,27 +111,14 @@ compressed_input_stream::
inflateEnd (&zs_);
}
-#if _XERCES_VERSION >= 30000
XMLFilePos compressed_input_stream::
curPos () const
{
return static_cast<XMLFilePos> (pos_);
}
-#else
-unsigned int compressed_input_stream::
-curPos () const
-{
- return static_cast<unsigned int> (pos_);
-}
-#endif
-#if _XERCES_VERSION >= 30000
XMLSize_t compressed_input_stream::
readBytes (XMLByte* const buf, const XMLSize_t size)
-#else
-unsigned int compressed_input_stream::
-readBytes (XMLByte* const buf, const unsigned int size)
-#endif
{
if (end_)
return 0;
@@ -169,20 +156,14 @@ readBytes (XMLByte* const buf, const unsigned int size)
size_t n (size - zs_.avail_out);
pos_ += n;
-#if _XERCES_VERSION >= 30000
return static_cast<XMLSize_t> (n);
-#else
- return static_cast<unsigned int> (n);
-#endif
}
-#if _XERCES_VERSION >= 30000
const XMLCh* compressed_input_stream::
getContentType () const
{
return 0;
}
-#endif
size_t compressed_input_stream::
read ()
diff --git a/examples/cxx/tree/compression/compressed-input-source.hxx b/examples/cxx/tree/compression/compressed-input-source.hxx
index 680d39f..74da9f1 100644
--- a/examples/cxx/tree/compression/compressed-input-source.hxx
+++ b/examples/cxx/tree/compression/compressed-input-source.hxx
@@ -96,7 +96,6 @@ public:
virtual
~compressed_input_stream ();
-#if _XERCES_VERSION >= 30000
virtual XMLFilePos
curPos () const;
@@ -106,15 +105,6 @@ public:
virtual const XMLCh*
getContentType () const;
-#else
-
- virtual unsigned int
- readBytes (XMLByte* const buf, const unsigned int size);
-
- virtual unsigned int
- curPos () const;
-#endif
-
private:
std::size_t
read ();
diff --git a/examples/cxx/tree/custom/comments/dom-parse.cxx b/examples/cxx/tree/custom/comments/dom-parse.cxx
index d8841c5..a47e592 100644
--- a/examples/cxx/tree/custom/comments/dom-parse.cxx
+++ b/examples/cxx/tree/custom/comments/dom-parse.cxx
@@ -30,10 +30,6 @@ parse (std::istream& is, const std::string& id, bool validate)
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
-
- // Xerces-C++ 3.0.0 and later.
- //
xml::dom::auto_ptr<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
@@ -85,39 +81,12 @@ parse (std::istream& is, const std::string& id, bool validate)
xml::dom::bits::error_handler_proxy<char> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- xml::dom::auto_ptr<DOMBuilder> parser (
- impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
-
- parser->setFeature (XMLUni::fgDOMComments, true);
- parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
- parser->setFeature (XMLUni::fgDOMEntities, false);
- parser->setFeature (XMLUni::fgDOMNamespaces, true);
- parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false);
- parser->setFeature (XMLUni::fgDOMValidation, validate);
- parser->setFeature (XMLUni::fgXercesSchema, validate);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
// Prepare input stream.
//
xml::sax::std_input_source isrc (is, id);
Wrapper4InputSource wrap (&isrc, false);
-#if _XERCES_VERSION >= 30000
xml::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap));
-#else
- xml::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
eh.throw_if_failed<tree::parsing<char> > ();
diff --git a/examples/cxx/tree/embedded/driver.cxx b/examples/cxx/tree/embedded/driver.cxx
index 6e31d3b..2ccf469 100644
--- a/examples/cxx/tree/embedded/driver.cxx
+++ b/examples/cxx/tree/embedded/driver.cxx
@@ -12,11 +12,7 @@
#include <xercesc/validators/common/Grammar.hpp> // xercesc::Grammar
#include <xercesc/framework/Wrapper4InputSource.hpp>
-#if _XERCES_VERSION >= 30000
-# include <xercesc/framework/XMLGrammarPoolImpl.hpp>
-#else
-# include <xercesc/internal/XMLGrammarPoolImpl.hpp>
-#endif
+#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
#include <xsd/cxx/xml/string.hxx>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
@@ -86,10 +82,6 @@ main (int argc, char* argv[])
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
-
- // Xerces-C++ 3.0.0 and later.
- //
xml::dom::auto_ptr<DOMLSParser> parser (
impl->createLSParser (
DOMImplementationLS::MODE_SYNCHRONOUS, 0, mm, gp.get ()));
@@ -150,32 +142,6 @@ main (int argc, char* argv[])
xml::dom::bits::error_handler_proxy<char> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- xml::dom::auto_ptr<DOMBuilder> parser (
- impl->createDOMBuilder(
- DOMImplementationLS::MODE_SYNCHRONOUS, 0, mm, gp.get ()));
-
-
- 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->setFeature (XMLUni::fgDOMValidation, true);
- parser->setFeature (XMLUni::fgXercesSchema, true);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true);
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
// Parse XML documents.
//
for (unsigned long i (0); i < 10; ++i)
@@ -191,11 +157,7 @@ main (int argc, char* argv[])
// Parse XML to DOM.
//
-#if _XERCES_VERSION >= 30000
xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap));
-#else
- xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
eh.throw_if_failed<xml_schema::parsing> ();
diff --git a/examples/cxx/tree/embedded/grammar-input-stream.cxx b/examples/cxx/tree/embedded/grammar-input-stream.cxx
index 0c94ea6..270f1d9 100644
--- a/examples/cxx/tree/embedded/grammar-input-stream.cxx
+++ b/examples/cxx/tree/embedded/grammar-input-stream.cxx
@@ -16,27 +16,14 @@ grammar_input_stream (const XMLByte* data, std::size_t size)
{
}
-#if _XERCES_VERSION >= 30000
XMLFilePos grammar_input_stream::
curPos () const
{
return static_cast<XMLFilePos> (vpos_);
}
-#else
-unsigned int grammar_input_stream::
-curPos () const
-{
- return static_cast<unsigned int> (vpos_);
-}
-#endif
-#if _XERCES_VERSION >= 30000
XMLSize_t grammar_input_stream::
readBytes (XMLByte* const buf, const XMLSize_t size)
-#else
-unsigned int grammar_input_stream::
-readBytes (XMLByte* const buf, const unsigned int size)
-#endif
{
std::size_t i (0);
@@ -99,17 +86,11 @@ readBytes (XMLByte* const buf, const unsigned int size)
vpos_ += i;
-#if _XERCES_VERSION >= 30000
return static_cast<XMLSize_t> (i);
-#else
- return static_cast<unsigned int> (i);
-#endif
}
-#if _XERCES_VERSION >= 30000
const XMLCh* grammar_input_stream::
getContentType () const
{
return 0;
}
-#endif
diff --git a/examples/cxx/tree/embedded/grammar-input-stream.hxx b/examples/cxx/tree/embedded/grammar-input-stream.hxx
index a1b73c6..5a861ef 100644
--- a/examples/cxx/tree/embedded/grammar-input-stream.hxx
+++ b/examples/cxx/tree/embedded/grammar-input-stream.hxx
@@ -16,8 +16,6 @@ class grammar_input_stream: public xercesc::BinInputStream
public :
grammar_input_stream (const XMLByte* data, std::size_t size);
-#if _XERCES_VERSION >= 30000
-
virtual XMLFilePos
curPos () const;
@@ -27,16 +25,6 @@ public :
virtual const XMLCh*
getContentType () const;
-#else
-
- virtual unsigned int
- curPos () const;
-
- virtual unsigned int
- readBytes (XMLByte* const buf, const unsigned int size);
-
-#endif
-
private :
const XMLByte* data_;
std::size_t size_;
diff --git a/examples/cxx/tree/embedded/xsdbin.cxx b/examples/cxx/tree/embedded/xsdbin.cxx
index 0da307b..dc42fd6 100644
--- a/examples/cxx/tree/embedded/xsdbin.cxx
+++ b/examples/cxx/tree/embedded/xsdbin.cxx
@@ -28,11 +28,7 @@
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>
-#if _XERCES_VERSION >= 30000
-# include <xercesc/framework/XMLGrammarPoolImpl.hpp>
-#else
-# include <xercesc/internal/XMLGrammarPoolImpl.hpp>
-#endif
+#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
using namespace std;
using namespace xercesc;
@@ -490,17 +486,9 @@ handle (const SAXParseException& e, severity s)
char* id (XMLString::transcode (xid));
char* msg (XMLString::transcode (e.getMessage ()));
- cerr << id << ":";
-
-#if _XERCES_VERSION >= 30000
- cerr << e.getLineNumber () << ":" << e.getColumnNumber () << " ";
-#else
- XMLSSize_t l (e.getLineNumber ());
- XMLSSize_t c (e.getColumnNumber ());
- cerr << (l == -1 ? 0 : l) << ":" << (c == -1 ? 0 : c) << " ";
-#endif
-
- cerr << (s == s_warning ? "warning: " : "error: ") << msg << endl;
+ cerr << id << ":"
+ << e.getLineNumber () << ":" << e.getColumnNumber () << " "
+ << (s == s_warning ? "warning: " : "error: ") << msg << endl;
XMLString::release (&id);
XMLString::release (&msg);
diff --git a/examples/cxx/tree/messaging/dom-parse.cxx b/examples/cxx/tree/messaging/dom-parse.cxx
index e4bc6cc..1596f4e 100644
--- a/examples/cxx/tree/messaging/dom-parse.cxx
+++ b/examples/cxx/tree/messaging/dom-parse.cxx
@@ -30,10 +30,6 @@ parse (std::istream& is, const std::string& id, bool validate)
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
-
- // Xerces-C++ 3.0.0 and later.
- //
xml::dom::auto_ptr<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
@@ -85,39 +81,12 @@ parse (std::istream& is, const std::string& id, bool validate)
xml::dom::bits::error_handler_proxy<char> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- xml::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->setFeature (XMLUni::fgDOMValidation, validate);
- parser->setFeature (XMLUni::fgXercesSchema, validate);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
// Prepare input stream.
//
xml::sax::std_input_source isrc (is, id);
Wrapper4InputSource wrap (&isrc, false);
-#if _XERCES_VERSION >= 30000
xml::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap));
-#else
- xml::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
eh.throw_if_failed<tree::parsing<char> > ();
diff --git a/examples/cxx/tree/messaging/dom-serialize.cxx b/examples/cxx/tree/messaging/dom-serialize.cxx
index c0f4311..e303e9c 100644
--- a/examples/cxx/tree/messaging/dom-serialize.cxx
+++ b/examples/cxx/tree/messaging/dom-serialize.cxx
@@ -38,8 +38,6 @@ serialize (std::ostream& os,
xml::dom::ostream_format_target oft (os);
-#if _XERCES_VERSION >= 30000
-
// Create a DOMSerializer.
//
xml::dom::auto_ptr<DOMLSSerializer> writer (
@@ -62,28 +60,5 @@ serialize (std::ostream& os,
writer->write (&doc, out.get ());
-#else
-
- // Create a DOMWriter.
- //
- xml::dom::auto_ptr<DOMWriter> writer (impl->createDOMWriter ());
-
- // Set error handler.
- //
- writer->setErrorHandler (&ehp);
-
- // Set encoding.
- //
- writer->setEncoding(xml::string (encoding).c_str ());
-
- // Set some generally nice features.
- //
- writer->setFeature (XMLUni::fgDOMWRTDiscardDefaultContent, true);
- writer->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true);
-
- writer->writeNode (&oft, doc);
-
-#endif
-
eh.throw_if_failed<tree::serialization<char> > ();
}
diff --git a/examples/cxx/tree/multiroot/dom-parse.cxx b/examples/cxx/tree/multiroot/dom-parse.cxx
index 2b57be0..56cffc7 100644
--- a/examples/cxx/tree/multiroot/dom-parse.cxx
+++ b/examples/cxx/tree/multiroot/dom-parse.cxx
@@ -30,10 +30,6 @@ parse (std::istream& is, const std::string& id, bool validate)
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
-
- // Xerces-C++ 3.0.0 and later.
- //
xml::dom::auto_ptr<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
@@ -85,39 +81,12 @@ parse (std::istream& is, const std::string& id, bool validate)
xml::dom::bits::error_handler_proxy<char> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- xml::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->setFeature (XMLUni::fgDOMValidation, validate);
- parser->setFeature (XMLUni::fgXercesSchema, validate);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
// Prepare input stream.
//
xml::sax::std_input_source isrc (is, id);
Wrapper4InputSource wrap (&isrc, false);
-#if _XERCES_VERSION >= 30000
xml::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap));
-#else
- xml::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
eh.throw_if_failed<tree::parsing<char> > ();
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> ();
}
diff --git a/examples/cxx/tree/streaming/parser.cxx b/examples/cxx/tree/streaming/parser.cxx
index f593a14..4696d5c 100644
--- a/examples/cxx/tree/streaming/parser.cxx
+++ b/examples/cxx/tree/streaming/parser.cxx
@@ -11,10 +11,7 @@
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/dom/DOM.hpp>
-
-#if _XERCES_VERSION >= 30000
-# include <xercesc/dom/impl/DOMTextImpl.hpp>
-#endif
+#include <xercesc/dom/impl/DOMTextImpl.hpp>
#include <xsd/cxx/auto-array.hxx>
@@ -59,12 +56,7 @@ private:
virtual void
characters (const XMLCh* const s,
-#if _XERCES_VERSION >= 30000
- const XMLSize_t length
-#else
- const unsigned int length
-#endif
- );
+ const XMLSize_t length);
private:
// SAX parser.
@@ -101,7 +93,7 @@ parser_impl ()
// Xerces-C++ 3.1.0 is the first version with working multi import
// support. It also allows us to disable buffering in the parser
- // so that the date is parsed and returned as soon as it is
+ // so that the data is parsed and returned as soon as it is
// available.
//
#if _XERCES_VERSION >= 30100
@@ -214,11 +206,7 @@ startElement (const XMLCh* const uri,
// Set attributes.
//
-#if _XERCES_VERSION >= 30000
for (XMLSize_t i (0), end (attr.getLength()); i < end; ++i)
-#else
- for (unsigned int i (0), end (attr.getLength()); i < end; ++i)
-#endif
{
const XMLCh* qn (attr.getQName (i));
const XMLCh* ns (attr.getURI (i));
@@ -247,7 +235,6 @@ endElement (const XMLCh* const /*uri*/,
cur_ = static_cast<DOMElement*> (cur_->getParentNode ());
}
-#if _XERCES_VERSION >= 30000
void parser_impl::
characters (const XMLCh* const s, const XMLSize_t length)
{
@@ -262,23 +249,6 @@ characters (const XMLCh* const s, const XMLSize_t length)
cur_->appendChild (t);
}
}
-#else
-void parser_impl::
-characters (const XMLCh* const s, const unsigned int length)
-{
- // Ignore text content (presumably whitespaces) in the root element.
- //
- if (depth_ > 1)
- {
- // For Xerces-C++ 2-series we have to make copy.
- //
- xsd::cxx::auto_array<XMLCh> tmp (new XMLCh[length + 1]);
- XMLString::copyNString (tmp.get (), s, length);
- cur_->appendChild (doc_->createTextNode (tmp.get ()));
- }
-}
-#endif
-
//
// parser
diff --git a/examples/cxx/tree/streaming/serializer.cxx b/examples/cxx/tree/streaming/serializer.cxx
index f6516f6..c879533 100644
--- a/examples/cxx/tree/streaming/serializer.cxx
+++ b/examples/cxx/tree/streaming/serializer.cxx
@@ -47,12 +47,8 @@ private:
private:
// Serializer.
//
-#if _XERCES_VERSION >= 30000
xml::dom::auto_ptr<DOMLSOutput> out_;
xml::dom::auto_ptr<DOMLSSerializer> serializer_;
-#else
- xml::dom::auto_ptr<DOMWriter> serializer_;
-#endif
auto_ptr<xml::dom::ostream_format_target> oft_;
@@ -73,7 +69,6 @@ serializer_impl ()
dom_impl_ (*DOMImplementationRegistry::getDOMImplementation (ls)),
doc_ (dom_impl_.createDocument ())
{
-#if _XERCES_VERSION >= 30000
serializer_.reset (dom_impl_.createLSSerializer ());
DOMConfiguration* conf (serializer_->getDomConfig ());
@@ -81,14 +76,6 @@ serializer_impl ()
conf->setParameter (XMLUni::fgDOMWRTDiscardDefaultContent, true);
conf->setParameter (XMLUni::fgDOMWRTFormatPrettyPrint, true);
conf->setParameter (XMLUni::fgDOMXMLDeclaration, false);
-#else
- serializer_.reset (dom_impl_.createDOMWriter ());
-
- serializer_->setErrorHandler (&error_proxy_);
- serializer_->setFeature (XMLUni::fgDOMWRTDiscardDefaultContent, true);
- serializer_->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true);
- serializer_->setFeature (XMLUni::fgDOMXMLDeclaration, false);
-#endif
}
void serializer_impl::
@@ -97,13 +84,9 @@ start (ostream& os, const string& encoding)
error_handler_.reset ();
oft_.reset (new xml::dom::ostream_format_target (os));
-#if _XERCES_VERSION >= 30000
out_.reset (dom_impl_.createLSOutput ());
out_->setEncoding (xml::string (encoding).c_str ());
out_->setByteStream (oft_.get ());
-#else
- serializer_->setEncoding (xml::string (encoding).c_str ());
-#endif
}
DOMElement* serializer_impl::
@@ -159,12 +142,7 @@ add_namespaces (DOMElement* e, const namespace_infomap& map)
void serializer_impl::
serialize (DOMElement& e)
{
-#if _XERCES_VERSION >= 30000
serializer_->write (&e, out_.get ());
-#else
- serializer_->writeNode (oft_.get (), e);
-#endif
-
error_handler_.throw_if_failed<tree::serialization<char> > ();
}
diff --git a/examples/cxx/tree/xpath/dom-parse.cxx b/examples/cxx/tree/xpath/dom-parse.cxx
index 82e87b6..c3da911 100644
--- a/examples/cxx/tree/xpath/dom-parse.cxx
+++ b/examples/cxx/tree/xpath/dom-parse.cxx
@@ -25,10 +25,6 @@ parse (std::istream& is,
bool validate,
DOMImplementation* impl)
{
-#if _XERCES_VERSION >= 30000
-
- // Xerces-C++ 3.0.0 and later.
- //
xml::dom::auto_ptr<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
@@ -80,39 +76,12 @@ parse (std::istream& is,
xml::dom::bits::error_handler_proxy<char> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- xml::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->setFeature (XMLUni::fgDOMValidation, validate);
- parser->setFeature (XMLUni::fgXercesSchema, validate);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
// Prepare input stream.
//
xml::sax::std_input_source isrc (is, id);
Wrapper4InputSource wrap (&isrc, false);
-#if _XERCES_VERSION >= 30000
xml::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap));
-#else
- xml::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
eh.throw_if_failed<tree::parsing<char> > ();