Copyright | (c) Jonathan Merritt 2017 |
---|---|
License | BSD3 |
Maintainer | j.s.merritt@gmail.com |
Stability | Experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
This module contains the underlying machinery for the generic implementations of
the classes that read and write XML. Examples of this functionality include the
ability to get or set names of elements, get or set attributes, get or set child
elements, and so on. The Compose
and Decompose
data types abstract over any
underlying XML DOM representation to provide the required functionality. Thus,
provided Compose
and Decompose
can be written for a given XML DOM backend,
that backend can be used with xml-tydom
.
Importantly, the requirements of xml-tydom
may differ from those of any given
XML DOM backend. Because of this, Compose
and Decompose
both have the
concepts of freeze and thaw, which convert types in an actual XML DOM
backend to types that can be chosen to be well-suited to xml-tydom
itself.
These special element representations are referred to as compose-elements and
decompose-elements.
Compose
and Decompose
are parameterised by a variety of type variables that
describe the underlying API. We have attempted to name these in a uniform
fashion:
e
: type of an elementn
: type of the name of an elementa
: type of the name of an attributet
: type of text content in the XML documentc
: type of the temporary representation of a compose-element used by theCompose
data typed
: type of the temporary representation of a decompose-element used by theDecompose
data type
- data Compose e n a t c = Compose {}
- data Decompose e n a t d = Decompose {
- dThaw :: e -> d
- dFreeze :: d -> e
- dEmpty :: d
- dNull :: d -> Bool
- dName :: d -> n
- dRename :: n -> d -> d
- dAttr :: a -> d -> Result d t
- dNextSeqChild :: d -> Result d d
- dNextSeqContent :: d -> Result d t
- dNextSeqCData :: d -> Result d t
- dNextChildNamed :: n -> d -> Result d d
- dNextContent :: d -> Result d t
- dNextCData :: d -> Result d t
- dSuccessChild :: forall z. d -> (e -> Maybe z) -> Result d z
- dSuccessNextChildren :: forall z. d -> (e -> Maybe z) -> (d, [z])
- dSuccessChildren :: forall z. d -> (e -> Maybe z) -> (d, [z])
- dAllContent :: d -> Result d t
- dAllNextCData :: d -> (d, [t])
- dAllCData :: d -> (d, [t])
- dEmptyTxt :: t
- data Result d z
Summary
Types
data Compose e n a t c Source #
Composes an element.
Compose | |
|
data Decompose e n a t d Source #
Decomposes an element.
An important principle when decomposing an element is that when attributes or child nodes are returned, a new version of the element is also returned without those attributes or elements. This is important for the case where we want to check that an element has been read completely.
Decompose | |
|
Result type for operations from Decompose
.