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-Inferred
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 #

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

Constructors

Element NSName Attributes Children |
CDATA Bool Text |

#### Instances

Instances details

Show XML # |
Instance details Defined in HSP.XML Methods showsPrec :: Int -> XML -> ShowS # show :: XML -> String # showList :: [XML] -> ShowS #
(Functor m, Monad m) => XMLGenerator (HSPT XML m) # |
Instance details Defined in HSP.Monad
(Functor m, Monad m) => XMLGen (HSPT XML m) # |
Instance details Defined in HSP.Monad Associated Types type XMLType (HSPT XML m) # type StringType (HSPT XML m) # data ChildType (HSPT XML m) # data AttributeType (HSPT XML m) # 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)) # genEElement :: Name (StringType (HSPT XML m)) -> [XMLGenT (HSPT XML m) [AttributeType (HSPT XML m)]] -> XMLGenT (HSPT XML m) (XMLType (HSPT XML m)) # xmlToChild :: XMLType (HSPT XML m) -> ChildType (HSPT XML m) # pcdataToChild :: StringType (HSPT XML m) -> ChildType (HSPT XML m) #
(Functor m, Monad m) => AppendChild (HSPT XML m) XML # |
Instance details Defined in HSP.Monad Methods appChild :: XML -> GenChild (HSPT XML m) -> GenXML (HSPT XML m) # appAll :: XML -> GenChildList (HSPT XML m) -> GenXML (HSPT XML m) #
(Functor m, Monad m) => SetAttr (HSPT XML m) XML # |
Instance details Defined in HSP.Monad Methods setAttr :: XML -> GenAttribute (HSPT XML m) -> GenXML (HSPT XML m) # setAll :: XML -> GenAttributeList (HSPT XML m) -> GenXML (HSPT XML m) #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute # |
Instance details Defined in HSP.Monad Methods asAttr :: Attribute -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) () # |
Instance details Defined in HSP.Monad Methods asChild :: () -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Char # |
Instance details Defined in HSP.Monad Methods asChild :: Char -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text # |
Instance details Defined in HSP.Monad Methods asChild :: Text -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) Text # |
Instance details Defined in HSP.Monad Methods asChild :: Text -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) String # |
Instance details Defined in HSP.Monad Methods asChild :: String -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) XML # |
Instance details Defined in HSP.Monad Methods asChild :: XML -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsChild (HSPT XML m) [XML] # |
Instance details Defined in HSP.Monad Methods asChild :: [XML] -> GenChildList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text () -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text ()) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text () -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Int -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Int) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Int -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Bool -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Bool) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Bool -> GenAttributeList (HSPT XML m) #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Char -> GenAttributeList (HSPT XML m) #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) (Attr Text Char) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Char -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text0 Text -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Text -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Text0 -> GenAttributeList (HSPT XML m) #
(Functor m, Monad m) => EmbedAsAttr (HSPT XML m) (Attr Text Text) # |
Instance details Defined in HSP.Monad Methods asAttr :: Attr Text Text -> GenAttributeList (HSPT XML m) #
type XMLType (HSPT XML m) # |
Instance details Defined in HSP.Monad type XMLType (HSPT XML m) = XML
type StringType (HSPT XML m) # |
Instance details Defined in HSP.Monad type StringType (HSPT XML m) = Text
newtype ChildType (HSPT XML m) # |
Instance details Defined in HSP.Monad newtype ChildType (HSPT XML m) = HSPChild { unHSPChild :: XML }
newtype AttributeType (HSPT XML m) # |
Instance details Defined in HSP.Monad newtype AttributeType (HSPT XML m) = HSPAttr { unHSPAttr :: Attribute }

data XMLMetaData #

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 #

type NSName = (Namespace, Text) #

type Attributes = [Attribute] #

type Children = [XML] #

pcdata :: Text -> XML #

Embeds a string as a CDATA XML value.

cdata :: Text -> XML #

Embeds a string as a CDATA XML value.

# The Attribute type

newtype Attribute #

Constructors

MkAttr (NSName, AttrValue) |

#### Instances

Instances details

Show Attribute # |
Instance details Defined in HSP.XML Methods showsPrec :: Int -> Attribute -> ShowS # show :: Attribute -> String # showList :: [Attribute] -> ShowS #
(Monad m, Functor m) => EmbedAsAttr (HSPT XML m) Attribute # |
Instance details Defined in HSP.Monad Methods asAttr :: Attribute -> GenAttributeList (HSPT XML m) #

data AttrValue #

Represents an attribue value.

Constructors

Value Bool Text |
NoValue |

#### Instances

Instances details

Show AttrValue # |
Instance details Defined in HSP.XML Methods showsPrec :: Int -> AttrValue -> ShowS # show :: AttrValue -> String # showList :: [AttrValue] -> ShowS #

attrVal :: Text -> AttrValue #

Create an attribue value from a string.

pAttrVal :: Text -> AttrValue #

Create an attribue value from a string.

# Functions

renderXML :: XML -> Text #

Pretty-prints XML values.

isElement :: XML -> Bool #

Test whether an XML value is an Element or CDATA

isCDATA :: XML -> Bool #

Test whether an XML value is an Element or CDATA

fromStringLit :: String -> Text #