HaXml-1.24: Utilities for manipulating XML documents

Safe HaskellSafe-Inferred

Text.XML.HaXml.DtdToHaskell.TypeDef

Contents

Description

Defines an internal representation of Haskell data/newtype definitions that correspond to the XML DTD types, and provides pretty-printers to convert these types into the Doc type of Text.PrettyPrint.HughesPJ.

Synopsis

Internal representation of types

data TypeDef Source

Constructors

DataDef Bool Name AttrFields Constructors

Bool for main/aux.

EnumDef Name [Name] 

Instances

data StructType Source

Constructors

Maybe StructType 
Defaultable StructType String

String holds default value.

List StructType 
List1 StructType

Non-empty lists.

Tuple [StructType] 
OneOf [StructType] 
Any

XML's contentspec allows ANY

StringMixed

mixed (#PCDATA | ... )*

String

string only (#PCDATA)

Defined Name 

Pretty-print a TypeDef

ppHName :: Name -> DocSource

Pretty print Haskell name.

ppXName :: Name -> DocSource

Pretty print XML name.

ppAName :: Name -> DocSource

Pretty print Haskell attributes name.

Name mangling

data Name Source

Need to keep both the XML and Haskell versions of a name.

Constructors

Name 

Fields

xName :: String

original XML name

hName :: String

mangled Haskell name

Instances

name :: String -> NameSource

Make a type name valid in both XML and Haskell.

name_ :: String -> NameSource

Append an underscore to the Haskell version of the name.

name_a :: String -> String -> NameSource

Prefix an attribute enumeration type name with its containing element name.

name_ac :: String -> String -> String -> NameSource

Prefix an attribute enumeration constructor with its element-tag name, and its enumeration type name.

name_f :: String -> String -> NameSource

Prefix a field name with its enclosing element name.

mangle :: String -> StringSource

Convert an XML name to a Haskell conid.

manglef :: String -> StringSource

Convert an XML name to a Haskell varid.