HaXml-1.25.14: Utilities for manipulating XML documents

Safe Haskell | Safe-Inferred
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 Module = Module {
  - module_name :: XName
  - module_xsd_ns :: Maybe XName
  - module_re_exports :: [Decl]
  - module_import_only :: [Decl]
  - module_decls :: [Decl]
  }
- 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 Modifier
  - = Single
  - | Optional
  - | Range Occurs
- data Attribute = Attribute {
  - attr_name :: XName
  - attr_type :: XName
  - attr_required :: Bool
  - attr_comment :: Comment
  }
- type Comment = Maybe String
- data Restrict
  - = RangeR Occurs Comment
  - | Pattern String Comment
  - | Enumeration [(String, Comment)]
  - | StrLength Occurs Comment
- 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
- mkModule :: String -> Schema -> [Decl] -> Module

# Documentation

data Module Source #

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]

data Element Source #

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

Instances details

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

data Modifier Source #

Constructors

Single |
Optional |
Range Occurs |

#### Instances

Instances details

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

data Attribute Source #

Constructors

Attribute |

Fields

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

#### Instances

Instances details

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

type Comment = Maybe String Source #

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

data Restrict Source #

Restrictions on simpleType

Constructors

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

#### Instances

Instances details

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

data Decl Source #

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

Instances details

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

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

A helper for building the formal Module structure.