Woodstox XML Processing Library

repository·main·Indexed 42 days ago

https://github.com/fasterxml/woodstox

A high-performance Java implementation of the StAX (Streaming API for XML) pull API and the SAX (Simple API for XML) event-based API. It supports Stax 1.x standard properties, Stax2 extension properties, and Woodstox-specific configurations. Woodstox 7+ requires Java 8 or higher, while Woodstox 5+ requires Java 6 or higher.

Tokens
572
Snippets
2
Records
4
Agent score
4%

What's inside Woodstox

  1. Overview of Woodstox capabilities

    main

    Woodstox is a high-performance implementation of the following XML APIs:

    • StAX (Streaming API for XML): The standard javax.xml.stream "pull" API. This is the primary way to use Woodstox.
    • SAX (Simple API for XML): An event-based XML processing API implemented since version 4.0.

    Because it implements these standard APIs, Woodstox is compatible with most popular Java XML web service frameworks.

  2. Woodstox requirements and dependencies

    main

    Before integrating Woodstox, ensure your environment meets the following requirements:

    Java Version

    • Woodstox 7+: Requires Java 8 or higher.
    • Woodstox 5+: Requires Java 6 or higher.

    Mandatory Dependencies

    • Stax API: Included in the JDK (since Java 6).
    • Stax2 API: An extended API implemented by Woodstox. This is a mandatory dependency.

    Optional Dependencies

    • Multi-Schema Validator (MSV): Required only if you need XML Schema or RelaxNG validation functionality.
  3. Install Woodstox via Maven

    main

    To use Woodstox in your project, add the following coordinates to your Maven or Ivy configuration. Woodstox is available on Maven Central.

    Note: The Maven Group ID changed starting with version 4.x, but the API remains compatible with previous versions.

    <!-- Maven Coordinates -->
    Group id: com.fasterxml.woodstox
    Artifact id: woodstox-core
  4. Configure Woodstox using Stax properties

    main

    Woodstox configuration is performed using the standard Stax mechanism via property access on factory instances.

    • To configure XML reading aspects, use XMLInputFactory.setProperty(propertyName, value).
    • To configure XML writing aspects, use XMLOutputFactory.setProperty(propertyName, value).

    Available properties are categorized into three groups:

    1. Stax 1.x standard properties: Basic standard configuration.
    2. Stax2 extension properties: Properties provided by the Stax2 API.
    3. Woodstox-specific properties: Properties unique to the Woodstox implementation.
    // Example of configuring an input factory
    XMLInputFactory factory = XMLInputFactory.newInstance();
    factory.setProperty("some.property.name", "some.value");