libxml2

Version:

2.9.10

Category:

lib

Cluster:

Loki

Author / Distributor

http://xmlsoft.org/

Description

libxml2 is the XML C parser and toolkit developed for the GNOME project. It provides standards-compliant support for reading, modifying, and writing XML and HTML files.

Key features:

  • Fully compliant XML 1.0 parser

  • Support for DOM, SAX, XPath, XInclude

  • Support for HTML4 and limited HTML5 parsing

  • Written in C with Python bindings available

  • Widely used in system utilities and scientific libraries

Documentation

$ xmllint --help

Usage: xmllint [options] XMLfiles ...
Parse and validate the XML files.

Common options:
  --version          Display version
  --debug            Debug the parser
  --noout            Do not output the result
  --schema <file>    Use a W3C XML Schema file to validate
  --xpath <expr>     Evaluate XPath expression
  --encode <enc>     Output in the given encoding
  --format           Reformat and indent the output

See full documentation at: http://xmlsoft.org/

Examples/Usage

  • Load the libxml2 module:

    $ module load lib/libxml2/2.9.10-GCCcore-9.3.0
    
  • Unload the module:

    $ module unload lib/libxml2/2.9.10-GCCcore-9.3.0
    
  • Use xmllint to pretty-print a document:

    xmllint --format input.xml -o output.xml
    
  • Validate XML against a schema:

    xmllint --noout --schema schema.xsd file.xml
    
  • Compile with libxml2 in C:

    gcc -I$EBROOTLIBXML2/include/libxml2 -L$EBROOTLIBXML2/lib -lxml2 mycode.c -o mycode
    

Installation

Source code is obtained from http://xmlsoft.org/downloads.html