HaXml-1.25.14: Utilities for manipulating XML documents

Safe Haskell | Safe-Inferred
Language | Haskell98

Text.XML.HaXml.Schema.NameConversion

Description

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

Synopsis

- newtype XName = XName QName
- wordsBy :: (a -> Bool) -> [a] -> [[a]]
- newtype HName = HName String
- data NameConverter = NameConverter {
  - modid :: XName -> HName
  - conid :: XName -> HName
  - varid :: XName -> HName
  - unqconid :: XName -> HName
  - unqvarid :: XName -> HName
  - fwdconid :: XName -> HName
  - fieldid :: XName -> XName -> HName
  }
- simpleNameConverter :: NameConverter
- avoidKeywords :: String -> String
- escape :: Char -> Char
- fpml :: String -> String
- basename :: String -> String -> String
- fpmlNameConverter :: NameConverter

# Documentation

newtype XName Source #

An XName just holds the original XSD qualified name. It does not ensure that the string conforms to any rules of the various Haskell namespaces. Use a NameConverter to define how you would like names to be mangled.

Constructors

XName QName |

#### Instances

Instances details

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

wordsBy :: (a -> Bool) -> [a] -> [[a]] Source #

Chop a list into segments, at separators identified by the predicate. The separator items are discarded.

newtype HName Source #

An HName is a resolved version of an XName. It should conform to the various namespace rules, and may already include a module qualifier if appropriate.

Constructors

HName String |

#### Instances

Instances details

Show HName Source # |
Instance details Defined in Text.XML.HaXml.Schema.NameConversion Methods showsPrec :: Int -> HName -> ShowS Source # show :: HName -> String Source # showList :: [HName] -> ShowS Source #

data NameConverter Source #

A NameConverter is a collection of functions that convert an XName into an HName, for various Haskell namespaces. You can define your own arbitrary resolver, but should ensure that you abide by the Haskell rules for conid, varid, etc.

Constructors

NameConverter |

Fields

- modid :: XName -> HName
- conid :: XName -> HName
- varid :: XName -> HName
- unqconid :: XName -> HName
- unqvarid :: XName -> HName
- fwdconid :: XName -> HName

  for forward type decls

- fieldid :: XName -> XName -> HName

simpleNameConverter :: NameConverter Source #

A simple default set of rules for resolving XNames into HNames.

avoidKeywords :: String -> String Source #

Ensure that a string does not match a Haskell keyword.

escape :: Char -> Char Source #

Character escapes to create a valid Haskell identifier.

fpml :: String -> String Source #

A specialised module-name converter for FpML module names with multiple dashes, including version numbers, e.g. fpml-dividend-swaps-4-7.xsd becomes FpML.V47.Swaps.Dividend but fpml-posttrade-execution-4-7.xsd becomes FpML.V47.PostTrade.Execution

basename :: String -> String -> String Source #

Remove any prefix directory names, and given suffix extension.

fpmlNameConverter :: NameConverter Source #