1 Star 0 Fork 0

xsls / aalto-xml

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Overview

Aalto XML processor is an ultra-high performance next generation Stax XML processor implementation, implementing both basic Stax API (javax.xml.stream) and Stax2 API extension (org.codehaus.woodstox.stax2). In additiona, it also implements SAX2 API.

Additionally Aalto implements a non-blocking (asynchronous) Stax parser; non-blocking API is a minimalistic extension above Stax/Stax2 API to allow indication of "not yet available" token (EVENT_INCOMPLETE) as well as feeding of input (since InputStream can not be used as it blocks)

Aalto is licensed under Apache License 2.0

Status

Build Status

Documentation

Usage

Blocking XML parsing (Stax, SAX)

Blocking XML parsing is done using one of standard interfaces:

Non-blocking ("async") XML parsing

Non-blocking parsing interface is extension of basic Stax (and Stax2) API, with extensions defined in 'com.fasterxml.aalto' package::

  • AsyncXMLInputFactory offers factory methods for creating non-blocking parsers
  • AsyncXMLStreamReader is extended type that non-blocking parsers implement
  • AsyncXMLStreamReader.EVENT_INCOMPLETE (value 257; just outside range reserved by Stax API) is used to denote "not yet available" (without more data)
  • Method getInputFeeder() is used to access object of type 'AsyncInputFeeder' used to feed input non-blocking way
  • AsyncInputFeeder contains methods for feeding input.

Typical usage pattern is one where block of input is fed to parser, and zero or more complete events are read using basic 'XMLStreamReader.next()' method; and once 'EVENT_INCOMPLETE' is returned, more input needs to be given. AsyncXMLStreamReader itself does not buffer input beyond a single block; caller is responsible for additional buffering, if any. See Async parsing for details.

Construction of AsyncXMLInputFactory is simple; instance may be constructed with or without initial content to parse:

AsyncXMLInputFactory f = new InputFactoryImpl();
AsyncXMLStreamReader<AsyncByteArrayFeeder> parser = f.createAsyncFor(byteArray);

and more content is feed via AsyncInputFeeder when getting EVENT_INCOMPLETE via parser.next():

parser.getInputFeeder().feedInput(b, offset, dataLength);

or, if no more input available, indicate end-of-content with

parser.getInputFeeder().endOfInput();

Aalto Design goals

  • Ultra-high performance parsing by making the Common Case Fast (similar to original RISC manifesto). This may mean limiting functionality, but never compromising correctness. XML 1.0 compliancy is not sacrificed for speed.
  • Allow non-block, asynchronous parsing: it should be possible to "feed" more input and incrementally get more XML events out, without forcing the current thread to block on I/O read operation.

Dependency

Aalto dependency is usually added via Maven repository, so something like:

<dependency>
  <groupId>com.fasterxml</groupId>
  <artifactId>aalto-xml</artifactId>
  <version>0.9.11</version>
</dependency>

空文件

简介

Ultra-high performance non-blocking XML processor (Stax API + extensions) 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/xsnxj/aalto-xml.git
git@gitee.com:xsnxj/aalto-xml.git
xsnxj
aalto-xml
aalto-xml
master

搜索帮助