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 | Safe
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 # |
Methods showsPrec :: Int -> XML -> ShowS # show :: XML -> String # showList :: [XML] -> ShowS #
(Functor m, Monad m) => XMLGenerator (HSPT XML m) Source # |
(Functor m, Monad m) => XMLGen (HSPT XML m) Source # |

Associated Types

type XMLType (HSPT XML m :: * -> *) :: * Source #

type StringType (HSPT XML m :: * -> *) :: * Source #

data ChildType (HSPT XML m :: * -> *) :: * Source #

data AttributeType (HSPT XML m :: * -> *) :: * Source #

Methods

genElement :: Name (StringType (HSPT XML m)) -> [XMLGenT (HSPT XML m) [AttributeType (HSPT XML m)]] -> [XMLGenT (HSPT XML m) [ChildType (HSPT XML m)]] -> XMLGenT (HSPT XML m) (XMLType (HSPT XML m)) Source #

genEElement :: Name (StringType (HSPT XML m)) -> [XMLGenT (HSPT XML m) [AttributeType (HSPT XML m)]] -> XMLGenT (HSPT XML m) (XMLType (HSPT XML m)) Source #

xmlToChild :: XMLType (HSPT XML m) -> ChildType (HSPT XML m) Source #

pcdataToChild :: StringType (HSPT XML m) -> ChildType (HSPT XML m) Source #

(Functor m, Monad m) => AppendChild (HSPT XML m) XML Source # |
Methods appChild :: XML -> GenChild (HSPT XML m) -> GenXML (HSPT XML m) Source # appAll :: XML -> GenChildList (HSPT XML m) -> GenXML (HSPT XML m) Source #
(Functor m, Monad m) => SetAttr (HSPT XML m) XML Source # |
Methods setAttr :: XML -> GenAttribute (HSPT XML m) -> GenXML (HSPT XML m) Source # setAll :: XML -> GenAttributeList (HSPT XML m) -> GenXML (HSPT XML m) Source #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute Source # |
Methods asAttr :: Attribute -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) () Source # |
Methods asChild :: () -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Char Source # |
Methods asChild :: Char -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text Source # |
Methods asChild :: Text -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text Source # |
Methods asChild :: Text -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) String Source # |
Methods asChild :: String -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) XML Source # |
Methods asChild :: XML -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) [XML] Source # |
Methods asChild :: [XML] -> GenChildList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) Source # |
Methods asAttr :: Attr Text () -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) Source # |
Methods asAttr :: Attr Text () -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) Source # |
Methods asAttr :: Attr Text Int -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) Source # |
Methods asAttr :: Attr Text Int -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) Source # |
Methods asAttr :: Attr Text Bool -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) Source # |
Methods asAttr :: Attr Text Bool -> GenAttributeList (HSPT XML m) Source #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) Source # |
Methods asAttr :: Attr Text Char -> GenAttributeList (HSPT XML m) Source #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) Source # |
Methods asAttr :: Attr Text Char -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source # |
Methods asAttr :: Attr Text Text -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source # |
Methods asAttr :: Attr Text Text -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source # |
Methods asAttr :: Attr Text Text -> GenAttributeList (HSPT XML m) Source #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) Source # |
Methods asAttr :: Attr Text Text -> GenAttributeList (HSPT XML m) Source #
type XMLType (HSPT XML m) Source # |
type XMLType (HSPT XML m) = XML
type StringType (HSPT XML m) Source # |
type StringType (HSPT XML m) = Text
data ChildType (HSPT XML m) Source # |

data ChildType (HSPT XML m) = HSPChild {

- unHSPChild :: XML

}

data AttributeType (HSPT XML m) Source # |

data AttributeType (HSPT XML m) = HSPAttr {

- unHSPAttr :: Attribute

}

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 # |
Methods showsPrec :: Int -> Attribute -> ShowS # show :: Attribute -> String # showList :: [Attribute] -> ShowS #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute Source # |
Methods asAttr :: Attribute -> GenAttributeList (HSPT XML m) Source #

data AttrValue Source #

Represents an attribue value.

Constructors

Value Bool Text |
NoValue |

Instances

Show AttrValue Source # |
Methods showsPrec :: Int -> AttrValue -> ShowS # show :: AttrValue -> String # showList :: [AttrValue] -> ShowS #

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 #