hsp-0.10.0: Haskell Server Pages is a library for writing dynamic server-side web pages.

Copyright | (c) Niklas Broberg 2008-2013
License | BSD-style (see the file LICENSE.txt)
Maintainer | Niklas Broberg, niklas.broberg@gmail.com
Stability | experimental
Portability | Haskell 98
Safe Haskell | None
Language | Haskell98

HSP.XML

Contents

- The `XML` datatype
- The Attribute type
- Functions

Description

Datatypes and type classes comprising the basic model behind the scenes of Haskell Server Pages tags.

Synopsis

- data XML
  - = Element NSName Attributes Children
  - | CDATA Bool Text
- data XMLMetaData = XMLMetaData {
  - doctype :: (Bool, Text)
  - contentType :: Text
  - preferredRenderer :: XML -> Builder
  }
- type Namespace = Maybe Text
- type NSName = (Namespace, Text)
- type Attributes = [Attribute]
- type Children = [XML]
- pcdata :: Text -> XML
- cdata :: Text -> XML
- newtype Attribute = MkAttr (NSName, AttrValue)
- data AttrValue
  - = Value Bool Text
  - | NoValue
- attrVal :: Text -> AttrValue
- pAttrVal :: Text -> AttrValue
- renderXML :: XML -> Text
- isElement :: XML -> Bool
- isCDATA :: XML -> Bool
- fromStringLit :: String -> Text

# The `XML` datatype

data XML Source

The XML datatype representation. Is either an Element or CDATA.

Constructors

Element NSName Attributes Children |
CDATA Bool Text |

Instances

Show XML Source |
(Functor m, Monad m) => XMLGenerator (HSPT XML m) Source |
(Functor m, Monad m) => XMLGen (HSPT XML m) Source |
(Functor m, Monad m) => AppendChild (HSPT XML m) XML Source |
(Functor m, Monad m) => SetAttr (HSPT XML m) XML Source |
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) () Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Char Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) String Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) XML Source |
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) [XML] Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) Source |
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) Source |
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source |
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source |
type XMLType (HSPT XML m) = XML Source |
type StringType (HSPT XML m) = Text Source |

data ChildType (HSPT XML m) = HSPChild {

- unHSPChild :: XML

} Source

data AttributeType (HSPT XML m) = HSPAttr {

- unHSPAttr :: Attribute

} Source

data XMLMetaData Source

The XMLMetaData datatype

Specify the DOCTYPE, content-type, and preferred render for XML data.

See also: `setMetaData` and `withMetaData`

Constructors

XMLMetaData |

Fields

doctype :: (Bool, Text)

  (show doctype when rendering, DOCTYPE string)

contentType :: Text
preferredRenderer :: XML -> Builder

type Namespace = Maybe Text Source

type NSName = (Namespace, Text) Source

type Attributes = [Attribute] Source

type Children = [XML] Source

pcdata :: Text -> XML Source

Embeds a string as a CDATA XML value.

cdata :: Text -> XML Source

Embeds a string as a CDATA XML value.

# The Attribute type

newtype Attribute Source

Constructors

MkAttr (NSName, AttrValue) |

Instances

Show Attribute Source |
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute Source |

data AttrValue Source

Represents an attribue value.

Constructors

Value Bool Text |
NoValue |

Instances

Show AttrValue Source |

attrVal :: Text -> AttrValue Source

Create an attribue value from a string.

pAttrVal :: Text -> AttrValue Source

Create an attribue value from a string.

# Functions

renderXML :: XML -> Text Source

Pretty-prints XML values.

isElement :: XML -> Bool Source

Test whether an XML value is an Element or CDATA

isCDATA :: XML -> Bool Source

Test whether an XML value is an Element or CDATA

fromStringLit :: String -> Text Source