-- 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:
--   
--   <pre>
--   &lt;?xml version="1.0"?&gt;
--   &lt;people&gt;
--     &lt;person age="32"&gt;Stefan&lt;/person&gt;
--     &lt;person age="4"&gt;Judith&lt;/person&gt;
--   &lt;/people&gt;
--   </pre>
--   
--   Then you could use the following Haskell code:
--   
--   <pre>
--   let people = [("Stefan", "32"), ("Judith", "4")]
--   in <a>doc</a> <a>defaultDocInfo</a> $
--        <a>xelem</a> "people" $
--          <a>xelems</a> $ map ((name, age) -&gt; <a>xelem</a> "person" (<a>xattr</a> "age" age <a>&lt;#&gt;</a> <a>xtext</a> name)) people
--   </pre>
module Text.XML.Generator

-- | The type <tt>Xml t</tt> represent a piece of XML of type <tt>t</tt>,
--   where <tt>t</tt> is usually one of <a>Elem</a>, <a>Attr</a>, or
--   <a>Doc</a>.
data Xml t

-- | A piece of XML at the document level.
data Doc

-- | The <a>DocInfo</a> 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 <tt>standalone</tt> attribute in the <tt>&lt;?xml ...
--   ?&gt;</tt> 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 <a>DocInfo</a> 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 <a>Namespace</a> value denoting the absence of any XML namespace
--   information.
noNamespace :: Namespace

-- | A <a>Namespace</a> value denoting the default namespace.
--   
--   <ul>
--   <li>For elements, this is the namespace currently mapped to the empty
--   prefix.</li>
--   <li>For attributes, the default namespace does not carry any namespace
--   information.</li>
--   </ul>
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 <tt>xelemWithText n t</tt> constructs an XML element
--   with name <tt>n</tt> and text content <tt>t</tt>.
xelemWithText :: Name -> TextContent -> Xml Elem

-- | An associative operation.
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] &lt;&gt; [4,5,6]
--   [1,2,3,4,5,6]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Just [1, 2, 3] &lt;&gt; Just [4, 5, 6]
--   Just [1,2,3,4,5,6]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; putStr "Hello, " &lt;&gt; putStrLn "World!"
--   Hello, World!
--   </pre>
(<>) :: Semigroup a => a -> a -> a
infixr 6 <>

-- | Shortcut for constructing pairs. Used in combination with <a>xelem</a>
--   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. <i>Note:</i>
--   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 <i>without</i> escaping the given argument.
xtextRaw :: Builder -> Xml Elem

-- | Constructs a reference to the named entity. <i>Note:</i> 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.
--   <i>Note:</i> Rendering does not perform escaping on the target and the
--   content.
xprocessingInstruction :: Misc t => String -> String -> Xml t

-- | Constructs an XML comment. <i>Note:</i> 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 <tt>XmlOutput</tt> class may serve as target of
--   serializing an XML document.
class XmlOutput t

-- | Creates the target type from a <a>Builder</a>.
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 Text.XML.Generator.AddChildren GHC.Internal.Base.String
instance Text.XML.Generator.AddChildren Text.XML.Generator.TextContent
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 ()
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 GHC.Classes.Eq Text.XML.Generator.Namespace
instance Text.XML.Generator.Misc Text.XML.Generator.Doc
instance Text.XML.Generator.Misc Text.XML.Generator.Elem
instance GHC.Internal.Base.Monoid (Text.XML.Generator.Xml Text.XML.Generator.Attr)
instance GHC.Internal.Base.Monoid (Text.XML.Generator.Xml 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.Renderable Text.XML.Generator.Elem
instance GHC.Internal.Base.Semigroup (Text.XML.Generator.Xml Text.XML.Generator.Attr)
instance GHC.Internal.Base.Semigroup (Text.XML.Generator.Xml Text.XML.Generator.Elem)
instance GHC.Internal.Show.Show Text.XML.Generator.Namespace
instance Text.XML.Generator.XmlOutput Data.ByteString.Builder.Internal.Builder
instance Text.XML.Generator.XmlOutput Data.ByteString.Lazy.Internal.ByteString
instance Text.XML.Generator.XmlOutput Data.ByteString.Internal.Type.ByteString
