-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast XML generation library -- -- Library for high-performance XML generation. @package xmlgen @version 0.6.2.2 -- | This module provides combinators for generating XML documents. -- -- As an example, suppose you want to generate the following XML -- document: -- --
--   <?xml version="1.0"?>
--   <people>
--     <person age="32">Stefan</person>
--     <person age="4">Judith</person>
--   </people>
--   
-- -- Then you could use the following Haskell code: -- --
--   let people = [("Stefan", "32"), ("Judith", "4")]
--   in doc defaultDocInfo $
--        xelem "people" $
--          xelems $ map ((name, age) -> xelem "person" (xattr "age" age <#> xtext name)) people
--   
module Text.XML.Generator -- | The type Xml t represent a piece of XML of type t, -- where t is usually one of Elem, Attr, or -- Doc. data Xml t -- | A piece of XML at the document level. data Doc -- | The DocInfo type contains all information of an XML document -- except the root element. data DocInfo DocInfo :: Bool -> Maybe String -> Xml Doc -> Xml Doc -> DocInfo -- | Value of the standalone attribute in the <?xml ... -- ?> header [docInfo_standalone] :: DocInfo -> Bool -- | Document type (N.B.: rendering does not escape this value) [docInfo_docType] :: DocInfo -> Maybe String -- | Content before the root element [docInfo_preMisc] :: DocInfo -> Xml Doc -- | Content after the root element [docInfo_postMisc] :: DocInfo -> Xml Doc -- | Constructs an XML document from a DocInfo value and the root -- element. doc :: DocInfo -> Xml Elem -> Xml Doc -- | The default document info (standalone, without document type, without -- content before/after the root element). defaultDocInfo :: DocInfo -- | Type for representing presence or absence of an XML namespace. data Namespace -- | Namespace prefix. type Prefix = Text -- | Namespace URI. type Uri = Text -- | A type for names type Name = Text -- | Constructs a qualified XML namespace. The given URI must not be the -- empty string. namespace :: Prefix -> Uri -> Namespace -- | A Namespace value denoting the absence of any XML namespace -- information. noNamespace :: Namespace -- | A Namespace value denoting the default namespace. -- -- defaultNamespace :: Namespace -- | A piece of XML at the element level. data Elem -- | Construct a simple-named element with the given children. xelem :: (AddChildren c) => Name -> c -> Xml Elem -- | Construct an element with the given children. xelemQ :: (AddChildren c) => Namespace -> Name -> c -> Xml Elem -- | Construct a simple-named element without any children. xelemEmpty :: Name -> Xml Elem -- | Construct an element without any children. xelemQEmpty :: Namespace -> Name -> Xml Elem -- | Class for adding children to an element. -- -- The various instances of this class allow the addition of different -- kinds of children. class AddChildren c -- | Merges a list of elements into a single piece of XML at the element -- level. xelems :: [Xml Elem] -> Xml Elem -- | No elements at all. noElems :: Xml Elem -- | The expression xelemWithText n t constructs an XML element -- with name n and text content t. xelemWithText :: Name -> TextContent -> Xml Elem -- | An associative operation. -- --
--   (a <> b) <> c = a <> (b <> c)
--   
-- -- If a is also a Monoid we further require -- --
--   (<>) = mappend
--   
(<>) :: Semigroup a => a -> a -> a infixr 6 <> -- | Shortcut for constructing pairs. Used in combination with xelem -- for separating child-attributes from child-elements. (<#>) :: a -> b -> (a, b) infixl 5 <#> -- | A piece of XML at the attribute level. data Attr -- | Construct a simple-named attribute by escaping its value. xattr :: Name -> TextContent -> Xml Attr -- | Construct an attribute by escaping its value. xattrQ :: Namespace -> Name -> TextContent -> Xml Attr -- | Construct an attribute without escaping its value. Note: -- attribute values are quoted with double quotes. xattrQRaw :: Namespace -> Name -> Builder -> Xml Attr -- | Merge a list of attributes into a single piece of XML at the attribute -- level. xattrs :: [Xml Attr] -> Xml Attr -- | The empty attribute list. noAttrs :: Xml Attr -- | Text content subject to escaping. type TextContent = Text -- | Constructs a text node by escaping the given argument. xtext :: TextContent -> Xml Elem -- | Constructs a text node without escaping the given argument. xtextRaw :: Builder -> Xml Elem -- | Constructs a reference to the named entity. Note: no escaping -- is performed on the name of the entity xentityRef :: Name -> Xml Elem -- | An empty, polymorphic piece of XML. xempty :: Renderable t => Xml t -- | Class providing methods for adding processing instructions and -- comments. class Renderable t => Misc t -- | Constructs a processing instruction with the given target and content. -- Note: Rendering does not perform escaping on the target and the -- content. xprocessingInstruction :: Misc t => String -> String -> Xml t -- | Constructs an XML comment. Note: No escaping is performed on -- the text of the comment. xcomment :: Misc t => String -> Xml t -- | Renders a given piece of XML. xrender :: (Renderable r, XmlOutput t) => Xml r -> t -- | Instances of the XmlOutput class may serve as target of -- serializing an XML document. class XmlOutput t -- | Creates the target type from a Builder. fromBuilder :: XmlOutput t => Builder -> t -- | Any type subject to rendering must implement this type class. class Renderable t -- | Document info for XHTML 1.0 frameset. xhtmlFramesetDocInfo :: DocInfo -- | Document info for XHTML 1.0 strict. xhtmlStrictDocInfo :: DocInfo -- | Document info for XHTML 1.0 transitional. xhtmlTransitionalDocInfo :: DocInfo -- | Constructs the root element of an XHTML document. xhtmlRootElem :: Text -> Xml Elem -> Xml Elem instance GHC.Classes.Eq Text.XML.Generator.Namespace instance GHC.Show.Show Text.XML.Generator.Namespace instance Text.XML.Generator.Misc Text.XML.Generator.Elem instance Text.XML.Generator.Misc Text.XML.Generator.Doc instance Text.XML.Generator.Renderable Text.XML.Generator.Elem instance Text.XML.Generator.Renderable Text.XML.Generator.Attr instance Text.XML.Generator.Renderable Text.XML.Generator.Doc instance Text.XML.Generator.XmlOutput Data.ByteString.Builder.Internal.Builder instance Text.XML.Generator.XmlOutput Data.ByteString.Internal.ByteString instance Text.XML.Generator.XmlOutput Data.ByteString.Lazy.Internal.ByteString instance Text.XML.Generator.AddChildren (Text.XML.Generator.Xml Text.XML.Generator.Attr) instance Text.XML.Generator.AddChildren (Text.XML.Generator.Xml Text.XML.Generator.Elem) instance Text.XML.Generator.AddChildren (Text.XML.Generator.Xml Text.XML.Generator.Attr, Text.XML.Generator.Xml Text.XML.Generator.Elem) instance Text.XML.Generator.AddChildren (Text.XML.Generator.Xml Text.XML.Generator.Attr, [Text.XML.Generator.Xml Text.XML.Generator.Elem]) instance Text.XML.Generator.AddChildren Text.XML.Generator.TextContent instance Text.XML.Generator.AddChildren GHC.Base.String instance Text.XML.Generator.AddChildren () instance Data.Semigroup.Semigroup (Text.XML.Generator.Xml Text.XML.Generator.Attr) instance GHC.Base.Monoid (Text.XML.Generator.Xml Text.XML.Generator.Attr) instance Data.Semigroup.Semigroup (Text.XML.Generator.Xml Text.XML.Generator.Elem) instance GHC.Base.Monoid (Text.XML.Generator.Xml Text.XML.Generator.Elem)