Thimmwork XML-Iteration

a lightweight collection of utilities for iterating and parsing xml streams based on JAXB

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.thimmwork
Идентификатор

Идентификатор

xml-iteration
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Thimmwork XML-Iteration
a lightweight collection of utilities for iterating and parsing xml streams based on JAXB
Ссылка на сайт

Ссылка на сайт

https://github.com/thimmwork/xml-iteration
Система контроля версий

Система контроля версий

https://github.com/thimmwork/xml-iteration/tree/master

Скачать xml-iteration

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.thimmwork/xml-iteration/ -->
<dependency>
    <groupId>net.thimmwork</groupId>
    <artifactId>xml-iteration</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.thimmwork/xml-iteration/
implementation 'net.thimmwork:xml-iteration:1.0'
// https://jarcasting.com/artifacts/net.thimmwork/xml-iteration/
implementation ("net.thimmwork:xml-iteration:1.0")
'net.thimmwork:xml-iteration:jar:1.0'
<dependency org="net.thimmwork" name="xml-iteration" rev="1.0">
  <artifact name="xml-iteration" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.thimmwork', module='xml-iteration', version='1.0')
)
libraryDependencies += "net.thimmwork" % "xml-iteration" % "1.0"
[net.thimmwork/xml-iteration "1.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.2.30
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

XML Iteration

This library provides classes for de/serializing collections/streams of objects to XML. It relies heavily on JAXB.

Build Status

Deserialization

XMLIterator

Given an InputStream containing the XML

<fruits>
  <fruit name="orange"/>
  <fruit name="lemon"/>
</fruits>
  • the XML element name fruit and
  • a class Fruit with suitable JAXB annotations,

the XMLIterator streams the InputStream until it finds a closing tag of fruit and deserializes it to an instance of Fruit:

XMLIterator<Fruit> iterator = new XMLIterator<>(inputStream, Fruit.class, "fruit");
while (iterator.hasNext()) {
    System.out.println(iterator.next().getName());
}
for (Fruit fruit : new XMLIterator<>(inputStream, Fruit.class, "fruit")) {
    System.out.println(fruit.getName());
}

will result in the output

orange
lemon

Iteration will occur on calls of hasNext() and continue until the end of the stream is reached.

Beware that if the stream is infinite and does not contain any matching element, the stream will iterate indefinitely!

Версии библиотеки

Версия
1.0