\HeaderA{serializeEnv}{A Function To Serialize Environment}{serializeEnv}
\aliasA{serializeDataPkgEnvs}{serializeEnv}{serializeDataPkgEnvs}
\keyword{utilities}{serializeEnv}
\begin{Description}\relax
This function will serialize an environment in R to an XML format
stored in a compressed file.
\end{Description}
\begin{Usage}
\begin{verbatim}
serializeEnv(env, fname)
serializeDataPkgEnvs(pkgDir)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{env}] The name of the environment to serialize.
\item[\code{fname}] The name of the output file.
\item[\code{pkgDir}] The directory where a data package is
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The environment is converted into an XML format and then outputted to
a gzipped file (using \code{\LinkA{gzfile}{gzfile}}).  The values in the
environment are serialized (using \code{\LinkA{serialize}{serialize}}) in ASCII
format although the keys are stored in plain text.

The format of the XML is very simple, with the primary block being
\code{values}, which contain blocks of \code{entries}, and each entry
having a \code{key} and a \code{value}.  For instance, if we had an
environment with one value in it, the character \code{c} with a key
of \code{a} (e.g. \code{assign("a", "c", env=foo)}), this is what the
output would look like.

\begin{alltt}
     <?xml version="1.0"?>
     <values xmlns:bt="http://www.bioconductor.org/RGDBM">
        <entry>
           <key>
             a
           </key>
           <value>
              A\bsl{}n2\bsl{}n131072\bsl{}n66560\bsl{}n1040\bsl{}n1\bsl{}n1033\bsl{}n1\bsl{}nc\bsl{}n
           </value>
        </entry>    
     </values>
\end{alltt}
\end{Details}
\begin{Author}\relax
Jeff Gentry
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{gzfile}{gzfile}},
\code{\LinkA{serialize}{serialize}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   z <- new.env()
   assign("a", 1, env=z)
   assign("b", 2, env=z)
   assign("c", 3, env=z)
   serializeEnv(z, tempfile())
\end{ExampleCode}
\end{Examples}


