Convenience method to turn an XMLEventReader into a Scala Iterator of XMLEvent objects.
Converts a StAX Comment
event to a yaidom Comment
Converts the given iterator of XMLEvent
instances to a yaidom Document
.
Converts the given iterator of XMLEvent
instances to a yaidom Document
.
First drops events until a "start document" event is found. After conversion, no "start/end document/element" events may be left.
Converts the given sequence of XMLEvent
instances to a yaidom Document
.
Converts the given sequence of XMLEvent
instances to a yaidom Document
. Invokes convertToDocument(v.iterator)
.
Converts the given iterator of XMLEvent
instances to a yaidom Elem
.
Converts the given iterator of XMLEvent
instances to a yaidom Elem
.
First drops events until a "start element" event is found. After conversion, no "start/end element" events may be left. The given parent scope is used.
Be careful: the namespaces inherited by the "start element event", if any, are ignored! In other words, the ancestry of the passed events is entirely ignored. This may cause an exception to be thrown, if there are indeed such namespaces, unless they are a subset of the passed parent scope.
Converts the given sequence of XMLEvent
instances to a yaidom Elem
.
Converts the given sequence of XMLEvent
instances to a yaidom Elem
. Invokes convertToElem(v.iterator, parentScope)
.
Be careful: the namespaces inherited by the "start element event", if any, are ignored! In other words, the ancestry of the passed events is entirely ignored. This may cause an exception to be thrown, if there are indeed such namespaces, unless they are a subset of the passed parent scope.
Converts a StAX EntityReference
event to a yaidom EntityRef
Converts the iterator of XMLEvents to an iterator of EventWithAncestry objects.
Converts the iterator of XMLEvents to an iterator of EventWithAncestry objects. This method can also be used in streaming scenarios, where only chunks of a large XML stream are kept in memory at any moment in time.
Converts a StAX ProcessingInstruction
event to a yaidom ProcessingInstruction
Converts a StAX Characters
event to a yaidom Text
Given a buffered iterator of EventWithAncestry objects, converts the (initial) events to a Document.
Given a buffered iterator of EventWithAncestry objects, converts the (initial) events to a Document. The first event must be a StartDocument event, or else an exception is thrown.
The input iterator should come from a call to method convertToEventWithAncestryIterator
.
Given a buffered iterator of EventWithAncestry objects, converts the (initial) events to a Elem.
Given a buffered iterator of EventWithAncestry objects, converts the (initial) events to a Elem. The first event must be a StartElement event, or else an exception is thrown. The iterator can still be used afterwards for the remaining events.
The input iterator should come from a call to method convertToEventWithAncestryIterator
.
Given a buffered iterator of EventWithAncestry objects, converts the (initial) events to an Elem sequence until the predicate holds.
Given a buffered iterator of EventWithAncestry objects, converts the (initial) events to an Elem sequence until the predicate holds. The first event, if any, must be a StartElement event, or else an exception is thrown. The iterator can still be used afterwards for the remaining events.
The input iterator should come from a call to method convertToEventWithAncestryIterator
.
Note that comments, processing instructions etc. may get lost in this operation. Be careful with the predicate: if it does not hold for the last elements, they are returned anyway. Moreover, if the predicate does not stop in time, too many elements may be kept in memory.
TODO Return a Node collection instead, or create a similar method that returns a Node collection.
Converter from StAX events to yaidom nodes, in particular from
immutable.IndexedSeq[XMLEvent]
to eu.cdevreeze.yaidom.simple.Elem and to eu.cdevreeze.yaidom.simple.Document.There are also analogous conversions that take an
Iterator[XMLEvent]
instead. These can be used to reduce memory usage.This converter regards the input event stream more like an "ElemBuilder" than an "Elem", in that namespace declarations instead of scopes are extracted from input "elements", and in that conversions to yaidom Elems take an additional parent scope parameter (against which namespace declarations are resolved to get the scope of the yaidom element).