<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!ENTITY libxml2-download-http "http://xmlsoft.org/sources/libxml2-&libxml2-version;.tar.gz">
  <!ENTITY libxml2-download-ftp  "ftp://xmlsoft.org/libxml2/libxml2-&libxml2-version;.tar.gz">
  <!ENTITY libxml2-md5sum        "9e6a9aca9d155737868b3dc5fd82f788">
  <!ENTITY libxml2-size          "5.2 MB">
  <!ENTITY libxml2-buildsize     "77 MB (additional 18 MB for tests)">
  <!ENTITY libxml2-time          "0.5 SBU (additional 0.2 SBU for tests)">
  <!ENTITY testsuite-version     "20130923">
]>

<sect1 id="libxml2" xreflabel="libxml2-&libxml2-version;">
  <?dbhtml filename="libxml2.html"?>

  <sect1info>
    <othername>$LastChangedBy: bdubbs $</othername>
    <date>$Date: 2015-02-20 16:15:05 -0500 (Fri, 20 Feb 2015) $</date>
  </sect1info>

  <title>libxml2-&libxml2-version;</title>

  <indexterm zone="libxml2">
    <primary sortas="a-libxml2">libxml2</primary>
  </indexterm>

  <sect2 role="package">
    <title>Introduction to libxml2</title>

    <para>
      The <application>libxml2</application> package contains libraries
      and utilities used for parsing XML files.
    </para>

    &lfs77_checked;

    <bridgehead renderas="sect3">Package Information</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>
          Download (HTTP): <ulink url="&libxml2-download-http;"/>
        </para>
      </listitem>
      <listitem>
        <para>
          Download (FTP): <ulink url="&libxml2-download-ftp;"/>
        </para>
      </listitem>
      <listitem>
        <para>
          Download MD5 sum: &libxml2-md5sum;
        </para>
      </listitem>
      <listitem>
        <para>
          Download size: &libxml2-size;
        </para>
      </listitem>
      <listitem>
        <para>
          Estimated disk space required: &libxml2-buildsize;
        </para>
      </listitem>
      <listitem>
        <para>
          Estimated build time: &libxml2-time;
        </para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">Additional Downloads</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>
          Optional Testsuite:
          <ulink url="http://www.w3.org/XML/Test/xmlts&testsuite-version;.tar.gz"/> - This
          enables <command>make check</command> to do complete testing.
        </para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">libxml2 Dependencies</bridgehead>

    <bridgehead renderas="sect4">Recommended</bridgehead>
    <para role="recommended">
      <xref linkend="python2"/> or <xref linkend="python3"/> (to build and install a
      <application>Python</application> library module, additionally it is
      required to run the full suite of tests)
    </para>

    <note>
      <para>
        Some packages which utilize <application>libxml2</application> (such as
        <application>GNOME Doc Utils</application>) need the
        <application>Python</application> module installed to function properly
        and some packages will not build properly if the
        <application>Python</application> module is not available.
      </para>
    </note>

    <para condition="html" role="usernotes">
      User Notes: <ulink url="&blfs-wiki;/libxml2"/>
    </para>
  </sect2>

  <sect2 role="installation">
    <title>Installation of libxml2</title>

    <para>
       Apply two upstream fixes, which correct bugs in
       <command>xmlcatalog</command> and in the entity substitution
       mechanism:
    </para>

<screen><userinput>sed \
  -e /xmlInitializeCatalog/d \
  -e 's/((ent->checked =.*&amp;&amp;/(((ent->checked == 0) ||\
          ((ent->children == NULL) \&amp;\&amp; (ctxt->options \&amp; XML_PARSE_NOENT))) \&amp;\&amp;/' \
  -i parser.c</userinput></screen>

    <para>
      Install <application>libxml2</application> by running the following
      commands:
    </para>

<screen><userinput>./configure --prefix=/usr --disable-static --with-history &amp;&amp;
make</userinput></screen>

    <para>If you downloaded the testsuite, issue the following command:</para>

<screen><userinput>tar xf ../xmlts&testsuite-version;.tar.gz</userinput></screen>

    <para>
      To test the results, issue: <command>make check &gt;
      ../check.log</command>. A summary of the results can be obtained with
      <command>grep -E '^Total|expected' ../check.log</command>.
    </para>

    <para>
      Now, as the <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>make install</userinput></screen>
  </sect2>

  <sect2 role="commands">
    <title>Command Explanations</title>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
      href="../../xincludes/static-libraries.xml"/>

    <para>
      <parameter>--with-history</parameter>: This switch enables
      <application>Readline</application> support when running
      <command>xmlcatalog</command> or <command>xmllint</command> in shell mode.
    </para>

    <para>
      <option>--with-python=/usr/bin/python3</option>: Add this switch if you
      want libxml2 to use Python3 instead of Python2.
    </para>

  </sect2>

  <sect2 role="content">
    <title>Contents</title>

    <segmentedlist>
      <segtitle>Installed Programs</segtitle>
      <segtitle>Installed Libraries</segtitle>
      <segtitle>Installed Directories</segtitle>

      <seglistitem>
        <seg>
          xml2-config, xmlcatalog and xmllint
        </seg>
        <seg>
          libxml2.so and optionally, the libxml2mod.so
          <application>Python</application> module
        </seg>
        <seg>
          /usr/include/libxml2,
          /usr/share/doc/libxml2-&libxml2-version;,
          /usr/share/doc/libxml2-python-&libxml2-version; and
          /usr/share/gtk-doc/html/libxml2
        </seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="xml2-config">
        <term><command>xml2-config</command></term>
        <listitem>
          <para>
            determines the compile and linker flags that should be used to
            compile and link programs that use
            <filename class='libraryfile'>libxml2</filename>.
          </para>
          <indexterm zone="libxml2 xml2-config">
            <primary sortas="b-xml2-config">xml2-config</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="xmlcatalog">
        <term><command>xmlcatalog</command></term>
        <listitem>
          <para>
            is used to monitor and manipulate XML and SGML catalogs.
          </para>
          <indexterm zone="libxml2 xmlcatalog">
            <primary sortas="b-xmlcatalog">xmlcatalog</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="xmllint">
        <term><command>xmllint</command></term>
        <listitem>
          <para>
            parses XML files and outputs reports (based upon options) to detect
            errors in XML coding.
          </para>
          <indexterm zone="libxml2 xmllint">
            <primary sortas="b-xmllint">xmllint</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libxml2-lib">
        <term><filename class="libraryfile">libxml2.so</filename></term>
        <listitem>
          <para>
            provides functions for programs to parse files that use the XML
            format.
          </para>
          <indexterm zone="libxml2 libxml2-lib">
            <primary sortas="c-libxml2">libxml2.so</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
