Class DomTripStreamReader

java.lang.Object
eu.maveniverse.domtrip.stax.DomTripStreamReader
All Implemented Interfaces:
XMLStreamConstants, XMLStreamReader

public class DomTripStreamReader extends Object implements XMLStreamReader
Pull-based XMLStreamReader implementation backed by a domtrip Document.

This enables domtrip to participate in StAX-based XML processing pipelines. Rather than serializing to a string and re-parsing, the reader walks the domtrip tree directly and exposes it as a sequence of StAX events via the cursor API.

Note: Formatting preservation is intentionally lost at this boundary since StAX events do not carry formatting metadata. The value is interoperability, not round-tripping through StAX.

Usage Examples:

Document doc = Document.of(xml);

// Create a StAX reader
DomTripStreamReader reader = new DomTripStreamReader(doc);
while (reader.hasNext()) {
    int event = reader.next();
    // process events...
}

// Use with JAXP via StAXSource
StAXSource source = DomTripStAXSource.of(doc);
transformer.transform(source, result);
Since:
1.3.0
See Also: