| |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
Description | |||||||||||||||||||||||||||||||||||||||||
The class Haskell2Xml is a replacement for Read and Show: it provides textual conversions (to and from an XML representation) for your Haskell data values. Use the tool DrIFT to derive this class for your own datatypes, then include this module where you want to use the facilities. The methods toContents and fromContents convert a value to and from a generic internal representation of an XML document without a DTD. The functions toXml and fromXml convert a value to and from a generic internal representation of an XML document including a DTD. The functions readXml and showXml convert to and from Strings. The functions fReadXml and fWriteXml do the conversion to and from the given filenames. The functions hGetXml and hPutXml do the conversion to and from the given file handles. (See the type signatures.) | |||||||||||||||||||||||||||||||||||||||||
Synopsis | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
Re-export the entire set of XML type definitions | |||||||||||||||||||||||||||||||||||||||||
module Text.XML.HaXml.Types | |||||||||||||||||||||||||||||||||||||||||
The class Haskell2Xml | |||||||||||||||||||||||||||||||||||||||||
class Haskell2Xml a where | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
Conversion functions | |||||||||||||||||||||||||||||||||||||||||
toXml :: Haskell2Xml a => a -> Document | |||||||||||||||||||||||||||||||||||||||||
Convert any Haskell value to an XML document, including both DTD and content. | |||||||||||||||||||||||||||||||||||||||||
toDTD :: HType -> DocTypeDecl | |||||||||||||||||||||||||||||||||||||||||
toDTD converts a concrete representation of the Haskell type of a value (obtained by the method toHType) into a real DocTypeDecl. It ensures that PERefs are defined before they are used, and that no element or attribute-list is declared more than once. | |||||||||||||||||||||||||||||||||||||||||
fromXml :: Haskell2Xml a => Document -> a | |||||||||||||||||||||||||||||||||||||||||
Read a Haskell value from an XML document, ignoring the DTD and using the Haskell result type to determine how to parse it. | |||||||||||||||||||||||||||||||||||||||||
readXml :: Haskell2Xml a => String -> Maybe a | |||||||||||||||||||||||||||||||||||||||||
Convert an XML document encoded as a String, into a Haskell value. | |||||||||||||||||||||||||||||||||||||||||
showXml :: Haskell2Xml a => a -> String | |||||||||||||||||||||||||||||||||||||||||
Convert a Haskell value to an XML document, encoded as a String. | |||||||||||||||||||||||||||||||||||||||||
IO conversion functions | |||||||||||||||||||||||||||||||||||||||||
fReadXml :: Haskell2Xml a => FilePath -> IO a | |||||||||||||||||||||||||||||||||||||||||
Read a Haskell value from an XML document stored in a file. | |||||||||||||||||||||||||||||||||||||||||
fWriteXml :: Haskell2Xml a => FilePath -> a -> IO () | |||||||||||||||||||||||||||||||||||||||||
Write a Haskell value to the given file as an XML document. | |||||||||||||||||||||||||||||||||||||||||
hGetXml :: Haskell2Xml a => Handle -> IO a | |||||||||||||||||||||||||||||||||||||||||
Read a Haskell value from an XML document transmitted through the given Handle. | |||||||||||||||||||||||||||||||||||||||||
hPutXml :: Haskell2Xml a => Handle -> a -> IO () | |||||||||||||||||||||||||||||||||||||||||
Write a Haskell value to the given Handle as an XML document. | |||||||||||||||||||||||||||||||||||||||||
Auxiliary types | |||||||||||||||||||||||||||||||||||||||||
data HType | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
data Constr | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
isPrefixOf | |||||||||||||||||||||||||||||||||||||||||
Produced by Haddock version 0.8 |