Installing XSD on Fedora and alike
This README
describes installing the XSD compiler
(xsd
) and runtime library (libxsd
) from binary
packages on Fedora and alike (RHEL, etc). Note that the runtime library is
header-only.
Besides the runtime library, the generated code also depends on the
underlying XML parser which can be Xerces-C++ for the C++/Tree mapping and
Xerces-C++ or Expat for the C++/Parser mapping. Both of these XML parsers
are available from the distribution's official package repository and you
need to install one or the other explicitly (the libxsd
package
does not have a dependency on either).
The distribution's package for Xerces-C++ is called
xerces-c-devel
while for Expat –
expat-devel
.
On RHEL, the Xerces-C++ package is available from the EPEL repository. If you do not wish to have this repository enabled, you can alternatively use the Xerces-C++ package provided with the XSD packages for RHEL.
The following binary packages are provided for Fedora and alike (here
<...>
denotes the version, distribution, and architecture
information):
xsd-<...>.rpm -- XSD compiler libxsd-devel-<...>.rpm -- XSD runtime development files xsd-debuginfo-<...>.rpm -- XSD compiler debug info (optional) libxerces-c-<...>.rpm -- Xerces-C++ runtime files (RHEL-only) libxerces-c-devel-<...>.rpm -- Xerces-C++ dev files (RHEL-only) libxerces-c-debuginfo-<...>.rpm -- Xerces-C++ debug info (optional)
For example, to install XSD with Xerces-C++, run:
$ sudo dnf install xsd-<...>.rpm \ libxsd-devel-<...>.rpm \ xerces-c-devel
To test the installation you can try to build and run an example, for
example cxx/tree/hello/
from the xsd-examples
source package (see examples README
for
details):
$ xsd cxx-tree hello.xsd $ c++ -std=c++11 -c hello.cxx $ c++ -std=c++11 -c driver.cxx $ c++ -std=c++11 -o driver driver.o hello.o -lxerces-c $ ./driver hello.xml