Example usage for org.springframework.util.xml StaxUtils createStaxSource

List of usage examples for org.springframework.util.xml StaxUtils createStaxSource

Introduction

In this page you can find the example usage for org.springframework.util.xml StaxUtils createStaxSource.

Prototype

public static Source createStaxSource(XMLEventReader eventReader) throws XMLStreamException 

Source Link

Document

Create a JAXP 1.4 StAXSource for the given XMLEventReader .

Usage

From source file:org.emonocot.job.io.StaxEventItemReader.java

/**
 * Move to next fragment and map it to item.
 * @return an item//w  ww .  ja  va2  s . c  om
 * @throws Exception if there is a problem reading from the resource
 */
protected final T doRead() throws Exception {

    if (noInput) {
        return null;
    }

    T item = null;

    if (moveCursorToNextFragment(fragmentReader)) {
        fragmentReader.markStartFragment();

        @SuppressWarnings("unchecked")
        T mappedFragment = (T) unmarshaller.unmarshal(StaxUtils.createStaxSource(fragmentReader));

        item = mappedFragment;
        fragmentReader.markFragmentProcessed();
    }

    return item;
}