Sophie

Sophie

distrib > Mandriva > 2007.1 > i586 > by-pkgid > 09cecd41fd5510f1b4c6358078b3faaf > files > 172

haskell-HXT-7.1-2mdv2007.1.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Text.XML.HXT.Arrow.WriteDocument</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock.js" TYPE="text/javascript"
></SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>hxt-7.1: </TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Text.XML.HXT.Arrow.WriteDocument</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>portable</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>experimental</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>Uwe Schmidt (uwe\@fh-wedel.de)</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
><P
>Version    : $Id: WriteDocument.hs,v 1.8 2006<EM
>11</EM
>09 20:27:42 hxml Exp $
</P
><P
>Compound arrow for writing XML documents
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3AwriteDocument"
>writeDocument</A
> :: <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AAttributes"
>Attributes</A
> -&gt; String -&gt; <A HREF="Text-XML-HXT-Arrow-XmlIOStateArrow.html#t%3AIOStateArrow"
>IOStateArrow</A
> s <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree"
>XmlTree</A
> <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree"
>XmlTree</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AwriteDocumentToString"
>writeDocumentToString</A
> :: <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AAttributes"
>Attributes</A
> -&gt; <A HREF="Text-XML-HXT-Arrow-XmlIOStateArrow.html#t%3AIOStateArrow"
>IOStateArrow</A
> s <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree"
>XmlTree</A
> String</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AwriteDocument"
></A
><B
>writeDocument</B
> :: <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AAttributes"
>Attributes</A
> -&gt; String -&gt; <A HREF="Text-XML-HXT-Arrow-XmlIOStateArrow.html#t%3AIOStateArrow"
>IOStateArrow</A
> s <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree"
>XmlTree</A
> <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree"
>XmlTree</A
></TD
></TR
><TR
><TD CLASS="doc"
><P
>the main filter for writing documents
</P
><P
>this filter can be configured by an option list like <TT
><A HREF="Text-XML-HXT-Arrow-ReadDocument.html#v%3AreadDocument"
>readDocument</A
></TT
>
</P
><P
>usage: <TT
> writeDocument optionList destination </TT
>
</P
><P
>if <TT
> destination </TT
> is the empty string or &quot;-&quot;, stdout is used as output device
</P
><P
>available options are
</P
><UL
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_indent"
>a_indent</A
></TT
> : indent document for readability, (default: no indentation)
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_remove_whitespace"
>a_remove_whitespace</A
></TT
> : remove all redundant whitespace for shorten text (default: no removal)
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_output_encoding"
>a_output_encoding</A
></TT
> : encoding of document, default is <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_encoding"
>a_encoding</A
></TT
> or <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Autf8"
>utf8</A
></TT
>
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_output_xml"
>a_output_xml</A
></TT
> : (default) issue XML: quote special XML chars &gt;,&lt;,&quot;,',&amp; where neccessary
                   add XML processing instruction
                   and encode document with respect to <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_output_encoding"
>a_output_encoding</A
></TT
>,
                   if explicitly switched of, the plain text is issued, this is useful
                   for non XML output, e.g. generated Haskell code, LaTex, Java, ...
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_output_html"
>a_output_html</A
></TT
> : issue XHTML: quote alle XML chars, use HTML entity refs or char refs for none ASCII chars
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_no_xml_pi"
>a_no_xml_pi</A
></TT
> : suppress generation of &lt;?xml ... ?&gt; processing instruction
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_show_tree"
>a_show_tree</A
></TT
> : show tree representation of document (for debugging)
</LI
><LI
> <TT
><A HREF="Text-XML-HXT-DOM-XmlKeywords.html#v%3Aa_show_haskell"
>a_show_haskell</A
></TT
> : show Haskell representaion of document (for debugging)
</LI
></UL
><P
>a minimal main program for copying a document
 has the following structure:
</P
><PRE
> module Main
 where
 
 import Text.XML.HXT.Arrow
 
 main        :: IO ()
 main
     = do
       runX ( readDocument  [] &quot;hello.xml&quot;
              &gt;&gt;&gt;
              writeDocument [] &quot;bye.xml&quot;
            )
       return ()
</PRE
><P
>an example for copying a document to standard output with tracing and evaluation of
error code is:
</P
><PRE
> module Main
 where
 
 import Text.XML.HXT.Arrow
 import System.Exit
 
 main        :: IO ()
 main
     = do
       [rc] &lt;- runX ( readDocument  [ (a_trace, &quot;1&quot;)
                                    ] &quot;hello.xml&quot;
                      &gt;&gt;&gt;
                      writeDocument [ (a_output_encoding, isoLatin1)
                                    ] &quot;-&quot;        -- output to stdout
                      &gt;&gt;&gt;
                      getErrStatus
                    )
       exitWith ( if rc &gt;= c_err
                  then ExitFailure 1
                  else ExitSuccess
                )
</PRE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AwriteDocumentToString"
></A
><B
>writeDocumentToString</B
> :: <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AAttributes"
>Attributes</A
> -&gt; <A HREF="Text-XML-HXT-Arrow-XmlIOStateArrow.html#t%3AIOStateArrow"
>IOStateArrow</A
> s <A HREF="Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree"
>XmlTree</A
> String</TD
></TR
><TR
><TD CLASS="doc"
>Convert a document into a string. Formatiing is done the same way
 and with the same options as in <TT
><A HREF="Text-XML-HXT-Arrow-WriteDocument.html#v%3AwriteDocument"
>writeDocument</A
></TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 0.8</TD
></TR
></TABLE
></BODY
></HTML
>