summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README-DEV17
-rw-r--r--TODO12
-rw-r--r--libxerces-c/.gitignore6
-rw-r--r--libxerces-c/INSTALL11
-rw-r--r--libxerces-c/README-DEV46
-rw-r--r--libxerces-c/build/root.build19
-rw-r--r--libxerces-c/buildfile2
-rw-r--r--libxerces-c/manifest102
-rw-r--r--libxerces-c/tests/build/root.build4
-rw-r--r--libxerces-c/tests/buildfile4
-rw-r--r--libxerces-c/tests/dom-print/.gitattributes1
l---------[-rw-r--r--]libxerces-c/tests/net-accessor/NetAccessorTest.cpp168
-rw-r--r--libxerces-c/tests/net-accessor/handle-exception-as-error.patch35
-rw-r--r--libxerces-c/tests/net-accessor/testscript3
-rw-r--r--libxerces-c/tests/psvi-writer/.gitattributes1
-rw-r--r--libxerces-c/tests/reader-mgr/ReaderMgrTest.cpp168
-rw-r--r--libxerces-c/tests/reader-mgr/buildfile8
-rw-r--r--libxerces-c/tests/reader-mgr/characters.ent297
-rw-r--r--libxerces-c/tests/reader-mgr/links.ent24
-rw-r--r--libxerces-c/tests/reader-mgr/personal.dtd17
-rw-r--r--libxerces-c/tests/reader-mgr/testscript8
-rw-r--r--libxerces-c/tests/sax-print/.gitattributes1
-rw-r--r--libxerces-c/tests/sax2-print/.gitattributes1
-rw-r--r--libxerces-c/xercesc/.gitattributes8
-rw-r--r--libxerces-c/xercesc/buildfile73
-rw-r--r--libxerces-c/xercesc/config.h24
-rw-r--r--libxerces-c/xercesc/util/.gitattributes2
l---------libxerces-c/xercesc/util/Transcoders/MacOSUnicodeConverter1
l---------libxerces-c/xercesc/util/Transcoders/Win321
-rw-r--r--libxerces-c/xercesc/util/Xerces_autoconf_config.hpp11
m---------upstream0
31 files changed, 812 insertions, 263 deletions
diff --git a/README-DEV b/README-DEV
index dbe777f..c7933ce 100644
--- a/README-DEV
+++ b/README-DEV
@@ -87,6 +87,18 @@ build2, we end up with the following configuration options:
See the configuration options description at the "Build Instructions" page
(http://xerces.apache.org/xerces-c/build-3.html).
+We, however, disable the network support by default, replacing the
+--enable-netaccessor-curl option with --disable-network. The user, will still
+be able to enable network by setting the config.libxerces_c.network project
+configuration variable to true.
+
+Also we use a native transcoder on Mac OS and Windows by default, replacing
+the --enable-transcoder-icu option with
+--enable-transcoder-macosunicodeconverter and --enable-transcoder-windows,
+respectively. The user, will still be able to enable the ICU transcoder by
+setting the config.libxerces_c.transcoder_icu project configuration variable
+to true.
+
Normally, when packaging a project, we need to replace some auto-generated
headers with our own implementations, deduce the compilation/linking options
and the source files to compile. For Xerces-C++ we can rely on the
@@ -109,9 +121,8 @@ $ ../configure --enable-netaccessor-curl --enable-transcoder-icu \
$ make V=1 >>build.log 2>&1
Note that on Windows, to reduce complexity, we may build the upstream package
-with the native network accessor and transcoder (rather than with the cURL-
-based network accessor and ICU-based transcoder) as it doesn't really affect
-the compilation and linking options.
+with the native network accessor (rather than with the cURL-based network
+accessor).
For MSVC:
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..4d343a7
--- /dev/null
+++ b/TODO
@@ -0,0 +1,12 @@
+On the revision:
+
+On the release:
+
+ Note that here we record items that require bumping build2 version
+ requirement to the latest released version of the toolchain.
+
+Additional (permanent) notes:
+
+- Review '@@ TMP' notes.
+
+- Add/remove 'priority: security' manifest value, if required.
diff --git a/libxerces-c/.gitignore b/libxerces-c/.gitignore
index 4c4fec7..d4a1da2 100644
--- a/libxerces-c/.gitignore
+++ b/libxerces-c/.gitignore
@@ -3,11 +3,17 @@
*.d
*.t
*.i
+*.i.*
*.ii
+*.ii.*
*.o
*.obj
+*.gcm
+*.pcm
+*.ifc
*.so
*.so.*
+*.dylib
*.dll
*.a
*.lib
diff --git a/libxerces-c/INSTALL b/libxerces-c/INSTALL
index bfa5487..ef4e54f 100644
--- a/libxerces-c/INSTALL
+++ b/libxerces-c/INSTALL
@@ -5,3 +5,14 @@ $ bpkg build libxerces-c
But if you don't want to use the package manager, then you can also build this
package manually using the standard build2 build system.
+
+Note that by default libxerces-c is built without network support. To enable
+it, run the following command instead:
+
+$ bpkg build libxerces-c +{ config.libxerces_c.network=true }
+
+Also note that by default libxerces-c is built with a native transcoder on Mac
+OS and Windows. To enable the ICU transcoder, run the following command
+instead:
+
+$ bpkg build libxerces-c +{ config.libxerces_c.transcoder_icu=true }
diff --git a/libxerces-c/README-DEV b/libxerces-c/README-DEV
index 78f4179..ea60100 100644
--- a/libxerces-c/README-DEV
+++ b/libxerces-c/README-DEV
@@ -6,22 +6,25 @@ Symlink the required upstream files and provide our own implementations for
auto-generated headers:
$ ln -s ../upstream/LICENSE
-$ ln -s ../../upstream/src/xercesc/{dom,framework,internal,parsers,sax,sax2,\
-validators,xinclude} xercesc/
+$ ln -s ../../upstream/src/xercesc/{dom,framework,parsers,sax,sax2,validators,xinclude} \
+ xercesc/
$ ln -s ../../upstream/src/{stricmp,strnicmp}.{h,c} xercesc/
+$ mkdir xercesc/util/
+
$ pushd xercesc/util/
$ ln -s ../../../upstream/src/xercesc/util/*.{cpp,hpp,c} ./
$ ln -s ../../../upstream/src/xercesc/util/{regx,FileManagers} ./
-Note that the main reason for such a granular linking (we could just link
-upstream's Transcoders/, etc) is reducing the number of preprocessor macros we
-need to deduce in xercesc/config.h (see the change tracking instructions
-below for details). As a bonus it also simplifies the buildfile.
+Note that the main reasons for such a granular linking (we could just link
+upstream's util/, etc) are source code patching and reducing the number of
+preprocessor macros we need to deduce in xercesc/config.h (see the change
+tracking instructions below for details). As a bonus it also simplifies the
+buildfile.
$ mkdir -p Transcoders NetAccessors MsgLoaders MutexManagers
-$ ln -s ../../../../upstream/src/xercesc/util/Transcoders/ICU Transcoders/
+$ ln -s ../../../../upstream/src/xercesc/util/Transcoders/{ICU,MacOSUnicodeConverter,Win32} Transcoders/
$ ln -s ../../../../upstream/src/xercesc/util/NetAccessors/Curl NetAccessors/
$ ln -s ../../../../upstream/src/xercesc/util/MsgLoaders/InMemory MsgLoaders/
$ ln -s ../../../../upstream/src/xercesc/util/MutexManagers/StdMutexMgr.{hpp,cpp} MutexManagers/
@@ -30,36 +33,27 @@ $ ln -s ../../../upstream/src/xercesc/util/XercesVersion.hpp.cmake.in \
XercesVersion.hpp.in
$ popd
-We also patch the explicit template instantiation declarations and definitions
-(see xercesc/util/Xerces_autoconf_config.hpp for details):
-
-$ cp --remove-destination ../upstream/src/xercesc/util/{Janitor.hpp,JanitorExports.cpp} \
- xercesc/util/
-
-$ git apply xercesc/export-template-instantiations.patch
-
-Note that the patch is produced by the following command:
-
-$ git diff >xercesc/export-template-instantiations.patch
-
Use some of the upstream's tests and examples for testing:
$ ln -s ../../../upstream/samples/src/DOMPrint tests/dom-print/
$ ln -s ../../../upstream/samples/src/SAXPrint tests/sax-print/
$ ln -s ../../../upstream/samples/src/SAX2Print tests/sax2-print/
$ ln -s ../../../upstream/samples/src/PSVIWriter tests/psvi-writer/
+$ ln -s ../../../upstream/tests/src/NetAccessorTest/NetAccessorTest.cpp tests/net-accessor
+
+We also apply the following patches:
-We also patch the net accessor test, which by some reason exits with the zero
-status printing the diagnostics to stdout for some errors:
+1) The explicit template instantiation declarations and definitions patch (see
+ xercesc/util/Xerces_autoconf_config.hpp for details):
-$ cp ../upstream/tests/src/NetAccessorTest/NetAccessorTest.cpp \
- tests/net-accessor/
+ $ cp --remove-destination ../upstream/src/xercesc/util/{Janitor.hpp,JanitorExports.cpp} \
+ xercesc/util/
-$ git apply tests/net-accessor/handle-exception-as-error.patch
+ $ git apply xercesc/export-template-instantiations.patch
-Note that the patch is produced by the following command:
+Note that the above patches are produced by the following commands:
-$ git diff >tests/net-accessor/handle-exception-as-error.patch
+$ git diff ><patch-path>
Create xercesc/{config.h,util/Xerces_autoconf_config.hpp} using as a base the
upstream's config.h.cmake.in, config.h.in, and
diff --git a/libxerces-c/build/root.build b/libxerces-c/build/root.build
index 92eb1cb..d61764c 100644
--- a/libxerces-c/build/root.build
+++ b/libxerces-c/build/root.build
@@ -24,3 +24,22 @@ if ($c.target.system == 'win32-msvc')
if ($c.class == 'msvc')
cc.coptions += /wd4251 /wd4275 /wd4800
+
+# Enable network support so that the parser can download remote resources
+# (schemas, DTDs, etc).
+#
+# If enabled, then the libcurl library is used to access network resources.
+#
+config [bool] config.libxerces_c.network ?= false
+
+# We use ICU everywhere except on Mac OS and Windows where we by default
+# use native transcoders (but can still be forced to use ICU instead).
+#
+config [bool] config.libxerces_c.transcoder_icu ?= \
+ ($cxx.target.class != 'macos' && $cxx.target.class != 'windows')
+
+if! $config.libxerces_c.transcoder_icu
+{
+ assert ($cxx.target.class == 'macos' || $cxx.target.class == 'windows') \
+ "only ICU transcoder is supported on $cxx.target.class"
+}
diff --git a/libxerces-c/buildfile b/libxerces-c/buildfile
index 28aa742..7f4fe5e 100644
--- a/libxerces-c/buildfile
+++ b/libxerces-c/buildfile
@@ -1,7 +1,7 @@
# file : buildfile
# license : Apache License 2.0; see accompanying LICENSE file
-./: {*/ -build/} doc{LICENSE INSTALL README} manifest
+./: {*/ -build/} doc{INSTALL README} legal{LICENSE} manifest
# Don't install tests or the INSTALL file.
#
diff --git a/libxerces-c/manifest b/libxerces-c/manifest
index c40c2e6..5f20f36 100644
--- a/libxerces-c/manifest
+++ b/libxerces-c/manifest
@@ -3,9 +3,11 @@ name: libxerces-c
# Note: remember to update doc-url below!
#
-version: 3.2.3+1
+version: 3.2.5
+language: c++
project: xerces-c
+priority: security
summary: Validating XML parsing and serialization C++ library
license: Apache-2.0 ; Apache License 2.0.
topics: Xerces, C++, XML parser, DOM, SAX
@@ -17,14 +19,96 @@ package-url: https://git.build2.org/cgit/packaging/xerces-c/
email: c-users@xerces.apache.org ; Mailing list.
package-email: packaging@build2.org ; Mailing list.
build-error-email: builds@build2.org
+depends: * build2 >= 0.15.0
+depends: * bpkg >= 0.15.0
+depends: libcurl ^7.67.0 ? ($config.libxerces_c.network)
+depends: {libicuuc libicui18n} >= 65.1.0 ? ($config.libxerces_c.transcoder_icu)
-# Don't build the legacy configurations since the respective machines may not
-# have enough disk space for that.
+transcoder-icu-builds: macos windows
+transcoder-icu-build-config:
+\
+config.libxerces_c.transcoder_icu=true
+;
+Test with ICU transcoder on Mac OS and Windows.
+\
+
+# Binary distribution packages. Overall notes:
+#
+# - Build as C++11 for maximum compatibility (this is a C++98 codebase).
+
+# On RHEL the Xerces-C++ package is only available from EPEL and usually of
+# an outdated version. So we build one ourselves.
+#
+bindist-rhel-builds: bindist
+bindist-rhel-build-include: linux_rhel*-**
+bindist-rhel-build-exclude: **
+bindist-rhel-build-config:
+\
++bpkg.bindist.fedora:
++bbot.bindist.upload:
+b.create:config.cxx.std=c++11
+?sys:libicuuc
+?sys:libicui18n
+\
+
+# On Ubuntu the Xerces-C++ package is only available from the `universe`
+# section (unsupported community packages, but enabled by default unlike
+# EPEL) and usually of an outdated version. So we build one ourselves.
#
-builds: default
+bindist-ubuntu-builds: bindist
+bindist-ubuntu-build-include: linux_ubuntu*-**
+bindist-ubuntu-build-exclude: **
+bindist-ubuntu-build-config:
+\
++bpkg.bindist.debian:
++bbot.bindist.upload:
+b.create:config.cxx.std=c++11
+?sys:libicuuc
+?sys:libicui18n
+\
-depends: * build2 >= 0.12.0
-depends: * bpkg >= 0.12.0
-depends: libcurl >= 7.67.0
-depends: libicuuc >= 65.1.0
-depends: libicui18n >= 65.1.0
+# Windows binary distribution archives (debug and release).
+#
+# - For Debug we only produce the shared library (if we wanted to also do
+# static, then would need to use /Z7).
+#
+bindist-windows-release-builds: bindist
+bindist-windows-release-build-include: windows*-**
+bindist-windows-release-build-exclude: **
+bindist-windows-release-build-config:
+\
++bpkg.bindist.archive:
++bbot.bindist.upload:
+bpkg.bindist.archive:config.install.relocatable=true
+b.create:config.cc.coptions="/W2 /O2"
+b.create:config.cxx.std=c++11
+\
+
+bindist-windows-debug-builds: bindist
+bindist-windows-debug-build-include: windows*-**
+bindist-windows-debug-build-exclude: **
+bindist-windows-debug-build-config:
+\
++bpkg.bindist.archive:
++bbot.bindist.upload:
+bpkg.bindist.archive:config.install.relocatable=true
+bpkg.bindist.archive:--archive-build-meta=+debug
+bpkg.create:config.bin.lib=shared
+b.create:config.cc.coptions="/W2 /Zi /MDd"
+b.create:config.cc.loptions="/DEBUG:FULL"
+b.create:config.cxx.std=c++11
+\
+
+# Mac OS binary distribution archives.
+#
+bindist-macos-builds: bindist
+bindist-macos-build-include: macos*-**
+bindist-macos-build-exclude: **
+bindist-macos-build-config:
+\
++bpkg.bindist.archive:
++bbot.bindist.upload:
+bpkg.bindist.archive:config.install.relocatable=true
+b.create:config.cc.coptions="-Wall -O3"
+b.create:config.cxx.std=c++11
+\
diff --git a/libxerces-c/tests/build/root.build b/libxerces-c/tests/build/root.build
index 7bf1cba..261a20a 100644
--- a/libxerces-c/tests/build/root.build
+++ b/libxerces-c/tests/build/root.build
@@ -1,6 +1,10 @@
# file : tests/build/root.build
# license : Apache License 2.0; see accompanying LICENSE file
+# Test network support (see parent project for details).
+#
+config [bool] config.libxerces_c.network ?= false
+
cxx.std = latest
using cxx
diff --git a/libxerces-c/tests/buildfile b/libxerces-c/tests/buildfile
index f1869ed..08636f9 100644
--- a/libxerces-c/tests/buildfile
+++ b/libxerces-c/tests/buildfile
@@ -1,4 +1,6 @@
# file : tests/buildfile
# license : Apache License 2.0; see accompanying LICENSE file
-./: {*/ -build/}
+./: {*/ -build/ -net-accessor/}
+
+./: net-accessor/: include = $config.libxerces_c.network
diff --git a/libxerces-c/tests/dom-print/.gitattributes b/libxerces-c/tests/dom-print/.gitattributes
new file mode 100644
index 0000000..fe24c88
--- /dev/null
+++ b/libxerces-c/tests/dom-print/.gitattributes
@@ -0,0 +1 @@
+DOMPrint symlink=dir
diff --git a/libxerces-c/tests/net-accessor/NetAccessorTest.cpp b/libxerces-c/tests/net-accessor/NetAccessorTest.cpp
index c2affbd..d5c0609 100644..120000
--- a/libxerces-c/tests/net-accessor/NetAccessorTest.cpp
+++ b/libxerces-c/tests/net-accessor/NetAccessorTest.cpp
@@ -1,167 +1 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id$
- *
- */
-
-
-// ---------------------------------------------------------------------------
-// Includes
-// ---------------------------------------------------------------------------
-#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLURL.hpp>
-#include <xercesc/util/XMLNetAccessor.hpp>
-#include <xercesc/util/BinInputStream.hpp>
-
-#if defined(XERCES_NEW_IOSTREAMS)
-#include <iostream>
-#else
-#include <iostream.h>
-#endif
-
-XERCES_CPP_NAMESPACE_USE
-
-
-inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& os, const XMLCh* xmlStr)
-{
- char* transcoded = XMLString::transcode(xmlStr);
- os << transcoded;
- XMLString::release(&transcoded);
- return os;
-}
-
-
-void
-exercise(BinInputStream& stream)
-{
- static float percents[] = { 1.0, 0.5, 0.25, 0.1, 0.15, 0.113, 0.333, 0.0015, 0.0013 };
- int numPercents = sizeof(percents) / sizeof(float);
-
- const unsigned int bufferMax = 4096;
- XMLByte buffer[bufferMax];
-
- int iteration = 0;
- unsigned int bytesRead = 0;
- do {
- // Calculate a percentage of our maximum buffer size, going through
- // them round-robin
- float percent = percents[iteration % numPercents];
- unsigned int bufCnt = (unsigned int)(bufferMax * percent);
-
- // Check to make sure we didn't go out of bounds
- if (bufCnt <= 0)
- bufCnt = 1;
- if (bufCnt > bufferMax)
- bufCnt = bufferMax;
-
- // Read bytes into our buffer
- bytesRead = stream.readBytes(buffer, bufCnt);
- //XERCES_STD_QUALIFIER cerr << "Read " << bytesRead << " bytes into a " << bufCnt << " byte buffer\n";
-
- if (bytesRead > 0)
- {
- // Write the data to standard out
- XERCES_STD_QUALIFIER cout.write((char*)buffer, bytesRead);
- }
-
- ++iteration;
- } while (bytesRead > 0);
-}
-
-
-// ---------------------------------------------------------------------------
-// Program entry point
-// ---------------------------------------------------------------------------
-int
-main(int argc, char** argv)
-{
- // Init the XML platform
- try
- {
- XMLPlatformUtils::Initialize();
- }
-
- catch(const XMLException& toCatch)
- {
- XERCES_STD_QUALIFIER cout << "Error during platform init! Message:\n"
- << toCatch.getMessage() << XERCES_STD_QUALIFIER endl;
- return 1;
- }
-
- // Look for our one and only parameter
- if (argc != 2)
- {
- XERCES_STD_QUALIFIER cerr << "Usage: NetAccessorTest url\n"
- "\n"
- "This test reads data from the given url and writes the result\n"
- "to standard output.\n"
- "\n"
- "A variety of buffer sizes is are used during the test.\n"
- "\n"
- ;
- exit(1);
- }
-
- // Get the URL
- char* url = argv[1];
-
- int r = 1;
-
- // Do the test
- try
- {
- XMLURL xmlURL(url);
-
- // Get the netaccessor
- XMLNetAccessor* na = XMLPlatformUtils::fgNetAccessor;
- if (na == 0)
- {
- XERCES_STD_QUALIFIER cerr << "No netaccessor is available. Aborting.\n";
- exit(2);
- }
-
- // Build a binary input stream
- BinInputStream* is = na->makeNew(xmlURL);
- if (is == 0)
- {
- XERCES_STD_QUALIFIER cerr << "No binary input stream created. Aborting.\n";
- exit(3);
- }
-
- // Exercise the inputstream
- exercise(*is);
-
- // Delete the is
- delete is;
- r = 0;
- }
- catch(const XMLException& toCatch)
- {
- XERCES_STD_QUALIFIER cerr << "Exception during test:\n "
- << toCatch.getMessage()
- << XERCES_STD_QUALIFIER endl;
- }
-
- // And call the termination method
- XMLPlatformUtils::Terminate();
-
- return r;
-}
-
+../../../upstream/tests/src/NetAccessorTest/NetAccessorTest.cpp \ No newline at end of file
diff --git a/libxerces-c/tests/net-accessor/handle-exception-as-error.patch b/libxerces-c/tests/net-accessor/handle-exception-as-error.patch
deleted file mode 100644
index 674e5ba..0000000
--- a/libxerces-c/tests/net-accessor/handle-exception-as-error.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git a/libxerces-c/tests/net-accessor/NetAccessorTest.cpp b/libxerces-c/tests/net-accessor/NetAccessorTest.cpp
-index 3bb735b..c2affbd 100644
---- a/libxerces-c/tests/net-accessor/NetAccessorTest.cpp
-+++ b/libxerces-c/tests/net-accessor/NetAccessorTest.cpp
-@@ -122,6 +122,8 @@ main(int argc, char** argv)
- // Get the URL
- char* url = argv[1];
-
-+ int r = 1;
-+
- // Do the test
- try
- {
-@@ -148,11 +150,11 @@ main(int argc, char** argv)
-
- // Delete the is
- delete is;
--
-+ r = 0;
- }
- catch(const XMLException& toCatch)
- {
-- XERCES_STD_QUALIFIER cout << "Exception during test:\n "
-+ XERCES_STD_QUALIFIER cerr << "Exception during test:\n "
- << toCatch.getMessage()
- << XERCES_STD_QUALIFIER endl;
- }
-@@ -160,6 +162,6 @@ main(int argc, char** argv)
- // And call the termination method
- XMLPlatformUtils::Terminate();
-
-- return 0;
-+ return r;
- }
-
diff --git a/libxerces-c/tests/net-accessor/testscript b/libxerces-c/tests/net-accessor/testscript
index 993423b..55a810a 100644
--- a/libxerces-c/tests/net-accessor/testscript
+++ b/libxerces-c/tests/net-accessor/testscript
@@ -15,7 +15,8 @@ $* 'http://www.example.com' >>~%EOO%
:
: Test that an HTTPS URL is queried successfully using libcurl via the system
: SSL backend on Windows and MacOS/Clang and fails for other targets that use
-: the OpenSSL backend by default.
+: the OpenSSL backend by default, since the CA certificates can not be
+: located.
:
if ($cxx.target.class == 'windows' || \
$cxx.target.class == 'macos' && $cxx.id == 'clang-apple')
diff --git a/libxerces-c/tests/psvi-writer/.gitattributes b/libxerces-c/tests/psvi-writer/.gitattributes
new file mode 100644
index 0000000..3f00e13
--- /dev/null
+++ b/libxerces-c/tests/psvi-writer/.gitattributes
@@ -0,0 +1 @@
+PSVIWriter symlink=dir
diff --git a/libxerces-c/tests/reader-mgr/ReaderMgrTest.cpp b/libxerces-c/tests/reader-mgr/ReaderMgrTest.cpp
new file mode 100644
index 0000000..fc7e328
--- /dev/null
+++ b/libxerces-c/tests/reader-mgr/ReaderMgrTest.cpp
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ *
+ */
+
+/*
+ * This test verifies the fix of the CVE-2018-1311 issue (see
+ * https://issues.apache.org/jira/projects/XERCESC/issues/XERCESC-2188 for all
+ * the gory details).
+ */
+
+// ---------------------------------------------------------------------------
+// Includes
+// ---------------------------------------------------------------------------
+#include <xercesc/util/XMLUni.hpp>
+#include <xercesc/util/Janitor.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/sax/InputSource.hpp>
+#include <xercesc/framework/XMLEntityDecl.hpp>
+#include <xercesc/framework/MemoryManager.hpp>
+#include <xercesc/validators/DTD/DTDValidator.hpp>
+#include <xercesc/internal/ReaderMgr.hpp>
+
+#if defined(XERCES_NEW_IOSTREAMS)
+#include <iostream>
+#else
+#include <iostream.h>
+#endif
+
+#include <set>
+#include <memory> // unique_ptr
+#include <string>
+#include <cstddef> // size_t
+
+#undef NDEBUG
+#include <cassert>
+
+XERCES_CPP_NAMESPACE_USE
+
+using namespace std;
+
+inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& os, const XMLCh* xmlStr)
+{
+ char* transcoded = XMLString::transcode(xmlStr);
+ os << transcoded;
+ XMLString::release(&transcoded);
+ return os;
+}
+
+struct XMLStringDeleter
+{
+ void operator() (XMLCh* p) const {if (p != nullptr) XMLString::release(&p);}
+};
+
+using XMLChPtr = unique_ptr<XMLCh, XMLStringDeleter>;
+
+// ---------------------------------------------------------------------------
+// Program entry point
+// ---------------------------------------------------------------------------
+int
+main(int argc, char** argv)
+{
+ // Init the XML platform
+ try
+ {
+ XMLPlatformUtils::Initialize();
+ }
+ catch(const XMLException& toCatch)
+ {
+ XERCES_STD_QUALIFIER cout << "Error during platform init! Message:\n"
+ << toCatch.getMessage() << XERCES_STD_QUALIFIER endl;
+ return 1;
+ }
+
+ MemoryManager* const fMemoryManager = XMLPlatformUtils::fgMemoryManager;
+
+ {
+ set<string> entity_names;
+ ReaderMgr fReaderMgr;
+
+ for (int i (1); i != argc; ++i)
+ {
+ string s (argv[i]);
+ size_t n (s.find ('='));
+
+ assert (n != string::npos);
+
+ string name (s, 0, n);
+
+ XMLChPtr sysId (XMLString::transcode(string (s, n + 1).c_str ()));
+
+ {
+ XMLChPtr gDTDStr (XMLString::transcode(name.c_str ()));
+ bool new_entity (entity_names.emplace (move (name)).second);
+
+ InputSource* srcUsed=0;
+ Janitor<InputSource> janSrc(srcUsed);
+
+ XMLReader* reader =
+ fReaderMgr.createReader
+ (
+ sysId.get ()
+ , XMLUni::fgEmptyString /* pubId */
+ , false /* xmlDecl */
+ , XMLReader::RefFrom_NonLiteral
+ , XMLReader::Type_General
+ , XMLReader::Source_External
+ , srcUsed
+ );
+
+ assert (reader != nullptr);
+
+ janSrc.reset(srcUsed);
+
+ DTDEntityDecl* declDTD =
+ new (fMemoryManager) DTDEntityDecl(gDTDStr.get (), false, fMemoryManager);
+
+ assert (fReaderMgr.pushReaderAdoptEntity(reader, declDTD) == new_entity);
+ }
+
+ {
+ InputSource* srcUsed=0;
+ Janitor<InputSource> janSrc(srcUsed);
+
+ XMLReader* reader =
+ fReaderMgr.createReader
+ (
+ sysId.get ()
+ , XMLUni::fgEmptyString /* pubId */
+ , false /* xmlDecl */
+ , XMLReader::RefFrom_NonLiteral
+ , XMLReader::Type_General
+ , XMLReader::Source_External
+ , srcUsed
+ );
+
+ assert (reader != nullptr);
+
+ janSrc.reset(srcUsed);
+
+ assert (fReaderMgr.pushReader(reader, nullptr));
+ }
+ }
+ }
+
+ // And call the termination method
+ XMLPlatformUtils::Terminate();
+
+ return 0;
+}
diff --git a/libxerces-c/tests/reader-mgr/buildfile b/libxerces-c/tests/reader-mgr/buildfile
new file mode 100644
index 0000000..dc2405c
--- /dev/null
+++ b/libxerces-c/tests/reader-mgr/buildfile
@@ -0,0 +1,8 @@
+# file : tests/reader-mgr/buildfile
+# license : Apache License 2.0; see accompanying LICENSE file
+
+import libs = libxerces-c%lib{xerces-c}
+
+./: exe{driver} file{*.dtd *.ent}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
diff --git a/libxerces-c/tests/reader-mgr/characters.ent b/libxerces-c/tests/reader-mgr/characters.ent
new file mode 100644
index 0000000..d3780e5
--- /dev/null
+++ b/libxerces-c/tests/reader-mgr/characters.ent
@@ -0,0 +1,297 @@
+<?xml encoding='ISO-8859-1'?>
+
+<!-- CHARACTERS ENTITY -->
+
+<!-- Latin A -->
+<!ENTITY nbsp "&#160;"> <!-- U+00A0 ISOnum - no-break space = non-breaking space -->
+<!ENTITY iexcl "&#161;"> <!-- U+00A1 ISOnum - inverted exclamation mark -->
+<!ENTITY cent "&#162;"> <!-- U+00A2 ISOnum - cent sign -->
+<!ENTITY pound "&#163;"> <!-- U+00A3 ISOnum - pound sign -->
+<!ENTITY curren "&#164;"> <!-- U+00A4 ISOnum - currency sign -->
+<!ENTITY yen "&#165;"> <!-- U+00A5 ISOnum - yen sign = yuan sign -->
+<!ENTITY brvbar "&#166;"> <!-- U+00A6 ISOnum - broken bar = broken vertical bar -->
+<!ENTITY sect "&#167;"> <!-- U+00A7 ISOnum - section sign -->
+<!ENTITY uml "&#168;"> <!-- U+00A8 ISOdia - diaeresis = spacing diaeresis -->
+<!ENTITY copy "&#169;"> <!-- U+00A9 ISOnum - copyright sign -->
+<!ENTITY ordf "&#170;"> <!-- U+00AA ISOnum - feminine ordinal indicator -->
+<!ENTITY laquo "&#171;"> <!-- U+00AB ISOnum - left-pointing double angle quotation mark = left pointing guillemet -->
+<!ENTITY not "&#172;"> <!-- U+00AC ISOnum - not sign -->
+<!ENTITY shy "&#173;"> <!-- U+00AD ISOnum - soft hyphen = discretionary hyphen -->
+<!ENTITY reg "&#174;"> <!-- U+00AE ISOnum - registered sign = registered trade mark sign -->
+<!ENTITY macr "&#175;"> <!-- U+00AF ISOdia - macron = spacing macron = overline = APL overbar -->
+<!ENTITY deg "&#176;"> <!-- U+00B0 ISOnum - degree sign -->
+<!ENTITY plusmn "&#177;"> <!-- U+00B1 ISOnum - plus-minus sign = plus-or-minus sign -->
+<!ENTITY sup2 "&#178;"> <!-- U+00B2 ISOnum - superscript two = superscript digit two = squared -->
+<!ENTITY sup3 "&#179;"> <!-- U+00B3 ISOnum - superscript three = superscript digit three = cubed -->
+<!ENTITY acute "&#180;"> <!-- U+00B4 ISOdia - acute accent = spacing acute -->
+<!ENTITY micro "&#181;"> <!-- U+00B5 ISOnum - micro sign -->
+<!ENTITY para "&#182;"> <!-- U+00B6 ISOnum - pilcrow sign = paragraph sign -->
+<!ENTITY middot "&#183;"> <!-- U+00B7 ISOnum - middle dot = Georgian comma = Greek middle dot -->
+<!ENTITY cedil "&#184;"> <!-- U+00B8 ISOdia - cedilla = spacing cedilla -->
+<!ENTITY sup1 "&#185;"> <!-- U+00B9 ISOnum - superscript one = superscript digit one -->
+<!ENTITY ordm "&#186;"> <!-- U+00BA ISOnum - masculine ordinal indicator -->
+<!ENTITY raquo "&#187;"> <!-- U+00BB ISOnum - right-pointing double angle quotation mark = right pointing guillemet -->
+<!ENTITY frac14 "&#188;"> <!-- U+00BC ISOnum - vulgar fraction one quarter = fraction one quarter -->
+<!ENTITY frac12 "&#189;"> <!-- U+00BD ISOnum - vulgar fraction one half = fraction one half -->
+<!ENTITY frac34 "&#190;"> <!-- U+00BE ISOnum - vulgar fraction three quarters = fraction three quarters -->
+<!ENTITY iquest "&#191;"> <!-- U+00BF ISOnum - inverted question mark = turned question mark -->
+<!ENTITY Agrave "&#192;"> <!-- U+00C0 ISOlat1 - latin capital letter A with grave = latin capital letter A grave -->
+<!ENTITY Aacute "&#193;"> <!-- U+00C1 ISOlat1 - latin capital letter A with acute -->
+<!ENTITY Acirc "&#194;"> <!-- U+00C2 ISOlat1 - latin capital letter A with circumflex -->
+<!ENTITY Atilde "&#195;"> <!-- U+00C3 ISOlat1 - latin capital letter A with tilde -->
+<!ENTITY Auml "&#196;"> <!-- U+00C4 ISOlat1 - latin capital letter A with diaeresis -->
+<!ENTITY Aring "&#197;"> <!-- U+00C5 ISOlat1 - latin capital letter A with ring above = latin capital letter A ring -->
+<!ENTITY AElig "&#198;"> <!-- U+00C6 ISOlat1 - latin capital letter AE = latin capital ligature AE -->
+<!ENTITY Ccedil "&#199;"> <!-- U+00C7 ISOlat1 - latin capital letter C with cedilla -->
+<!ENTITY Egrave "&#200;"> <!-- U+00C8 ISOlat1 - latin capital letter E with grave -->
+<!ENTITY Eacute "&#201;"> <!-- U+00C9 ISOlat1 - latin capital letter E with acute -->
+<!ENTITY Ecirc "&#202;"> <!-- U+00CA ISOlat1 - latin capital letter E with circumflex -->
+<!ENTITY Euml "&#203;"> <!-- U+00CB ISOlat1 - latin capital letter E with diaeresis -->
+<!ENTITY Igrave "&#204;"> <!-- U+00CC ISOlat1 - latin capital letter I with grave -->
+<!ENTITY Iacute "&#205;"> <!-- U+00CD ISOlat1 - latin capital letter I with acute -->
+<!ENTITY Icirc "&#206;"> <!-- U+00CE ISOlat1 - latin capital letter I with circumflex -->
+<!ENTITY Iuml "&#207;"> <!-- U+00CF ISOlat1 - latin capital letter I with diaeresis -->
+<!ENTITY ETH "&#208;"> <!-- U+00D0 ISOlat1 - latin capital letter ETH -->
+<!ENTITY Ntilde "&#209;"> <!-- U+00D1 ISOlat1 - latin capital letter N with tilde -->
+<!ENTITY Ograve "&#210;"> <!-- U+00D2 ISOlat1 - latin capital letter O with grave -->
+<!ENTITY Oacute "&#211;"> <!-- U+00D3 ISOlat1 - latin capital letter O with acute -->
+<!ENTITY Ocirc "&#212;"> <!-- U+00D4 ISOlat1 - latin capital letter O with circumflex -->
+<!ENTITY Otilde "&#213;"> <!-- U+00D5 ISOlat1 - latin capital letter O with tilde -->
+<!ENTITY Ouml "&#214;"> <!-- U+00D6 ISOlat1 - latin capital letter O with diaeresis -->
+<!ENTITY times "&#215;"> <!-- U+00D7 ISOnum - multiplication sign -->
+<!ENTITY Oslash "&#216;"> <!-- U+00D8 ISOlat1 - latin capital letter O with stroke = latin capital letter O slash -->
+<!ENTITY Ugrave "&#217;"> <!-- U+00D9 ISOlat1 - latin capital letter U with grave -->
+<!ENTITY Uacute "&#218;"> <!-- U+00DA ISOlat1 - latin capital letter U with acute -->
+<!ENTITY Ucirc "&#219;"> <!-- U+00DB ISOlat1 - latin capital letter U with circumflex -->
+<!ENTITY Uuml "&#220;"> <!-- U+00DC ISOlat1 - latin capital letter U with diaeresis -->
+<!ENTITY Yacute "&#221;"> <!-- U+00DD ISOlat1 - latin capital letter Y with acute -->
+<!ENTITY THORN "&#222;"> <!-- U+00DE ISOlat1 - latin capital letter THORN -->
+<!ENTITY szlig "&#223;"> <!-- U+00DF ISOlat1 - latin small letter sharp s = ess-zed -->
+<!ENTITY agrave "&#224;"> <!-- U+00E0 ISOlat1 - latin small letter a with grave = latin small letter a grave -->
+<!ENTITY aacute "&#225;"> <!-- U+00E1 ISOlat1 - latin small letter a with acute -->
+<!ENTITY acirc "&#226;"> <!-- U+00E2 ISOlat1 - latin small letter a with circumflex -->
+<!ENTITY atilde "&#227;"> <!-- U+00E3 ISOlat1 - latin small letter a with tilde -->
+<!ENTITY auml "&#228;"> <!-- U+00E4 ISOlat1 - latin small letter a with diaeresis -->
+<!ENTITY aring "&#229;"> <!-- U+00E5 ISOlat1 - latin small letter a with ring above = latin small letter a ring -->
+<!ENTITY aelig "&#230;"> <!-- U+00E6 ISOlat1 - latin small letter ae = latin small ligature ae -->
+<!ENTITY ccedil "&#231;"> <!-- U+00E7 ISOlat1 - latin small letter c with cedilla -->
+<!ENTITY egrave "&#232;"> <!-- U+00E8 ISOlat1 - latin small letter e with grave -->
+<!ENTITY eacute "&#233;"> <!-- U+00E9 ISOlat1 - latin small letter e with acute -->
+<!ENTITY ecirc "&#234;"> <!-- U+00EA ISOlat1 - latin small letter e with circumflex -->
+<!ENTITY euml "&#235;"> <!-- U+00EB ISOlat1 - latin small letter e with diaeresis -->
+<!ENTITY igrave "&#236;"> <!-- U+00EC ISOlat1 - latin small letter i with grave -->
+<!ENTITY iacute "&#237;"> <!-- U+00ED ISOlat1 - latin small letter i with acute -->
+<!ENTITY icirc "&#238;"> <!-- U+00EE ISOlat1 - latin small letter i with circumflex -->
+<!ENTITY iuml "&#239;"> <!-- U+00EF ISOlat1 - latin small letter i with diaeresis -->
+<!ENTITY eth "&#240;"> <!-- U+00F0 ISOlat1 - latin small letter eth -->
+<!ENTITY ntilde "&#241;"> <!-- U+00F1 ISOlat1 - latin small letter n with tilde -->
+<!ENTITY ograve "&#242;"> <!-- U+00F2 ISOlat1 - latin small letter o with grave -->
+<!ENTITY oacute "&#243;"> <!-- U+00F3 ISOlat1 - latin small letter o with acute -->
+<!ENTITY ocirc "&#244;"> <!-- U+00F4 ISOlat1 - latin small letter o with circumflex -->
+<!ENTITY otilde "&#245;"> <!-- U+00F5 ISOlat1 - latin small letter o with tilde -->
+<!ENTITY ouml "&#246;"> <!-- U+00F6 ISOlat1 - latin small letter o with diaeresis -->
+<!ENTITY divide "&#247;"> <!-- U+00F7 ISOnum - division sign -->
+<!ENTITY oslash "&#248;"> <!-- U+00F8 ISOlat1 - latin small letter o with stroke = latin small letter o slash -->
+<!ENTITY ugrave "&#249;"> <!-- U+00F9 ISOlat1 - latin small letter u with grave -->
+<!ENTITY uacute "&#250;"> <!-- U+00FA ISOlat1 - latin small letter u with acute -->
+<!ENTITY ucirc "&#251;"> <!-- U+00FB ISOlat1 - latin small letter u with circumflex -->
+<!ENTITY uuml "&#252;"> <!-- U+00FC ISOlat1 - latin small letter u with diaeresis -->
+<!ENTITY yacute "&#253;"> <!-- U+00FD ISOlat1 - latin small letter y with acute -->
+<!ENTITY thorn "&#254;"> <!-- U+00FE ISOlat1 - latin small letter thorn -->
+<!ENTITY yuml "&#255;"> <!-- U+00FF ISOlat1 - latin small letter y with diaeresis -->
+
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- U+0022 ISOnum - quotation mark = APL quote -->
+<!ENTITY amp "&#38;"> <!-- U+0026 ISOnum - ampersand -->
+<!ENTITY lt "&#60;"> <!-- U+003C ISOnum - less-than sign -->
+<!ENTITY gt "&#62;"> <!-- U+003E ISOnum - greater-than sign -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- U+0152 ISOlat2 - latin capital ligature OE -->
+<!ENTITY oelig "&#339;"> <!-- U+0153 ISOlat2 - latin small ligature oe -->
+
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- U+0160 ISOlat2 - latin capital letter S with caron -->
+<!ENTITY scaron "&#353;"> <!-- U+0161 ISOlat2 - latin small letter s with caron -->
+<!ENTITY Yuml "&#376;"> <!-- U+0178 ISOlat2 - latin capital letter Y with diaeresis -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;" > <!-- U+02C6 ISOpub - modifier letter circumflex accent -->
+<!ENTITY tilde "&#732;" > <!-- U+02DC ISOdia - small tilde -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- U+2002 ISOpub - en space -->
+<!ENTITY emsp "&#8195;"> <!-- U+2003 ISOpub - em space -->
+<!ENTITY thinsp "&#8201;"> <!-- U+2009 ISOpub - thin space -->
+<!ENTITY zwnj "&#8204;"> <!-- U+200C RFC 2070 - zero width non-joiner -->
+<!ENTITY zwj "&#8205;"> <!-- U+200D RFC 2070 - zero width joiner -->
+<!ENTITY lrm "&#8206;"> <!-- U+200E RFC 2070 - left-to-right mark -->
+<!ENTITY rlm "&#8207;"> <!-- U+200F RFC 2070 - right-to-left mark -->
+<!ENTITY ndash "&#8211;"> <!-- U+2013 ISOpub - en dash -->
+<!ENTITY mdash "&#8212;"> <!-- U+2014 ISOpub - em dash -->
+<!ENTITY lsquo "&#8216;"> <!-- U+2018 ISOnum - left single quotation mark -->
+<!ENTITY rsquo "&#8217;"> <!-- U+2019 ISOnum - right single quotation mark -->
+<!ENTITY sbquo "&#8218;"> <!-- U+201A NEW - single low-9 quotation mark -->
+<!ENTITY ldquo "&#8220;"> <!-- U+201C ISOnum - left double quotation mark -->
+<!ENTITY rdquo "&#8221;"> <!-- U+201D ISOnum - right double quotation mark, -->
+<!ENTITY bdquo "&#8222;"> <!-- U+201E NEW - double low-9 quotation mark -->
+<!ENTITY dagger "&#8224;"> <!-- U+2020 ISOpub - dagger -->
+<!ENTITY Dagger "&#8225;"> <!-- U+2021 ISOpub - double dagger -->
+<!ENTITY permil "&#8240;"> <!-- U+2030 ISOtech - per mille sign -->
+<!ENTITY lsaquo "&#8249;"> <!-- U+2039 ISO prop. - single left-pointing angle quotation mark -->
+
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- U+203A ISO prop. - single right-pointing angle quotation mark -->
+
+<!-- rsaquo is proposed but not yet ISO standardized -->
+<!ENTITY euro "&#8364;"> <!-- U+20AC NEW - euro sign -->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- U+0192 ISOtech - latin small f with hook = function = florin -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- U+0391 - greek capital letter alpha -->
+<!ENTITY Beta "&#914;"> <!-- U+0392 - greek capital letter beta -->
+<!ENTITY Gamma "&#915;"> <!-- U+0393 ISOgrk3 - greek capital letter gamma -->
+<!ENTITY Delta "&#916;"> <!-- U+0394 ISOgrk3 - greek capital letter delta -->
+<!ENTITY Epsilon "&#917;"> <!-- U+0395 - greek capital letter epsilon -->
+<!ENTITY Zeta "&#918;"> <!-- U+0396 - greek capital letter zeta -->
+<!ENTITY Eta "&#919;"> <!-- U+0397 - greek capital letter eta -->
+<!ENTITY Theta "&#920;"> <!-- U+0398 ISOgrk3 - greek capital letter theta -->
+<!ENTITY Iota "&#921;"> <!-- U+0399 - greek capital letter iota -->
+<!ENTITY Kappa "&#922;"> <!-- U+039A - greek capital letter kappa -->
+<!ENTITY Lambda "&#923;"> <!-- U+039B ISOgrk3 - greek capital letter lambda -->
+<!ENTITY Mu "&#924;"> <!-- U+039C - greek capital letter mu -->
+<!ENTITY Nu "&#925;"> <!-- U+039D - greek capital letter nu -->
+<!ENTITY Xi "&#926;"> <!-- U+039E ISOgrk3 - greek capital letter xi -->
+<!ENTITY Omicron "&#927;"> <!-- U+039F - greek capital letter omicron -->
+<!ENTITY Pi "&#928;"> <!-- U+03A0 ISOgrk3 - greek capital letter pi -->
+<!ENTITY Rho "&#929;"> <!-- U+03A1 - greek capital letter rho -->
+<!ENTITY Sigma "&#931;"> <!-- U+03A3 ISOgrk3 - greek capital letter sigma -->
+<!ENTITY Tau "&#932;"> <!-- U+03A4 - greek capital letter tau -->
+<!ENTITY Upsilon "&#933;"> <!-- U+03A5 ISOgrk3 - greek capital letter upsilon -->
+<!ENTITY Phi "&#934;"> <!-- U+03A6 ISOgrk3 - greek capital letter phi -->
+<!ENTITY Chi "&#935;"> <!-- U+03A7 - greek capital letter chi -->
+<!ENTITY Psi "&#936;"> <!-- U+03A8 ISOgrk3 - greek capital letter psi -->
+<!ENTITY Omega "&#937;"> <!-- U+03A9 ISOgrk3 - greek capital letter omega -->
+<!ENTITY alpha "&#945;"> <!-- U+03B1 ISOgrk3 - greek small letter alpha -->
+<!ENTITY beta "&#946;"> <!-- U+03B2 ISOgrk3 - greek small letter beta -->
+<!ENTITY gamma "&#947;"> <!-- U+03B3 ISOgrk3 - greek small letter gamma -->
+<!ENTITY delta "&#948;"> <!-- U+03B4 ISOgrk3 - greek small letter delta -->
+<!ENTITY epsilon "&#949;"> <!-- U+03B5 ISOgrk3 - greek small letter epsilon -->
+<!ENTITY zeta "&#950;"> <!-- U+03B6 ISOgrk3 - greek small letter zeta -->
+<!ENTITY eta "&#951;"> <!-- U+03B7 ISOgrk3 - greek small letter eta -->
+<!ENTITY theta "&#952;"> <!-- U+03B8 ISOgrk3 - greek small letter theta -->
+<!ENTITY iota "&#953;"> <!-- U+03B9 ISOgrk3 - greek small letter iota -->
+<!ENTITY kappa "&#954;"> <!-- U+03BA ISOgrk3 - greek small letter kappa -->
+<!ENTITY lambda "&#955;"> <!-- U+03BB ISOgrk3 - greek small letter lambda -->
+<!ENTITY mu "&#956;"> <!-- U+03BC ISOgrk3 - greek small letter mu -->
+<!ENTITY nu "&#957;"> <!-- U+03BD ISOgrk3 - greek small letter nu -->
+<!ENTITY xi "&#958;"> <!-- U+03BE ISOgrk3 - greek small letter xi -->
+<!ENTITY omicron "&#959;"> <!-- U+03BF NEW - greek small letter omicron -->
+<!ENTITY pi "&#960;"> <!-- U+03C0 ISOgrk3 - greek small letter pi -->
+<!ENTITY rho "&#961;"> <!-- U+03C1 ISOgrk3 - greek small letter rho -->
+<!ENTITY sigmaf "&#962;"> <!-- U+03C2 ISOgrk3 - greek small letter final sigma -->
+<!ENTITY sigma "&#963;"> <!-- U+03C3 ISOgrk3 - greek small letter sigma -->
+<!ENTITY tau "&#964;"> <!-- U+03C4 ISOgrk3 - greek small letter tau -->
+<!ENTITY upsilon "&#965;"> <!-- U+03C5 ISOgrk3 - greek small letter upsilon -->
+<!ENTITY phi "&#966;"> <!-- U+03C6 ISOgrk3 - greek small letter phi -->
+<!ENTITY chi "&#967;"> <!-- U+03C7 ISOgrk3 - greek small letter chi -->
+<!ENTITY psi "&#968;"> <!-- U+03C8 ISOgrk3 - greek small letter psi -->
+<!ENTITY omega "&#969;"> <!-- U+03C9 ISOgrk3 - greek small letter omega -->
+<!ENTITY thetasym "&#977;"> <!-- U+03D1 NEW - greek small letter theta symbol -->
+<!ENTITY upsih "&#978;"> <!-- U+03D2 NEW - greek upsilon with hook symbol -->
+<!ENTITY piv "&#982;"> <!-- U+03D6 ISOgrk3 - greek pi symbol -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- U+2022 ISOpub - bullet = black small circle -->
+<!ENTITY hellip "&#8230;"> <!-- U+2026 ISOpub - horizontal ellipsis = three dot leader -->
+<!ENTITY prime "&#8242;"> <!-- U+2032 ISOtech - prime = minutes = feet -->
+<!ENTITY Prime "&#8243;"> <!-- U+2033 ISOtech - double prime = seconds = inches -->
+<!ENTITY oline "&#8254;"> <!-- U+203E NEW - overline = spacing overscore -->
+<!ENTITY frasl "&#8260;"> <!-- U+2044 NEW - fraction slash -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- U+2118 ISOamso - script capital P = power set = Weierstrass p -->
+<!ENTITY image "&#8465;"> <!-- U+2111 ISOamso - blackletter capital I = imaginary part -->
+<!ENTITY real "&#8476;"> <!-- U+211C ISOamso - blackletter capital R = real part symbol -->
+<!ENTITY trade "&#8482;"> <!-- U+2122 ISOnum - trade mark sign -->
+<!ENTITY alefsym "&#8501;"> <!-- U+2135 NEW - alef symbol = first transfinite cardinal -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- U+2190 ISOnum - leftwards arrow -->
+<!ENTITY uarr "&#8593;"> <!-- U+2191 ISOnum - upwards arrow -->
+<!ENTITY rarr "&#8594;"> <!-- U+2192 ISOnum - rightwards arrow -->
+<!ENTITY darr "&#8595;"> <!-- U+2193 ISOnum - downwards arrow -->
+<!ENTITY harr "&#8596;"> <!-- U+2194 ISOamsa - left right arrow -->
+<!ENTITY crarr "&#8629;"> <!-- U+21B5 NEW - downwards arrow with corner leftwards = carriage return -->
+<!ENTITY lArr "&#8656;"> <!-- U+21D0 ISOtech - leftwards double arrow -->
+<!ENTITY uArr "&#8657;"> <!-- U+21D1 ISOamsa - upwards double arrow -->
+<!ENTITY rArr "&#8658;"> <!-- U+21D2 ISOtech - rightwards double arrow -->
+<!ENTITY dArr "&#8659;"> <!-- U+21D3 ISOamsa - downwards double arrow -->
+<!ENTITY hArr "&#8660;"> <!-- U+21D4 ISOamsa - left right double arrow -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- U+2200 ISOtech - for all -->
+<!ENTITY part "&#8706;"> <!-- U+2202 ISOtech - partial differential -->
+<!ENTITY exist "&#8707;"> <!-- U+2203 ISOtech - there exists -->
+<!ENTITY empty "&#8709;"> <!-- U+2205 ISOamso - empty set = null set = diameter -->
+<!ENTITY nabla "&#8711;"> <!-- U+2207 ISOtech - nabla = backward difference -->
+<!ENTITY isin "&#8712;"> <!-- U+2208 ISOtech - element of -->
+<!ENTITY notin "&#8713;"> <!-- U+2209 ISOtech - not an element of -->
+<!ENTITY ni "&#8715;"> <!-- U+220B ISOtech - contains as member -->
+<!ENTITY prod "&#8719;"> <!-- U+220F ISOamsb - n-ary product = product sign -->
+<!ENTITY sum "&#8721;"> <!-- U+2211 ISOamsb - n-ary sumation -->
+<!ENTITY minus "&#8722;"> <!-- U+2212 ISOtech - minus sign -->
+<!ENTITY lowast "&#8727;"> <!-- U+2217 ISOtech - asterisk operator -->
+<!ENTITY radic "&#8730;"> <!-- U+221A ISOtech - square root = radical sign -->
+<!ENTITY prop "&#8733;"> <!-- U+221D ISOtech - proportional to -->
+<!ENTITY infin "&#8734;"> <!-- U+221E ISOtech - infinity -->
+<!ENTITY ang "&#8736;"> <!-- U+2220 ISOamso - angle -->
+<!ENTITY and "&#8743;"> <!-- U+2227 ISOtech - logical and = wedge -->
+<!ENTITY or "&#8744;"> <!-- U+2228 ISOtech - logical or = vee -->
+<!ENTITY cap "&#8745;"> <!-- U+2229 ISOtech - intersection = cap -->
+<!ENTITY cup "&#8746;"> <!-- U+222A ISOtech - union = cup -->
+<!ENTITY int "&#8747;"> <!-- U+222B ISOtech - integral -->
+<!ENTITY there4 "&#8756;"> <!-- U+2234 ISOtech - therefore -->
+<!ENTITY sim "&#8764;"> <!-- U+223C ISOtech - tilde operator = varies with = similar to -->
+<!ENTITY cong "&#8773;"> <!-- U+2245 ISOtech - approximately equal to -->
+<!ENTITY asymp "&#8776;"> <!-- U+2248 ISOamsr - almost equal to = asymptotic to -->
+<!ENTITY ne "&#8800;"> <!-- U+2260 ISOtech - not equal to -->
+<!ENTITY equiv "&#8801;"> <!-- U+2261 ISOtech - identical to -->
+<!ENTITY le "&#8804;"> <!-- U+2264 ISOtech - less-than or equal to -->
+<!ENTITY ge "&#8805;"> <!-- U+2265 ISOtech - greater-than or equal to -->
+<!ENTITY sub "&#8834;"> <!-- U+2282 ISOtech - subset of -->
+<!ENTITY sup "&#8835;"> <!-- U+2283 ISOtech - superset of -->
+<!ENTITY nsub "&#8836;"> <!-- U+2284 ISOamsn - not a subset of -->
+<!ENTITY sube "&#8838;"> <!-- U+2286 ISOtech - subset of or equal to -->
+<!ENTITY supe "&#8839;"> <!-- U+2287 ISOtech - superset of or equal to -->
+<!ENTITY oplus "&#8853;"> <!-- U+2295 ISOamsb - circled plus = direct sum -->
+<!ENTITY otimes "&#8855;"> <!-- U+2297 ISOamsb - circled times = vector product -->
+<!ENTITY perp "&#8869;"> <!-- U+22A5 ISOtech - up tack = orthogonal to = perpendicular -->
+<!ENTITY sdot "&#8901;"> <!-- U+22C5 ISOamsb - dot operator -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- U+2308 ISOamsc - left ceiling = apl upstile -->
+<!ENTITY rceil "&#8969;"> <!-- U+2309 ISOamsc - right ceiling -->
+<!ENTITY lfloor "&#8970;"> <!-- U+230A ISOamsc - left floor = apl downstile -->
+<!ENTITY rfloor "&#8971;"> <!-- U+230B ISOamsc - right floor -->
+<!ENTITY lang "&#9001;"> <!-- U+2329 ISOtech - left-pointing angle bracket = bra -->
+<!ENTITY rang "&#9002;"> <!-- U+232A ISOtech - right-pointing angle bracket = ket -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- U+25CA ISOpub - lozenge -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- U+2660 ISOpub - black spade suit -->
+<!ENTITY clubs "&#9827;"> <!-- U+2663 ISOpub - black club suit = shamrock -->
+<!ENTITY hearts "&#9829;"> <!-- U+2665 ISOpub - black heart suit = valentine -->
+<!ENTITY diams "&#9830;"> <!-- U+2666 ISOpub - black diamond suit -->
+
+<!-- CVS $Revision$ $Date$ -->
+
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies. -->
diff --git a/libxerces-c/tests/reader-mgr/links.ent b/libxerces-c/tests/reader-mgr/links.ent
new file mode 100644
index 0000000..a8f9fd4
--- /dev/null
+++ b/libxerces-c/tests/reader-mgr/links.ent
@@ -0,0 +1,24 @@
+<?xml encoding='ISO-8859-1'?>
+
+<!-- LINKS ENTITY -->
+<!ENTITY % links "link|anchor|jump|img|resource-ref|human-resource-ref">
+
+<!ELEMENT anchor EMPTY>
+<!ATTLIST anchor name NMTOKEN #REQUIRED>
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img src CDATA #REQUIRED
+ alt CDATA #REQUIRED>
+
+<!ELEMENT link (#PCDATA|img)*>
+<!ATTLIST link idref NMTOKEN #IMPLIED
+ anchor CDATA #IMPLIED>
+
+<!ELEMENT jump (#PCDATA|img)*>
+<!ATTLIST jump href CDATA #REQUIRED>
+
+<!-- cross-reference resource elements -->
+<!ELEMENT resource-ref EMPTY>
+<!ATTLIST resource-ref idref CDATA #REQUIRED>
+<!ELEMENT human-resource-ref EMPTY>
+<!ATTLIST human-resource-ref idref CDATA #REQUIRED> \ No newline at end of file
diff --git a/libxerces-c/tests/reader-mgr/personal.dtd b/libxerces-c/tests/reader-mgr/personal.dtd
new file mode 100644
index 0000000..e636266
--- /dev/null
+++ b/libxerces-c/tests/reader-mgr/personal.dtd
@@ -0,0 +1,17 @@
+<?xml encoding="ISO-8859-1"?>
+
+<!-- @version: -->
+
+<!ELEMENT personnel (person)+>
+<!ELEMENT person (name,email*,url*,link?)>
+<!ATTLIST person id ID #REQUIRED>
+<!ELEMENT family (#PCDATA)>
+<!ELEMENT given (#PCDATA)>
+<!ELEMENT name (#PCDATA|family|given)*>
+<!ELEMENT email (#PCDATA)>
+<!ELEMENT url EMPTY>
+<!ATTLIST url href CDATA #REQUIRED>
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ manager IDREF #IMPLIED
+ subordinates IDREFS #IMPLIED>
diff --git a/libxerces-c/tests/reader-mgr/testscript b/libxerces-c/tests/reader-mgr/testscript
new file mode 100644
index 0000000..09bb7cc
--- /dev/null
+++ b/libxerces-c/tests/reader-mgr/testscript
@@ -0,0 +1,8 @@
+# file : tests/reader-mgr/testscript
+# license : Apache License 2.0; see accompanying LICENSE file
+
+: basics
+:
+$* "personal=$src_base/personal.dtd" \
+ "links=$src_base/links.ent" \
+ "characters=$src_base/characters.ent"
diff --git a/libxerces-c/tests/sax-print/.gitattributes b/libxerces-c/tests/sax-print/.gitattributes
new file mode 100644
index 0000000..dd82b71
--- /dev/null
+++ b/libxerces-c/tests/sax-print/.gitattributes
@@ -0,0 +1 @@
+SAXPrint symlink=dir
diff --git a/libxerces-c/tests/sax2-print/.gitattributes b/libxerces-c/tests/sax2-print/.gitattributes
new file mode 100644
index 0000000..1746049
--- /dev/null
+++ b/libxerces-c/tests/sax2-print/.gitattributes
@@ -0,0 +1 @@
+SAX2Print symlink=dir
diff --git a/libxerces-c/xercesc/.gitattributes b/libxerces-c/xercesc/.gitattributes
new file mode 100644
index 0000000..b814475
--- /dev/null
+++ b/libxerces-c/xercesc/.gitattributes
@@ -0,0 +1,8 @@
+dom symlink=dir
+framework symlink=dir
+internal symlink=dir
+parsers symlink=dir
+sax symlink=dir
+sax2 symlink=dir
+validators symlink=dir
+xinclude symlink=dir
diff --git a/libxerces-c/xercesc/buildfile b/libxerces-c/xercesc/buildfile
index 7124293..88cf9b1 100644
--- a/libxerces-c/xercesc/buildfile
+++ b/libxerces-c/xercesc/buildfile
@@ -1,29 +1,54 @@
# file : xercesc/buildfile
# license : Apache License 2.0; see accompanying LICENSE file
+network = $config.libxerces_c.network
+transcoder_icu = $config.libxerces_c.transcoder_icu
+
+intf_libs = # Interface dependencies.
+impl_libs = # Implementation dependencies.
+
# Note that the installed util/NetAccessors/Curl/CurlURLInputStream.hpp
# includes the libcurl headers.
#
-import int_libs = libcurl%lib{curl}
+if $network
+ import intf_libs += libcurl%lib{curl}
-import imp_libs = libicuuc%lib{icuuc}
-import imp_libs += libicui18n%lib{icui18n}
+if $transcoder_icu
+{
+ import impl_libs += libicuuc%lib{icuuc}
+ import impl_libs += libicui18n%lib{icui18n}
+}
-lib{xerces-c}: {h }{config } \
- {hxx txx cxx}{*/** -util/FileManagers/** -util/XercesVersion} \
- {hxx }{ util/XercesVersion} \
- $int_libs $imp_libs
+lib{xerces-c}: {h }{config} \
+ {hxx txx cxx}{*/** -util/FileManagers/** \
+ -util/NetAccessors/** \
+ -util/Transcoders/** \
+ -util/XercesVersion} \
+ {hxx }{ util/XercesVersion}
tclass = $cxx.target.class
tsys = $cxx.target.system
-windows = ($tclass == 'windows')
+macos = ($tclass == 'macos')
+windows = ($tclass == 'windows')
lib{xerces-c}: {h c}{stricmp strnicmp} \
util/FileManagers/{hxx cxx}{PosixFileMgr }: include = (!$windows)
lib{xerces-c}: util/FileManagers/{hxx cxx}{WindowsFileMgr}: include = $windows
+lib{xerces-c}: util/NetAccessors/Curl/{hxx cxx}{*}: include = $network
+
+lib{xerces-c}: util/Transcoders/ICU/{hxx cxx}{*}: include = $transcoder_icu
+
+lib{xerces-c}: util/Transcoders/MacOSUnicodeConverter/{hxx cxx}{*}: \
+include = (!$transcoder_icu && $macos)
+
+lib{xerces-c}: util/Transcoders/Win32/{hxx cxx}{*}: \
+include = (!$transcoder_icu && $windows)
+
+lib{xerces-c}: $intf_libs $impl_libs
+
# Include the generated version header into the distribution (so that we
# don't pick up an installed one) and don't remove it when cleaning in src (so
# that clean results in a state identical to distributed).
@@ -44,6 +69,16 @@ util/hxx{XercesVersion}: util/in{XercesVersion} $src_root/manifest
# Build options.
#
+if $network
+ cc.poptions += -DXERCES_USE_NETACCESSOR_CURL=1
+
+if $transcoder_icu
+ cc.poptions += -DXERCES_USE_TRANSCODER_ICU=1
+elif $macos
+ cc.poptions += -DXERCES_USE_TRANSCODER_MACOSUNICODECONVERTER=1
+elif $windows
+ cc.poptions += -DXERCES_USE_TRANSCODER_WINDOWS=1
+
cc.poptions += -DXERCES_BUILDING_LIBRARY -DHAVE_CONFIG_H -D_THREAD_SAFE
if $windows
@@ -91,7 +126,8 @@ switch $tclass, $tsys
#
cxx.loptions += -Wl,--no-undefined
- cxx.libs += -lws2_32
+ if $network
+ cxx.libs += -lws2_32
}
case 'windows'
{
@@ -99,7 +135,11 @@ switch $tclass, $tsys
#
cxx.aoptions += /IGNORE:4221
- cxx.libs += ws2_32.lib
+ if! $transcoder_icu
+ cxx.libs += advapi32.lib
+
+ if $network
+ cxx.libs += ws2_32.lib
}
case 'linux'
{
@@ -107,11 +147,18 @@ switch $tclass, $tsys
#
cxx.loptions += -Wl,--no-undefined
- cxx.libs += -lm -lpthread
+ cxx.libs += -lm -pthread
+ }
+ case 'macos'
+ {
+ if! $transcoder_icu
+ cxx.libs += -framework CoreServices
+
+ cxx.libs += -pthread
}
default
{
- cxx.libs += -lpthread
+ cxx.libs += -pthread
}
}
@@ -120,7 +167,7 @@ switch $tclass, $tsys
lib{xerces-c}:
{
cxx.export.poptions = "-I$out_root" "-I$src_root"
- cxx.export.libs = $int_libs
+ cxx.export.libs = $intf_libs
}
liba{xerces-c}: cxx.export.poptions += -DLIBXERCES_C_STATIC
diff --git a/libxerces-c/xercesc/config.h b/libxerces-c/xercesc/config.h
index 48bd880..53ae22e 100644
--- a/libxerces-c/xercesc/config.h
+++ b/libxerces-c/xercesc/config.h
@@ -23,17 +23,29 @@
# include <stdint.h> /* Requires C99. */
#endif
-/* Use the ICU transcoder.
+/* Transcoder.
+ *
+ * Note that depending on config.libxerces_c.transcoder_icu and
+ * cxx.target.class values one of the following macros is defined via the
+ * preprocessor option (see buildfile and root.build for details).
*/
+/*
#define XERCES_USE_TRANSCODER_ICU 1
-#undef XERCES_USE_TRANSCODER_GNUICONV
-#undef XERCES_USE_TRANSCODER_ICONV
#undef XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER
#undef XERCES_USE_TRANSCODER_WINDOWS
+*/
+#undef XERCES_USE_TRANSCODER_GNUICONV
+#undef XERCES_USE_TRANSCODER_ICONV
-/* Use the Curl net accessor.
+/* Net accessor.
+ *
+ * Note that the XERCES_USE_NETACCESSOR_CURL macro is defined via the
+ * preprocessor option if the network support is enabled (see buildfile and
+ * root.build for details).
*/
+/*
#define XERCES_USE_NETACCESSOR_CURL 1
+*/
#undef XERCES_USE_NETACCESSOR_CFURL
#undef XERCES_USE_NETACCESSOR_SOCKET
#undef XERCES_USE_NETACCESSOR_WINSOCK
@@ -85,6 +97,10 @@
# define HAVE_FTIME 1
# define HAVE_STRICMP 1
# define HAVE_STRNICMP 1
+# define HAVE_WCSICMP 1
+# define HAVE_WCSLWR 1
+# define HAVE_WCSNICMP 1
+# define HAVE_WCSUPR 1
# define XERCES_HAVE_INTRIN_H 1
# define XERCES_PATH_DELIMITER_BACKSLASH 1
# define XERCES_HAVE_CPUID_INTRINSIC 1
diff --git a/libxerces-c/xercesc/util/.gitattributes b/libxerces-c/xercesc/util/.gitattributes
new file mode 100644
index 0000000..05b35fc
--- /dev/null
+++ b/libxerces-c/xercesc/util/.gitattributes
@@ -0,0 +1,2 @@
+FileManagers symlink=dir
+regx symlink=dir
diff --git a/libxerces-c/xercesc/util/Transcoders/MacOSUnicodeConverter b/libxerces-c/xercesc/util/Transcoders/MacOSUnicodeConverter
new file mode 120000
index 0000000..5d4612d
--- /dev/null
+++ b/libxerces-c/xercesc/util/Transcoders/MacOSUnicodeConverter
@@ -0,0 +1 @@
+../../../../upstream/src/xercesc/util/Transcoders/MacOSUnicodeConverter \ No newline at end of file
diff --git a/libxerces-c/xercesc/util/Transcoders/Win32 b/libxerces-c/xercesc/util/Transcoders/Win32
new file mode 120000
index 0000000..6ec82cb
--- /dev/null
+++ b/libxerces-c/xercesc/util/Transcoders/Win32
@@ -0,0 +1 @@
+../../../../upstream/src/xercesc/util/Transcoders/Win32 \ No newline at end of file
diff --git a/libxerces-c/xercesc/util/Xerces_autoconf_config.hpp b/libxerces-c/xercesc/util/Xerces_autoconf_config.hpp
index 2b088cf..e88b063 100644
--- a/libxerces-c/xercesc/util/Xerces_autoconf_config.hpp
+++ b/libxerces-c/xercesc/util/Xerces_autoconf_config.hpp
@@ -135,10 +135,15 @@
* type. Note that falling back to defining the XERCES_PLATFORM_IMPORT macro
* as empty would work for both the static and shared libraries (being
* sub-optimal for the later) but only for functions. Xerces-C++, however,
- * also exports data symbols, which cannot be imported this way. Thus we,
- * just issue an error.
+ * also exports data symbols, which cannot be imported this way. Thus,
+ * where matters (Windows), we just issue an error.
*/
-# error define LIBXERCES_C_STATIC or LIBXERCES_C_SHARED preprocessor macro to signal Xerces-C++ library type being linked
+# ifdef _WIN32
+# error define LIBXERCES_C_STATIC or LIBXERCES_C_SHARED preprocessor macro to signal Xerces-C++ library type being linked
+# else
+# define XERCES_PLATFORM_IMPORT
+# define XERCES_PLATFORM_DECEXPORT
+# endif
#endif
#ifdef XERCES_DLL_EXPORT
diff --git a/upstream b/upstream
-Subproject cf1912ac95d4147be08aef4e78f894a3919277d
+Subproject 53c16411466bf90c62617831fe92ed0f41e7088