3 This is Expat, a C library for parsing XML, started by
4 [James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.
5 Expat is a stream-oriented XML parser. This means that you register
6 handlers with the parser before starting the parse. These handlers
7 are called when the parser discovers the associated structures in the
8 document being parsed. A start tag is an example of the kind of
9 structures for which you may register handlers.
11 Windows users should use the
12 [`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/),
13 which includes both precompiled libraries and executables, and source code for
16 Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).
17 You may copy, distribute, and modify it under the terms of the License
19 [`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)
20 distributed with this package.
21 This license is the same as the MIT/X Consortium license.
23 If you are building Expat from a check-out from the
24 [Git repository](https://github.com/libexpat/libexpat/),
25 you need to run a script that generates the configure script using the
26 GNU autoconf and libtool tools. To do this, you need to have
27 autoconf 2.58 or newer. Run the script like this:
33 Once this has been done, follow the same instructions as for building
34 from a source distribution.
36 To build Expat from a source distribution, you first run the
37 configuration shell script in the top level distribution directory:
43 There are many options which you may provide to configure (which you
44 can discover by running configure with the `--help` option). But the
45 one of most interest is the one that sets the installation directory.
46 By default, the configure script will set things up to install
47 libexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and
48 `xmlwf` into `/usr/local/bin`. If, for example, you'd prefer to install
49 into `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and
50 `/home/me/mystuff/bin`, you can tell `configure` about that with:
53 ./configure --prefix=/home/me/mystuff
56 Another interesting option is to enable 64-bit integer support for
57 line and column numbers and the over-all byte index:
60 ./configure CPPFLAGS=-DXML_LARGE_SIZE
63 However, such a modification would be a breaking change to the ABI
64 and is therefore not recommended for general use — e.g. as part of
65 a Linux distribution — but rather for builds with special requirements.
67 After running the configure script, the `make` command will build
68 things and `make install` will install things into their proper
69 location. Have a look at the `Makefile` to learn about additional
70 `make` options. Note that you need to have write permission into
71 the directories into which things will be installed.
73 If you are interested in building Expat to provide document
74 information in UTF-16 encoding rather than the default UTF-8, follow
75 these instructions (after having run `make distclean`):
77 1. For UTF-16 output as unsigned short (and version/error strings as char),
79 `./configure CPPFLAGS=-DXML_UNICODE`<br/>
80 For UTF-16 output as `wchar_t` (incl. version/error strings), run:<br/>
81 `./configure CFLAGS="-g -O2 -fshort-wchar" CPPFLAGS=-DXML_UNICODE_WCHAR_T`
82 <br/>Note: The latter requires libc compiled with `-fshort-wchar`, as well.
84 1. Edit `Makefile`, changing:<br/>
85 `LIBRARY = libexpat.la`<br/>
87 `LIBRARY = libexpatw.la`<br/>
88 (Note the additional "w" in the library name.)
90 1. Run `make buildlib` (which builds the library only).
91 Or, to save step 2, run `make buildlib LIBRARY=libexpatw.la`.
93 1. Run `make installlib` (which installs the library only).
94 Or, if step 2 was omitted, run `make installlib LIBRARY=libexpatw.la`.
96 Using `DESTDIR` or `INSTALL_ROOT` is enabled, with `INSTALL_ROOT` being the
97 default value for `DESTDIR`, and the rest of the make file using only
98 `DESTDIR`. It works as follows:
101 make install DESTDIR=/path/to/image
104 overrides the in-makefile set `DESTDIR`, while both
107 INSTALL_ROOT=/path/to/image make install
108 make install INSTALL_ROOT=/path/to/image
111 use `DESTDIR=$(INSTALL_ROOT)`, even if `DESTDIR` eventually is defined in the
112 environment, because variable-setting priority is
117 Note: This only applies to the Expat library itself, building UTF-16 versions
118 of xmlwf and the tests is currently not supported.
120 When using Expat with a project using autoconf for configuration, you
121 can use the probing macro in `conftools/expat.m4` to determine how to
122 include Expat. See the comments at the top of that file for more
125 A reference manual is available in the file `doc/reference.html` in this