Apache Xerces 129 (Apache-2.0) is two validating parsers. Xerces-J 2.12.2 (January 2022) implements DOM, SAX and XSD 1.0, with XSD 1.1 in a separate build; a repackaged Xerces is the JDK's built-in parser (its factory class is com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl). Xerces-C++ 3.3.0 (September 2024; Ubuntu 225 ships 3.2.4) is the C++ sibling. Its DOMCount sample validates the catalog against XSD 1.1 Types's XSD through a schema-location hint:
xsi=http://www.w3.org/2001/XMLSchema-instance
sed "s#<catalog #<catalog xmlns:xsi=\"$xsi\" xsi:noNamespaceSchemaLocation=\"catalog.xsd\" #" \
booknest-catalog.xml > hinted.xml
sed 's/>39.50</>-39.50</' hinted.xml > bad.xml
for f in hinted.xml bad.xml; do DOMCount -v=always -n -s -f $f | sed -E "s/ [0-9]+ ms//"; doneOutput
hinted.xml: (89 elems). Error at file /home/dev/v7-l1/ch02/s2-28/bad.xml, line 42, char 43 Message: value '-39.50' must be greater than or equal to minExclusive facet value '0' Errors occurred, no output available
minExclusive means strictly greater, so "greater than or equal to" is a slip in Xerces-C's message, not a different rule. The JDK's javax.xml.validation reports the same fault as cvc-minExclusive-valid.
Xerces
Xerces 129 is a set of Apache Software Foundation libraries for parsing, validating, serializing, and manipulating XML. It implements both DOM and SAX.The Apache Xerces project ships implementations for multiple languages, most notably Xerces-C++ and Xerces-J (Java). Depending on the binding, Xerces can validate documents against DTDs, XSD, and other schema languages, in addition to parsing and serializing XML content. Xerces-J has historically served as a widely used reference DOM/SAX implementation bundled inside Java runtimes and application servers.
| Maintained by | Apache Software Foundation (Apache Xerces project) |
| Implements | DOM and SAX |
| Variants | Xerces-C++, Xerces-J (Java) |
| Capabilities | Parsing, schema validation, serialization, and manipulation of XML |
| License | Apache License 2.0 |
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_USE
int main() {
XMLPlatformUtils::Initialize();
XercesDOMParser parser;
parser.parse("books.xml");
DOMDocument* doc = parser.getDocument();
XMLPlatformUtils::Terminate();
return 0;
}