[xmltooling] 05/24: Remove legacy Xerces support.
Etienne Dysli Metref
edm-guest at moszumanska.debian.org
Fri Jan 12 15:53:56 UTC 2018
This is an automated email from the git hooks/post-receive script.
edm-guest pushed a commit to branch master
in repository xmltooling.
commit 89c23c2f42272f38cf02557f3e7be32a441b40d8
Author: Scott Cantor <cantor.2 at osu.edu>
Date: Mon Nov 27 16:16:23 2017 -0500
Remove legacy Xerces support.
---
config_win32.h | 11 ---
configure.ac | 45 +--------
.../AbstractAttributeExtensibleXMLObject.cpp | 19 +---
xmltooling/AbstractComplexElement.cpp | 11 +--
xmltooling/base.h | 31 ------
xmltooling/config_pub.h.in | 9 --
xmltooling/config_pub_win32.h | 11 ---
xmltooling/security/impl/BasicX509Credential.cpp | 8 --
xmltooling/security/impl/SecurityHelper.cpp | 8 --
xmltooling/util/CurlURLInputStream.h | 9 +-
xmltooling/util/ParserPool.cpp | 105 +--------------------
xmltooling/util/ParserPool.h | 35 +------
xmltooling/util/XMLHelper.cpp | 20 ----
xmltoolingtest/XMLObjectBaseTestCase.h | 4 -
14 files changed, 13 insertions(+), 313 deletions(-)
diff --git a/config_win32.h b/config_win32.h
index 40a58a8..1fba0c1 100644
--- a/config_win32.h
+++ b/config_win32.h
@@ -87,17 +87,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
-#include <xercesc/util/XercesVersion.hpp>
-
-#if (XERCES_VERSION_MAJOR >= 3)
-# define XMLTOOLING_XERCESC_COMPLIANT_DOMLS 1
-# define XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE 1
-# define XMLTOOLING_XERCESC_64BITSAFE 1
-# define XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE 1
-#else
-# define XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE 1
-#endif
-
/* Define to 1 if you have the `curl_off_t' type. */
#define HAVE_CURL_OFF_T 1
diff --git a/configure.ac b/configure.ac
index fe5ae0d..3db8054 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,57 +180,22 @@ fi
AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
AC_MSG_CHECKING([Xerces version])
+
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
-[#if _XERCES_VERSION != 20600
+[#if _XERCES_VERSION >= 30000
int i = 0;
#else
-#error cannot use version 2.6.0
+#error cannot use version 1.x or 2.x
#endif])],
[AC_MSG_RESULT(OK)],
- [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
+ [AC_MSG_FAILURE([Xerces-C 3.x is required])])
+
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
[[xercesc::XMLPlatformUtils::Initialize()]])],
,[AC_MSG_ERROR([unable to link with Xerces])])
-AC_MSG_CHECKING([whether Xerces is 64-bit clean])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/framework/MemBufInputSource.hpp>]],
- [[using namespace XERCES_CPP_NAMESPACE; XMLFilePos testvar;]])],
- [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_64BITSAFE],[1],[Define to 1 if Xerces has a 64-bit-safe API.])],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether Xerces BinInputStream requires getContentType])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/util/BinMemInputStream.hpp>]],
- [[using namespace XERCES_CPP_NAMESPACE; XMLByte buf[1024]; BinMemInputStream in(buf,1024); in.getContentType();]])],
- [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE],[1],[Define to 1 if Xerces InputStream class requires getContentType.])],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether Xerces DOMLS API is compliant])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
- [[using namespace XERCES_CPP_NAMESPACE;
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(NULL);
- DOMLSSerializer *ls = ((DOMImplementationLS*)impl)->createLSSerializer();]])],
- [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_COMPLIANT_DOMLS],[1],[Define to 1 if Xerces supports a compliant DOMLS API.])],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether Xerces has setIdAttribute(XMLCh*, bool)])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
- [[using namespace XERCES_CPP_NAMESPACE; DOMElement * elt; elt->setIdAttribute(NULL, false);]])],
- [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE],[1],[Define to 1 if Xerces DOM ID methods take extra parameter.])],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
- [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
- [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
- [AC_MSG_RESULT([no])])
-
# XML-Security settings
AC_ARG_WITH(xmlsec,
AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
diff --git a/xmltooling/AbstractAttributeExtensibleXMLObject.cpp b/xmltooling/AbstractAttributeExtensibleXMLObject.cpp
index 166e96c..13367d5 100644
--- a/xmltooling/AbstractAttributeExtensibleXMLObject.cpp
+++ b/xmltooling/AbstractAttributeExtensibleXMLObject.cpp
@@ -112,19 +112,14 @@ AbstractAttributeExtensibleXMLObject::AbstractAttributeExtensibleXMLObject(const
AbstractAttributeExtensibleXMLObject::~AbstractAttributeExtensibleXMLObject()
{
-#ifdef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- static void (*release)(XMLCh**) = &XMLString::release;
-#else
static void (*release)(XMLCh**,MemoryManager*) = &XMLString::release;
-#endif
+
for_each(
m_attributeMap.begin(), m_attributeMap.end(),
lambda::bind(
release,
- &lambda::bind(&map<xmltooling::QName,XMLCh*>::value_type::second, boost::ref(_1))
-#ifndef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- ,XMLPlatformUtils::fgMemoryManager
-#endif
+ &lambda::bind(&map<xmltooling::QName,XMLCh*>::value_type::second, boost::ref(_1)),
+ XMLPlatformUtils::fgMemoryManager
)
);
}
@@ -202,11 +197,7 @@ void AbstractAttributeExtensibleXMLObject::unmarshallExtensionAttribute(const DO
bool ID = attribute->isId() || isRegisteredIDAttribute(q);
setAttribute(q,attribute->getNodeValue(),ID);
if (ID) {
-#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
attribute->getOwnerElement()->setIdAttributeNode(attribute, true);
-#else
- attribute->getOwnerElement()->setIdAttributeNode(attribute);
-#endif
}
}
@@ -219,11 +210,7 @@ void AbstractAttributeExtensibleXMLObject::marshallExtensionAttributes(DOMElemen
attr->setNodeValue(i->second);
domElement->setAttributeNodeNS(attr);
if (m_idAttribute == i) {
-#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
domElement->setIdAttributeNode(attr, true);
-#else
- domElement->setIdAttributeNode(attr);
-#endif
}
}
}
diff --git a/xmltooling/AbstractComplexElement.cpp b/xmltooling/AbstractComplexElement.cpp
index a8e68ef..361ba2f 100644
--- a/xmltooling/AbstractComplexElement.cpp
+++ b/xmltooling/AbstractComplexElement.cpp
@@ -54,20 +54,11 @@ AbstractComplexElement::AbstractComplexElement(const AbstractComplexElement& src
}
AbstractComplexElement::~AbstractComplexElement() {
-#ifdef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- static void (*release)(XMLCh**) = &XMLString::release;
-#else
static void (*release)(XMLCh**,MemoryManager*) = &XMLString::release;
-#endif
for_each(m_children.begin(), m_children.end(), cleanup<XMLObject>());
for_each(m_text.begin(), m_text.end(),
- lambda::bind(
- release, &_1
-#ifndef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- ,XMLPlatformUtils::fgMemoryManager
-#endif
- )
+ lambda::bind(release, &_1, XMLPlatformUtils::fgMemoryManager)
);
}
diff --git a/xmltooling/base.h b/xmltooling/base.h
index 9c9b004..e11ad62 100644
--- a/xmltooling/base.h
+++ b/xmltooling/base.h
@@ -1146,7 +1146,6 @@
domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
}
-#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
/**
* Implements marshalling for an ID attribute
*
@@ -1159,20 +1158,6 @@
domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, true); \
}
-#else
-/**
- * Implements marshalling for an ID attribute
- *
- * @param proper the proper name of the attribute
- * @param ucase the upcased name of the attribute
- * @param namespaceURI the XML namespace of the attribute
- */
-# define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
- if (m_##proper && *m_##proper) { \
- domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
- domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
- }
-#endif
/**
* Implements unmarshalling process branch for a string attribute
@@ -1187,7 +1172,6 @@
return; \
}
-#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
/**
* Implements unmarshalling process branch for an ID attribute
*
@@ -1201,21 +1185,6 @@
attribute->getOwnerElement()->setIdAttributeNode(attribute, true); \
return; \
}
-#else
-/**
- * Implements unmarshalling process branch for an ID attribute
- *
- * @param proper the proper name of the attribute
- * @param ucase the upcased name of the attribute
- * @param namespaceURI the XML namespace of the attribute
- */
-# define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
- if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
- set##proper(attribute->getValue()); \
- attribute->getOwnerElement()->setIdAttributeNode(attribute); \
- return; \
- }
-#endif
/**
* Implements unmarshalling process branch for a DateTime attribute
diff --git a/xmltooling/config_pub.h.in b/xmltooling/config_pub.h.in
index be800c9..bbb002e 100644
--- a/xmltooling/config_pub.h.in
+++ b/xmltooling/config_pub.h.in
@@ -20,12 +20,3 @@
/* Define to 1 to disable XML-Security-dependent features. */
#undef XMLTOOLING_NO_XMLSEC
-
-/* Define to 1 if Xerces supports a compliant DOMLS API. */
-#undef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
-
-/* Define to 1 if Xerces DOM ID methods take extra parameter. */
-#undef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
-
-/* Define to 1 if Xerces has a 64-bit-safe API. */
-#undef XMLTOOLING_XERCESC_64BITSAFE
diff --git a/xmltooling/config_pub_win32.h b/xmltooling/config_pub_win32.h
index 8e35e78..843c3a7 100644
--- a/xmltooling/config_pub_win32.h
+++ b/xmltooling/config_pub_win32.h
@@ -43,17 +43,6 @@
/* Define to 1 to disable XML-Security-dependent features. */
/* #undef XMLTOOLING_NO_XMLSEC */
-/* Define if you wish to disable Xalan-dependent features. */
-#define XSEC_NO_XALAN
-
-#include <xercesc/util/XercesVersion.hpp>
-
-#if (XERCES_VERSION_MAJOR >= 3)
-# define XMLTOOLING_XERCESC_COMPLIANT_DOMLS 1
-# define XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE 1
-# define XMLTOOLING_XERCESC_64BITSAFE 1
-#endif
-
#ifndef XMLTOOLING_NO_XMLSEC
# include <xsec/framework/XSECDefs.hpp>
# if (_XSEC_VERSION_FULL >= 10500)
diff --git a/xmltooling/security/impl/BasicX509Credential.cpp b/xmltooling/security/impl/BasicX509Credential.cpp
index e523cf3..743934f 100644
--- a/xmltooling/security/impl/BasicX509Credential.cpp
+++ b/xmltooling/security/impl/BasicX509Credential.cpp
@@ -204,19 +204,11 @@ void BasicX509Credential::initKeyInfo(unsigned int types)
XMLByte* decoded = Base64::decode(reinterpret_cast<const XMLByte*>(buf.rawCharBuffer()), &x);
if (decoded) {
string xdig = SecurityHelper::doHash("SHA1", reinterpret_cast<char*>(decoded), x, false);
-#ifdef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
XMLByte* encoded = Base64::encode(reinterpret_cast<const XMLByte*>(xdig.c_str()), xdig.length(), &x);
if (encoded) {
auto_ptr_XMLCh widenit(reinterpret_cast<char*>(encoded));
-#ifdef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&encoded);
-#else
XMLString::release((char**)&encoded);
-#endif
X509Digest* x509dig = X509DigestBuilder::buildX509Digest();
x509dig->setValue(widenit.get());
x509dig->setAlgorithm(DSIGConstants::s_unicodeStrURISHA1);
diff --git a/xmltooling/security/impl/SecurityHelper.cpp b/xmltooling/security/impl/SecurityHelper.cpp
index 0cefcc3..b71f8b7 100644
--- a/xmltooling/security/impl/SecurityHelper.cpp
+++ b/xmltooling/security/impl/SecurityHelper.cpp
@@ -747,11 +747,7 @@ XSECCryptoKey* SecurityHelper::fromDEREncoding(const char* buf, unsigned long bu
EVP_PKEY* pkey = d2i_PUBKEY_bio(b, nullptr);
BIO_free(b);
if (base64) {
-#ifdef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
}
if (pkey) {
@@ -795,10 +791,6 @@ XSECCryptoKey* SecurityHelper::fromDEREncoding(const XMLCh* buf)
return nullptr;
}
XSECCryptoKey* ret = fromDEREncoding((const char*)decoded, x, false);
-#ifdef XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
return ret;
}
diff --git a/xmltooling/util/CurlURLInputStream.h b/xmltooling/util/CurlURLInputStream.h
index eb5fb01..5ad0473 100644
--- a/xmltooling/util/CurlURLInputStream.h
+++ b/xmltooling/util/CurlURLInputStream.h
@@ -78,20 +78,13 @@ namespace xmltooling {
~CurlURLInputStream();
-#ifdef XMLTOOLING_XERCESC_64BITSAFE
- XMLFilePos
-#else
- unsigned int
-#endif
- curPos() const {
+ XMLFilePos curPos() const {
return fTotalBytesRead;
}
-#ifdef XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE
const XMLCh* getContentType() const {
return fContentType;
}
-#endif
XMLSize_t readBytes(XMLByte* const toFill, const XMLSize_t maxToRead);
diff --git a/xmltooling/util/ParserPool.cpp b/xmltooling/util/ParserPool.cpp
index 7d6cb3f..4ba983b 100644
--- a/xmltooling/util/ParserPool.cpp
+++ b/xmltooling/util/ParserPool.cpp
@@ -130,8 +130,6 @@ DOMDocument* ParserPool::newDocument()
return DOMImplementationRegistry::getDOMImplementation(nullptr)->createDocument();
}
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
-
DOMDocument* ParserPool::parse(DOMLSInput& domsrc)
{
DOMLSParser* parser=checkoutBuilder();
@@ -165,43 +163,6 @@ DOMDocument* ParserPool::parse(DOMLSInput& domsrc)
}
}
-#else
-
-DOMDocument* ParserPool::parse(DOMInputSource& domsrc)
-{
- DOMBuilder* parser=checkoutBuilder();
- XercesJanitor<DOMBuilder> janitor(parser);
- try {
- MyErrorHandler deh;
- parser->setErrorHandler(&deh);
- DOMDocument* doc=parser->parse(domsrc);
- if (deh.errors) {
- if (doc)
- doc->release();
- throw XMLParserException("XML error(s) during parsing, check log for specifics");
- }
- parser->setErrorHandler(nullptr);
- parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
- checkinBuilder(janitor.release());
- return doc;
- }
- catch (XMLException& ex) {
- parser->setErrorHandler(nullptr);
- parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
- checkinBuilder(janitor.release());
- auto_ptr_char temp(ex.getMessage());
- throw XMLParserException(string("Xerces error during parsing: ") + (temp.get() ? temp.get() : "no message"));
- }
- catch (XMLToolingException&) {
- parser->setErrorHandler(nullptr);
- parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
- checkinBuilder(janitor.release());
- throw;
- }
-}
-
-#endif
-
DOMDocument* ParserPool::parse(istream& is)
{
StreamInputSource src(is);
@@ -343,7 +304,6 @@ bool ParserPool::loadCatalog(const XMLCh* pathname)
return true;
}
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
DOMLSInput* ParserPool::resolveResource(
const XMLCh *const resourceType,
const XMLCh *const namespaceUri,
@@ -351,11 +311,6 @@ DOMLSInput* ParserPool::resolveResource(
const XMLCh *const systemId,
const XMLCh *const baseURI
)
-#else
-DOMInputSource* ParserPool::resolveEntity(
- const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI
- )
-#endif
{
#if _DEBUG
xmltooling::NDC ndc("resolveEntity");
@@ -396,8 +351,6 @@ DOMInputSource* ParserPool::resolveEntity(
return new Wrapper4InputSource(new MemBufInputSource(nullbuf, 0, systemId));
}
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
-
DOMLSParser* ParserPool::createBuilder()
{
static const XMLCh impltype[] = { chLatin_L, chLatin_S, chNull };
@@ -443,55 +396,6 @@ void ParserPool::checkinBuilder(DOMLSParser* builder)
}
}
-#else
-
-DOMBuilder* ParserPool::createBuilder()
-{
- static const XMLCh impltype[] = { chLatin_L, chLatin_S, chNull };
- DOMImplementation* impl=DOMImplementationRegistry::getDOMImplementation(impltype);
- DOMBuilder* parser=static_cast<DOMImplementationLS*>(impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0);
- parser->setFeature(XMLUni::fgDOMNamespaces, m_namespaceAware);
- if (m_schemaAware) {
- parser->setFeature(XMLUni::fgDOMNamespaces, true);
- parser->setFeature(XMLUni::fgXercesSchema, true);
- parser->setFeature(XMLUni::fgDOMValidation, true);
- parser->setFeature(XMLUni::fgXercesCacheGrammarFromParse, true);
-
- // We build a "fake" schema location hint that binds each namespace to itself.
- // This ensures the entity resolver will be given the namespace as a systemId it can check.
- parser->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,const_cast<XMLCh*>(m_schemaLocations.c_str()));
- }
- parser->setProperty(XMLUni::fgXercesSecurityManager, m_security.get());
- parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
- parser->setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, true);
- parser->setEntityResolver(this);
- return parser;
-}
-
-DOMBuilder* ParserPool::checkoutBuilder()
-{
- Lock lock(m_lock);
- if (m_pool.empty()) {
- DOMBuilder* builder=createBuilder();
- return builder;
- }
- DOMBuilder* p=m_pool.top();
- m_pool.pop();
- if (m_schemaAware)
- p->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,const_cast<XMLCh*>(m_schemaLocations.c_str()));
- return p;
-}
-
-void ParserPool::checkinBuilder(DOMBuilder* builder)
-{
- if (builder) {
- Lock lock(m_lock);
- m_pool.push(builder);
- }
-}
-
-#endif
-
StreamInputSource::StreamInputSource(istream& is, const char* systemId) : InputSource(systemId), m_is(is)
{
}
@@ -505,22 +409,15 @@ StreamInputSource::StreamBinInputStream::StreamBinInputStream(istream& is) : m_i
{
}
-#ifdef XMLTOOLING_XERCESC_64BITSAFE
-XMLFilePos
-#else
-unsigned int
-#endif
-StreamInputSource::StreamBinInputStream::curPos() const
+XMLFilePos StreamInputSource::StreamBinInputStream::curPos() const
{
return m_pos;
}
-#ifdef XMLTOOLING_XERCESC_64BITSAFE
const XMLCh* StreamInputSource::StreamBinInputStream::getContentType() const
{
return nullptr;
}
-#endif
XMLSize_t StreamInputSource::StreamBinInputStream::readBytes(XMLByte* const toFill, const XMLSize_t maxToRead)
{
diff --git a/xmltooling/util/ParserPool.h b/xmltooling/util/ParserPool.h
index 9d6fc0f..dd42c28 100644
--- a/xmltooling/util/ParserPool.h
+++ b/xmltooling/util/ParserPool.h
@@ -56,12 +56,7 @@ namespace xmltooling {
/**
* A thread-safe pool of DOMBuilders that share characteristics.
*/
- class XMLTOOL_API ParserPool :
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
- public xercesc::DOMLSResourceResolver
-#else
- public xercesc::DOMEntityResolver
-#endif
+ class XMLTOOL_API ParserPool : public xercesc::DOMLSResourceResolver
{
MAKE_NONCOPYABLE(ParserPool);
public:
@@ -89,13 +84,7 @@ namespace xmltooling {
* @return The DOM document resulting from the parse
* @throws XMLParserException thrown if there was a problem reading, parsing, or validating the XML
*/
- xercesc::DOMDocument* parse(
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
- xercesc::DOMLSInput& domsrc
-#else
- xercesc::DOMInputSource& domsrc
-#endif
- );
+ xercesc::DOMDocument* parse(xercesc::DOMLSInput& domsrc);
/**
* Parses a document using a pooled parser with the proper settings
@@ -156,7 +145,6 @@ namespace xmltooling {
/**
* Supplies all external entities (primarily schemas) to the parser
*/
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
xercesc::DOMLSInput* resolveResource(
const XMLCh *const resourceType,
const XMLCh *const namespaceUri,
@@ -164,32 +152,17 @@ namespace xmltooling {
const XMLCh *const systemId,
const XMLCh *const baseURI
);
-#else
- xercesc::DOMInputSource* resolveEntity(
- const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI
- );
-#endif
private:
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
xercesc::DOMLSParser* createBuilder();
xercesc::DOMLSParser* checkoutBuilder();
void checkinBuilder(xercesc::DOMLSParser* builder);
-#else
- xercesc::DOMBuilder* createBuilder();
- xercesc::DOMBuilder* checkoutBuilder();
- void checkinBuilder(xercesc::DOMBuilder* builder);
-#endif
xstring m_schemaLocations;
std::map<xstring,xstring> m_schemaLocMap;
bool m_namespaceAware,m_schemaAware;
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
std::stack<xercesc::DOMLSParser*> m_pool;
-#else
- std::stack<xercesc::DOMBuilder*> m_pool;
-#endif
std::auto_ptr<Mutex> m_lock;
std::auto_ptr<xercesc::SecurityManager> m_security;
};
@@ -225,12 +198,8 @@ namespace xmltooling {
*/
StreamBinInputStream(std::istream& is);
/// @cond off
-#ifdef XMLTOOLING_XERCESC_64BITSAFE
XMLFilePos curPos() const;
const XMLCh* getContentType() const;
-#else
- unsigned int curPos() const;
-#endif
XMLSize_t readBytes(XMLByte* const toFill, const XMLSize_t maxToRead);
/// @endcond
private:
diff --git a/xmltooling/util/XMLHelper.cpp b/xmltooling/util/XMLHelper.cpp
index 212beb3..df2ffc1 100644
--- a/xmltooling/util/XMLHelper.cpp
+++ b/xmltooling/util/XMLHelper.cpp
@@ -404,7 +404,6 @@ void XMLHelper::serialize(const DOMNode* n, std::string& buf, bool pretty)
MemBufFormatTarget target;
DOMImplementation* impl=DOMImplementationRegistry::getDOMImplementation(impltype);
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
DOMLSSerializer* serializer = static_cast<DOMImplementationLS*>(impl)->createLSSerializer();
XercesJanitor<DOMLSSerializer> janitor(serializer);
if (pretty && serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, pretty))
@@ -415,15 +414,6 @@ void XMLHelper::serialize(const DOMNode* n, std::string& buf, bool pretty)
theOutput->setByteStream(&target);
if (!serializer->write(n, theOutput))
throw XMLParserException("unable to serialize XML");
-#else
- DOMWriter* serializer = static_cast<DOMImplementationLS*>(impl)->createDOMWriter();
- XercesJanitor<DOMWriter> janitor(serializer);
- serializer->setEncoding(UTF8);
- if (pretty && serializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, pretty))
- serializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, pretty);
- if (!serializer->writeNode(&target, *n))
- throw XMLParserException("unable to serialize XML");
-#endif
buf.erase();
buf.append(reinterpret_cast<const char*>(target.getRawBuffer()),target.getLen());
@@ -457,7 +447,6 @@ ostream& XMLHelper::serialize(const DOMNode* n, ostream& out, bool pretty)
StreamFormatTarget target(out);
DOMImplementation* impl=DOMImplementationRegistry::getDOMImplementation(impltype);
-#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
DOMLSSerializer* serializer = static_cast<DOMImplementationLS*>(impl)->createLSSerializer();
XercesJanitor<DOMLSSerializer> janitor(serializer);
if (pretty && serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, pretty))
@@ -468,15 +457,6 @@ ostream& XMLHelper::serialize(const DOMNode* n, ostream& out, bool pretty)
theOutput->setByteStream(&target);
if (!serializer->write(n, theOutput))
throw XMLParserException("unable to serialize XML");
-#else
- DOMWriter* serializer=(static_cast<DOMImplementationLS*>(impl))->createDOMWriter();
- XercesJanitor<DOMWriter> janitor(serializer);
- serializer->setEncoding(UTF8);
- if (pretty && serializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, pretty))
- serializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, pretty);
- if (!serializer->writeNode(&target,*n))
- throw XMLParserException("unable to serialize XML");
-#endif
return out;
}
diff --git a/xmltoolingtest/XMLObjectBaseTestCase.h b/xmltoolingtest/XMLObjectBaseTestCase.h
index c51a4ff..73200eb 100644
--- a/xmltoolingtest/XMLObjectBaseTestCase.h
+++ b/xmltoolingtest/XMLObjectBaseTestCase.h
@@ -132,11 +132,7 @@ protected:
void marshallAttributes(xercesc::DOMElement* domElement) const {
if(getId()) {
domElement->setAttributeNS(nullptr, SimpleXMLObject::ID_ATTRIB_NAME, getId());
-#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
domElement->setIdAttributeNS(nullptr, SimpleXMLObject::ID_ATTRIB_NAME, true);
-#else
- domElement->setIdAttributeNS(nullptr, SimpleXMLObject::ID_ATTRIB_NAME);
-#endif
}
marshallExtensionAttributes(domElement);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/xmltooling.git
More information about the Pkg-shibboleth-devel
mailing list