package xml
xml-spac
uses classes from javax.xml.stream.events
to create parsing logic for XML.
The fundamental building blocks of an XML parser in xml-spac
are
io.dylemma.spac.xml.XMLParser.forText
for gathering text content from XML elementsio.dylemma.spac.xml.XMLParser.forMandatoryAttribute
io.dylemma.spac.xml.XMLParser.forOptionalAttribute
for gathering optional attributes from XML elementsio.dylemma.spac.xml.SingleElementContextMatcher
for building context matchers based on the XML element stack
There are several required implicits and optional conveniences included in this package object. You can access all of them at once via
import io.dylemma.spac.xml._
or import them individually via
import io.dylemma.spac.xml.Implicits._ import io.dylemma.spac.xml.ContextMatcherSyntax._
The imported conveniences provide methods like
ContextMatcherSyntax.elem
for matching elements by nameContextMatcherSyntax.attr
for extracting element attributes as contextContextMatcherSyntax.*
andContextMatcherSyntax.**
as wildcards for element matching
- Source
- package.scala
- Alphabetic
- By Inheritance
- xml
- Implicits
- ContextMatcherSyntax
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- trait SingleElementContextMatcher[+A] extends ContextMatcher[StartElement, A]
Specialization of ContextMatcher which only checks the first element in the stack for matching operations.
Specialization of ContextMatcher which only checks the first element in the stack for matching operations. Transformation operations on single-element matchers will yield other single-element matchers (rather than the base ContextMatcher type). Combination operations involving other single-element matchers will also yield single-element matchers. SingleElementContextMatchers form the building blocks of more complex matchers.
- A
The type of the matched context.
- type XMLContextMatcher[+Context] = ContextMatcher[StartElement, Context]
- class XMLEvents extends AnyRef
- type XMLParser[+T] = Parser[XMLEvent, T]
- trait XMLResource[-T] extends AnyRef
- class XMLSplitter[+Context] extends ContextStackSplitter[XMLEvent, StartElement, Context]
- type XMLTransformer[+T] = Transformer[XMLEvent, T]
Value Members
- val *: SingleElementContextMatcher[Unit]
Context matcher that matches any single element at the head of the tag stack.
Context matcher that matches any single element at the head of the tag stack.
- Definition Classes
- ContextMatcherSyntax
- val **: ContextMatcher[StartElement, Unit]
- Definition Classes
- ContextMatcherSyntax
- val Root: ContextMatcher[StartElement, Unit]
Context matcher that always matches without consuming any of the tag stack.
Context matcher that always matches without consuming any of the tag stack.
- Definition Classes
- ContextMatcherSyntax
- def attr(name: String): SingleElementContextMatcher[String]
Context matcher that extracts the given attribute from the element at the head of the stack.
Context matcher that extracts the given attribute from the element at the head of the stack.
- name
The local name of the attribute to extract
- Definition Classes
- ContextMatcherSyntax
- def attr(qname: QName): SingleElementContextMatcher[String]
Context matcher that extracts the given attribute from the element at the head of the stack.
Context matcher that extracts the given attribute from the element at the head of the stack.
- qname
The qualified name of the attribute to extract
- Definition Classes
- ContextMatcherSyntax
- implicit val consumableLikeXMLEvents: ConsumableLike[XMLEvents, XMLEvent]
Implicit evidence that an
XMLEvents
instance can be opened as a stream ofXMLEvent
.Implicit evidence that an
XMLEvents
instance can be opened as a stream ofXMLEvent
.- Definition Classes
- Implicits
- implicit def consumableLikeXMLResource[T](implicit arg0: XMLResource[T]): ConsumableLike[T, XMLEvent]
Implicit evidence that any value of type
T
can be opened as a stream ofXMLEvent
as long as T belongs to the XMLResource typeclass.Implicit evidence that any value of type
T
can be opened as a stream ofXMLEvent
as long as T belongs to the XMLResource typeclass.- T
A resource type that can be treated as a stream
- returns
Implicit evidence that
T
can be opened as a stream ofXMLEvent
- Definition Classes
- Implicits
- def elem(name: String): SingleElementContextMatcher[Unit]
Context matcher that matches the element at the head of the stack as long as its name (local part only) is equal to the given
name
Context matcher that matches the element at the head of the stack as long as its name (local part only) is equal to the given
name
- name
The required (local) name for the element at the head of the stack
- Definition Classes
- ContextMatcherSyntax
- def elem(qname: QName): SingleElementContextMatcher[Unit]
Context matcher that matches the element at the head of the stack as long as its name is equal to the given
qname
.Context matcher that matches the element at the head of the stack as long as its name is equal to the given
qname
.- qname
The required name (QName) for the element at the head of the stack
- Definition Classes
- ContextMatcherSyntax
- val extractElemName: SingleElementContextMatcher[String]
Context matcher that extracts the (local) name of the element at the head of the stack.
Context matcher that extracts the (local) name of the element at the head of the stack.
- Definition Classes
- ContextMatcherSyntax
- val extractElemQName: SingleElementContextMatcher[QName]
Context matcher that extracts the (qualified) name of the element at the head of the stack.
Context matcher that extracts the (qualified) name of the element at the head of the stack.
- Definition Classes
- ContextMatcherSyntax
- implicit def qnameToElemMatcher(qname: QName): SingleElementContextMatcher[Unit]
Implicitly convert a
QName
to anelem
matcherImplicitly convert a
QName
to anelem
matcher- Definition Classes
- ContextMatcherSyntax
- implicit def stringToElemMatcher(name: String): SingleElementContextMatcher[Unit]
Implicitly convert a
String
to anelem
matcherImplicitly convert a
String
to anelem
matcher- Definition Classes
- ContextMatcherSyntax
- implicit val xmlStackable: Aux[XMLEvent, StartElement]
A
io.dylemma.spac.types.Stackable
instance for XML, usingXMLEvent
as the input type, andStartElement
as the context stack element type.A
io.dylemma.spac.types.Stackable
instance for XML, usingXMLEvent
as the input type, andStartElement
as the context stack element type.- Definition Classes
- Implicits
- object ContextMatcherSyntax extends ContextMatcherSyntax
Defines XML-specific conveniences for creating
ContextMatchers
.Defines XML-specific conveniences for creating
ContextMatchers
.The contents of
ContextMatcherSyntax
are inherited by this package object, so you can choose to import them along with all of the other "syntax" helpers by importingio.dylemma.spac.xml._
, or import theImplicits
specifically viaio.dylemma.spac.xml.ContextMatcherSyntax._
. - object Implicits extends Implicits
Defines XML-specific instances for the core spac typeclasses.
Defines XML-specific instances for the core spac typeclasses.
The contents of
Implicits
are inherited by this package object, so you can choose to import them along with all of the other "syntax" helpers by importingio.dylemma.spac.xml._
, or import theImplicits
specifically viaio.dylemma.spac.xml.Implicits._
. - object SingleElementContextMatcher
- object XMLEvents
- object XMLParser
- object XMLResource
- object XMLSplitter