JavaxSource

io.dylemma.spac.xml.JavaxSource
object JavaxSource

Provides helpers for creating Source[XmlEvent] using javax.xml.stream for the underlying event provider.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(eventReader: XMLEventReader): Source[XmlEvent]
def fromFile(file: File, factory: XMLInputFactory): Source[XmlEvent]

Returns a Source[XmlEvent] which can open the given file to read raw XML data.

Returns a Source[XmlEvent] which can open the given file to read raw XML data.

The returned Source is reusable. The underlying streams are managed by the open method and the close function it returns.

Value parameters

factory

Factory instance for the underlying Javax parser

file

A file containing XML

Attributes

Returns

A reusable Source[XmlEvent]

def fromFileWithCharset(file: File, charset: String, factory: XMLInputFactory): Source[XmlEvent]

Like fromFile, but passes an explicit charset to the underlying XmlEventReader constructor.

Like fromFile, but passes an explicit charset to the underlying XmlEventReader constructor.

Value parameters

charset

A Charset name used to interpret the bytes to characters

factory

Factory instance for the underlying Javax parser

file

A file containing XML

Attributes

def fromInputStream(rawXml: InputStream, factory: XMLInputFactory): Source[XmlEvent]

Returns a single-use Source[XmlEvent] which interprets the contents of the given InputStream as raw XML bytes.

Returns a single-use Source[XmlEvent] which interprets the contents of the given InputStream as raw XML bytes.

The returned Source will not attempt to close the rawXml stream; responsibility for closing rawXml lies with whoever created it.

Value parameters

factory

Factory instance for the underlying Javax parser

rawXml

An InputStream containing raw XML bytes

Attributes

Returns

A single-use Source[XmlEvent]

def fromInputStreamWithCharset(rawXml: InputStream, charset: String, factory: XMLInputFactory): Source[XmlEvent]

Returns a single-use Source[XmlEvent] which interprets the contents of the given InputStream as raw XML bytes, passing the given charset to the underlying XMLEventReader constructor

Returns a single-use Source[XmlEvent] which interprets the contents of the given InputStream as raw XML bytes, passing the given charset to the underlying XMLEventReader constructor

The returned Source will not attempt to close the rawXml stream; responsibility for closing rawXml lies with whoever created it.

Value parameters

charset

Name of the charset used to interpret the bytes to characters.

factory

Factory instance for the underlying Javax parser

rawXml

An InputStream containing raw XML bytes

Attributes

Returns

A single-use Source[XmlEvent]

def fromReader(rawXml: Reader, factory: XMLInputFactory): Source[XmlEvent]

Returns a single-use Source[XmlEvent] which interprets the contents of the given Reader as raw XML characters.

Returns a single-use Source[XmlEvent] which interprets the contents of the given Reader as raw XML characters.

The returned Source will not attempt to close the rawXml reader; responsibility for closing rawXml lies with whoever created it.

Value parameters

factory

Factory instance for the underlying Javax parser

rawXml

A Reader containing raw XML character data

Attributes

Returns

A single-use Source[XmlEvent]

def fromString(rawXml: String, factory: XMLInputFactory): Source[XmlEvent]

Returns a Source[XmlEvent] which interprets the given string as raw XML.

Returns a Source[XmlEvent] which interprets the given string as raw XML.

Value parameters

factory

Factory instance for the underlying Javax parser

rawXml

A string of raw XML

Attributes

Returns

A reusable Source[XmlEvent]

Concrete fields

lazy val defaultFactory: XMLInputFactory

Default XMLInputFactory used when creating an underlying XMLEventReader with the methods in this object.

Default XMLInputFactory used when creating an underlying XMLEventReader with the methods in this object.

This factory disables the IS_REPLACING_ENTITY_REFERENCES and IS_SUPPORTING_EXTERNAL_ENTITIES features, in efforts to mitigate xml injection attacks.

When using the methods in this object, if you want to override this default factory, define an implicit XMLInputFactory somewhere and make it available in the scope where you call the method, e.g.

  implicit val mySpecificXmlFactory: XMLInputFactory = ???
  val xmlEvents = JavaxSource[IO](new File("./stuff.xml"))

Attributes