Package

kantan

xpath

Permalink

package xpath

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. xpath
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Attr = org.w3c.dom.Attr

    Permalink
  2. sealed case class CompileError(message: String) extends XPathError with Product with Serializable

    Permalink

    Describes a XPath expression compilation error.

  3. type CompileResult[A] = Either[CompileError, A]

    Permalink

    Represents the result of taking a string and compiling it into an XPath query.

  4. trait Compiler[A] extends Serializable

    Permalink

    Compiles XPath expressions.

    Compiles XPath expressions.

    There's very little reason to interact with this class directly, it's only meant to act as a bridge between XPathCompiler and Query.

  5. sealed abstract class DecodeError extends ReadError

    Permalink

    Describes an error that occurred while decoding some XML content.

  6. type DecodeResult[A] = Either[DecodeError, A]

    Permalink

    Represents the result of taking some raw XPath result and turning it into a usable type.

    Represents the result of taking some raw XPath result and turning it into a usable type.

    Creation methods can be found in the companion object.

  7. type Document = org.w3c.dom.Document

    Permalink
  8. type Element = org.w3c.dom.Element

    Permalink
  9. trait GeneratedDecoders extends AnyRef

    Permalink
  10. type InputSource = org.xml.sax.InputSource

    Permalink
  11. trait LowPriorityXmlSourceInstances extends AnyRef

    Permalink
  12. type Node = org.w3c.dom.Node

    Permalink
  13. type NodeDecoder[A] = Decoder[Option[Node], A, DecodeError, codecs.type]

    Permalink

    Type class for types that can be decoded from an XML Node.

  14. trait NodeDecoderInstances extends AnyRef

    Permalink

    Provides default NodeDecoder instances.

  15. type NodeList = org.w3c.dom.NodeList

    Permalink
  16. sealed abstract class ParseError extends ReadError

    Permalink

    Describes errors that occur while parsing XML content.

  17. type ParseResult[A] = Either[ParseError, A]

    Permalink

    Represents the result of taking some raw data and turning it into a usable type.

    Represents the result of taking some raw data and turning it into a usable type.

    Creation methods can be found in the companion object.

  18. trait Query[A] extends Serializable

    Permalink

    Compiled XPath expression.

    Compiled XPath expression.

    Instance creation is achieved through the companion object.

  19. sealed abstract class ReadError extends XPathError

    Permalink

    Describes an error that occurred while parsing and / or decoding XML content.

  20. type ReadResult[A] = Either[ReadError, A]

    Permalink

    Represents the result of applying an XPath expression, applying to raw data and turning it into usable types.

    Represents the result of applying an XPath expression, applying to raw data and turning it into usable types.

    A ReadResult is either a DecodeResult or a ParseResult.

  21. final case class RemoteXmlSource[A](toURL: (A) ⇒ ParseResult[URL], retry: RetryStrategy, headers: Map[String, String])(implicit parser: XmlParser) extends XmlSource[A] with Product with Serializable

    Permalink

    XmlSource implementation anything that can be turned into a java.io.URL.

    XmlSource implementation anything that can be turned into a java.io.URL.

    The main purpose here is to allow application developers to set their own HTTP headers: when scraping websites, it's typically necessary to change the default user agent to something a bit more browser-like.

  22. final case class RetryStrategy(max: Int, delay: Long, factor: (Int) ⇒ Int) extends Product with Serializable

    Permalink

    Describes how to retry failed request for RemoteXmlSource.

    Describes how to retry failed request for RemoteXmlSource.

    Constructors for commonly used patterns can be found in the RetryStrategy$ companion object.

    max

    maximum number of attempts that can be made for a given request.

    delay

    delay, in milliseconds, between each attempt.

    factor

    function that calculates the delay factor based on the number of requests already attempted. In order to double waiting times between each attempt, for example, one would pass i ⇒ 2 ^ i.

  23. trait XPathCompiler extends Serializable

    Permalink

    Compiles XPath expressions.

    Compiles XPath expressions.

    There's always a default instance in scope, which should be perfectly suitable for most circumstances. Still, if some non-standard options are required, one can always declare a local implicit instance.

    Be careful, however: the default compiler performs some tricks to make sure its results are serializable. If you're planning on using frameworks that require serialization, such as Apache Spark, think twice about using a non-default compiler.

  24. sealed abstract class XPathError extends Error

    Permalink

    Describes an error that can occur while dealing with XPath.

  25. type XPathExpression = javax.xml.xpath.XPathExpression

    Permalink
  26. type XPathResult[A] = Either[XPathError, A]

    Permalink

    Represents the result of any XPath action.

    Represents the result of any XPath action.

    An XPathResult is either a CompileResult or a ReadResult.

  27. trait XmlParser extends AnyRef

    Permalink

    Contract for anything that knows how to parse XML.

    Contract for anything that knows how to parse XML.

    The default implementation is always in scope and uses the standard java javax.xml.parsers.DocumentBuilderFactory, with no special option. This can be overridden to set some options or, more drastically, to change the parsing mechanism entirely. A typical use case is the nekohtml module, which needs to take control of the entire parsing process to tidy up messy HTML documents.

  28. trait XmlSource[-A] extends Serializable

    Permalink

    Type class for turning instances of A into valid instances of Node.

    Type class for turning instances of A into valid instances of Node.

    While it's certainly possible, instances of XmlSource are rarely used directly. The preferred, idiomatic way is to use the implicit syntax provided by XmlSourceOps, brought in scope by importing kantan.xpath.ops._.

    See the companion object for construction methods and default instances.

Value Members

  1. object CompileError extends ErrorCompanion[CompileError]

    Permalink
  2. object CompileResult extends WithError[CompileError]

    Permalink
  3. object Compiler extends Serializable

    Permalink

    Provides implicit methods to summon Compiler instances.

  4. object DecodeError extends Serializable

    Permalink
  5. object DecodeResult extends WithDefault[DecodeError]

    Permalink

    Provides instance creation methods for DecodeResult.

  6. object NodeDecoder extends GeneratedDecoders with DecoderCompanion[Option[Node], DecodeError, codecs.type]

    Permalink

    Provides instance creation and summoning methods.

  7. object ParseError extends Serializable

    Permalink
  8. object ParseResult extends WithDefault[ParseError]

    Permalink

    Provides instance creation methods for ParseResult.

  9. object Query extends Serializable

    Permalink

    Provides convenient methods for XPath expression compilation.

    Provides convenient methods for XPath expression compilation.

    Actual compilation is done through instances of Compiler. Methods declared here will simply summon the right implicit value.

  10. object ReadResult extends Simple[ReadError]

    Permalink
  11. object RetryStrategy extends Serializable

    Permalink
  12. object XPathCompiler extends Serializable

    Permalink
  13. object XPathResult extends Simple[XPathError]

    Permalink
  14. object XmlParser

    Permalink

    Declares the default XmlParser instance in the implicit scope.

  15. object XmlSource extends LowPriorityXmlSourceInstances with Serializable

    Permalink

    Defines convenience methods for creating and summoning XmlSource instances.

    Defines convenience methods for creating and summoning XmlSource instances.

    Default implementation of standard types are declared here, always bringing them in scope without requirnig an explicit import.

    The default implementations can also be useful when writing new instances: if you need to write an XmlSource[T] and already have an XmlSource[S] and a T ⇒ S, you just need to call XmlSource.contramap to get your implementation.

  16. object codecs extends NodeDecoderInstances

    Permalink
  17. object implicits extends ToXPathLiteral with AllOps

    Permalink
  18. package literals

    Permalink
  19. package ops

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped