trait XmlReader[+A] extends AnyRef
An abstraction for a function that takes a NodeSeq and returns a ParseResult.
It is used to parse XML to arbitrary scala objects, and supports combinatorial syntax to easily compose XmlReaders into new XmlReaders.
- Self Type
- XmlReader[A]
- Alphabetic
- By Inheritance
- XmlReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def read(xml: NodeSeq): ParseResult[A]
The core operation of an XmlReader, it converts an xml NodeSeq into a ParseResult of the desired type.
The core operation of an XmlReader, it converts an xml NodeSeq into a ParseResult of the desired type.
- xml
The xml to read from.
- returns
The ParseResult resulting from reading the xml.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[B](other: XmlReader[B])(implicit witness: <:<[A, NodeSeq]): XmlReader[B]
Similar to compose but with the operands reversed.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def collect[B](f: PartialFunction[A, B]): XmlReader[B]
Map a partial function over the XmlReader.
Map a partial function over the XmlReader. If the partial function isn't defined for the input, returns a ParseFailure.
- def collect[B](otherwise: => ParseError)(f: PartialFunction[A, B]): XmlReader[B]
Map a partial function over the XmlReader.
Map a partial function over the XmlReader. If the partial function isn't defined for the input, returns a ParseFailure containing
otherwiseas its error. - def compose[B <: NodeSeq](r: XmlReader[B]): XmlReader[A]
Compose this XmlReader with another.
- def default[B >: A](v: B): XmlReader[B]
Use a default value if unable to parse, always successful, drops any errors
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filter(error: => ParseError)(p: (A) => Boolean): XmlReader[A]
Similar to filter(p:A=>Boolean):*, but allows you to supply the ParseError to use if the filter test fails.
Similar to filter(p:A=>Boolean):*, but allows you to supply the ParseError to use if the filter test fails.
- error
The error to use if the filter fails.
- p
The predicate to filter with
- def filter(p: (A) => Boolean): XmlReader[A]
Filter the result of the XmlReader.
Filter the result of the XmlReader. It filters the resulting ParseResult after reading.
- p
The predicate to filter with
- def flatMap[B](f: (A) => XmlReader[B]): XmlReader[B]
Similar to map but does a flatMap on the ParseResult rather than a map.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (A) => B): XmlReader[B]
Map the XmlReader.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def optional: XmlReader[Option[A]]
Convert to a reader that always succeeds with an option (None if it would have failed).
Convert to a reader that always succeeds with an option (None if it would have failed). Any errors are dropped
- def or[B >: A](other: XmlReader[B]): XmlReader[B]
- returns
New XmlReader that succeeds if either this or
vsucceeds on the input. This has preference. If both fail the ParseFailure contains the errors from both.
- def orElse[B >: A](v: => XmlReader[B]): XmlReader[B]
Like
orbut takes a by-name parameter and doesn't combine errors.Like
orbut takes a by-name parameter and doesn't combine errors.- returns
New XmlReader that succeeds if either this or
vsucceeds on the input. this has preference.
- def recover[B >: A](otherwise: B): XmlReader[B]
Recover from a failed parse, keeping any errors.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryMap[B](fe: (A) => ParseError)(f: (A) => B): XmlReader[B]
Try to map, and if there is an exception, return a failure with the supplied error
Try to map, and if there is an exception, return a failure with the supplied error
- B
The type to map into.
- fe
A function that returns the appropriate ParseError if mapping failed.
- f
The mapping function.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def |[B >: A](other: XmlReader[B]): XmlReader[B]
Alias for
or