XmlSplitterApplyOps

io.dylemma.spac.xml.`package`.XmlSplitterApplyOps
final implicit class XmlSplitterApplyOps(val splitter: Splitter.type) extends AnyVal

Adds Splitter.xml, for constructing element matcher-based XmlSplitters.

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Value members

Concrete methods

def xml[C](matcher: ContextMatcher[ElemStart, C])(implicit pos: CallerPos): XmlSplitter[C]

Creates a Splitter over XmlEvents using the given matcher to determine where sub-streams start and end. For example, Splitter.xml(* \ "foo") when applied to the xml:

Creates a Splitter over XmlEvents using the given matcher to determine where sub-streams start and end. For example, Splitter.xml(* \ "foo") when applied to the xml:

<elem>
  <foo>hello</foo>
  <foo>goodbye</foo>
</elem>

would identify the first and second <foo> elements as separate substreams, containing the events ElemStart(foo), Text(hello), ElemEnd(foo) and ElemStart(foo), Text(goodbye), ElemEnd(foo) respectively.

Any context matched by the matcher will be passed to the "joiner" functions, e.g. flatMap and map.

Type parameters

C

The context type returned by the matcher

Value parameters

matcher

A ContextMatcher used to identify where each sub-stream begins and ends, and extracts some context value to identify each sub-stream.

pos

Used to construct a SpacFrameElement if a parser constructed from this splitter fails

Attributes

Returns

A new Splitter that splits the source into sub-streams identified by the matcher

Concrete fields

val splitter: Splitter.type