io.dylemma.spac.xml

Type members

Classlikes

Provides helpers for creating FS2 streams of io.dylemma.spac.xml.XmlEvent, using fs2-data-xml as the underlying event provider.

Provides helpers for creating FS2 streams of io.dylemma.spac.xml.XmlEvent, using fs2-data-xml as the underlying event provider.

Fs2-data is already pretty "plug-and-play", so at best this helper just removes a few steps/pipes that you would have to manually call.

For example:

  val charStream: Stream[IO, Char] = ???

  // this...
  val xmlStream1: Stream[IO, XmlEvent] = {
    import fs2.data.xml._
    charStream
      .through(events)
      .through(namespaceResolver)
      .through(reverenceResolver())
      .through(normalize)
      .through(Fs2DataSource.convert)
  }

  // could be replaced with
  val xmlStream2: Stream[IO, XmlEvent] = {
    Fs2DataSource.fromRawXmlStream(charStream)
  }

Essentially this helper just provides a convenient apply method that accepts String, Stream[F, Char], Stream[F, String], or Stream[F, fs2.data.xml.XmlEvent] to return a Stream[F, XmlEvent] which an XmlParser could then interact with.