HaXml-1.25.5: Utilities for manipulating XML documents

Safe Haskell | Safe
Language | Haskell98

Text.XML.HaXml.Schema.HaskellTypeModel

Description

A type model for Haskell datatypes that bears a reasonable correspondence to the XSD type model.

Synopsis

- data Restrict
  - = RangeR Occurs Comment
  - | Pattern String Comment
  - | Enumeration [(String, Comment)]
  - | StrLength Occurs Comment
- data Modifier
  - = Single
  - | Optional
  - | Range Occurs
- data Attribute = Attribute {
  - attr_name :: XName
  - attr_type :: XName
  - attr_required :: Bool
  - attr_comment :: Comment
  }
- data Element
  - = Element {
    - elem_name :: XName
    - elem_type :: XName
    - elem_modifier :: Modifier
    - elem_byRef :: Bool
    - elem_locals :: [Decl]
    - elem_substs :: Maybe [XName]
    - elem_comment :: Comment
    }
  - | OneOf {
    - elem_oneOf :: [[Element]]
    - elem_modifier :: Modifier
    - elem_comment :: Comment
    }
  - | AnyElem {
    - elem_modifier :: Modifier
    - elem_comment :: Comment
    }
  - | Text
- data Decl
  - = NamedSimpleType XName XName Comment
  - | RestrictSimpleType XName XName [Restrict] Comment
  - | ExtendSimpleType XName XName [Attribute] Comment
  - | UnionSimpleTypes XName [XName] Comment
  - | EnumSimpleType XName [(XName, Comment)] Comment
  - | ElementsAttrs XName [Element] [Attribute] Comment
  - | ElementsAttrsAbstract XName [(XName, Maybe XName)] Comment
  - | ElementOfType Element
  - | ElementAbstractOfType XName XName [(XName, Maybe XName)] Comment
  - | Choice XName [Element] Comment
  - | Group XName [Element] Comment
  - | RestrictComplexType XName XName Comment
  - | ExtendComplexType XName XName [Element] [Attribute] [Element] [Attribute] (Maybe XName) Bool [XName] Comment
  - | ExtendComplexTypeAbstract XName XName [(XName, Maybe XName)] (Maybe XName) [XName] Comment
  - | XSDInclude XName Comment
  - | XSDImport XName (Maybe XName) Comment
  - | XSDComment Comment
- data Module = Module {
  - module_name :: XName
  - module_xsd_ns :: Maybe XName
  - module_re_exports :: [Decl]
  - module_import_only :: [Decl]
  - module_decls :: [Decl]
  }
- type Comment = Maybe String
- mkModule :: String -> Schema -> [Decl] -> Module

# Documentation

data Restrict #

Restrictions on simpleType

Constructors

RangeR Occurs Comment |
Pattern String Comment |
Enumeration [(String, Comment)] |
StrLength Occurs Comment |

Instances

Eq Restrict # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods (==) :: Restrict -> Restrict -> Bool # (/=) :: Restrict -> Restrict -> Bool #
Show Restrict # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods showsPrec :: Int -> Restrict -> ShowS # show :: Restrict -> String # showList :: [Restrict] -> ShowS #

data Modifier #

Constructors

Single |
Optional |
Range Occurs |

Instances

Eq Modifier # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods (==) :: Modifier -> Modifier -> Bool # (/=) :: Modifier -> Modifier -> Bool #
Show Modifier # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods showsPrec :: Int -> Modifier -> ShowS # show :: Modifier -> String # showList :: [Modifier] -> ShowS #

data Attribute #

Constructors

Attribute |

Fields

- attr_name :: XName
- attr_type :: XName
- attr_required :: Bool
- attr_comment :: Comment

Instances

Eq Attribute # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods (==) :: Attribute -> Attribute -> Bool # (/=) :: Attribute -> Attribute -> Bool #
Show Attribute # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods showsPrec :: Int -> Attribute -> ShowS # show :: Attribute -> String # showList :: [Attribute] -> ShowS #

data Element #

Constructors

Element |

Fields

- elem_name :: XName
- elem_type :: XName
- elem_modifier :: Modifier
- elem_byRef :: Bool
- elem_locals :: [Decl]
- elem_substs :: Maybe [XName]
- elem_comment :: Comment

OneOf |

Fields

- elem_oneOf :: [[Element]]
- elem_modifier :: Modifier
- elem_comment :: Comment

AnyElem |

Fields

- elem_modifier :: Modifier
- elem_comment :: Comment

Text |

Instances

Eq Element # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods (==) :: Element -> Element -> Bool # (/=) :: Element -> Element -> Bool #
Show Element # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods showsPrec :: Int -> Element -> ShowS # show :: Element -> String # showList :: [Element] -> ShowS #

data Decl #

There are essentially simple types, and complex types, each of which can be either restricted or extended. There are four kinds of complex type: choices, sequences, named groups, or a simple element with content.

Constructors

NamedSimpleType XName XName Comment |
RestrictSimpleType XName XName [Restrict] Comment |
ExtendSimpleType XName XName [Attribute] Comment |
UnionSimpleTypes XName [XName] Comment |
EnumSimpleType XName [(XName, Comment)] Comment |
ElementsAttrs XName [Element] [Attribute] Comment |
ElementsAttrsAbstract XName [(XName, Maybe XName)] Comment |
ElementOfType Element |
ElementAbstractOfType XName XName [(XName, Maybe XName)] Comment |
Choice XName [Element] Comment |
Group XName [Element] Comment |
RestrictComplexType XName XName Comment |
ExtendComplexType XName XName [Element] [Attribute] [Element] [Attribute] (Maybe XName) Bool [XName] Comment |
ExtendComplexTypeAbstract XName XName [(XName, Maybe XName)] (Maybe XName) [XName] Comment |
XSDInclude XName Comment |
XSDImport XName (Maybe XName) Comment |
XSDComment Comment |

Instances

Eq Decl # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods (==) :: Decl -> Decl -> Bool # (/=) :: Decl -> Decl -> Bool #
Show Decl # |
Instance details Defined in Text.XML.HaXml.Schema.HaskellTypeModel Methods showsPrec :: Int -> Decl -> ShowS # show :: Decl -> String # showList :: [Decl] -> ShowS #

data Module #

The whole Haskell module.

Constructors

Module |

Fields

- module_name :: XName
- module_xsd_ns :: Maybe XName
- module_re_exports :: [Decl]
- module_import_only :: [Decl]
- module_decls :: [Decl]

type Comment = Maybe String #

Comments can be attached to most things, but not all of them will exist.

mkModule :: String -> Schema -> [Decl] -> Module #

A helper for building the formal Module structure.