HaXml-1.25.4: Utilities for manipulating XML documents

Safe Haskell | Safe
Language | Haskell98

Text.XML.HaXml.Schema.PrimitiveTypes

Contents

- Type class for parsing simpleTypes
- Primitive XSD datatypes
- Derived, yet builtin, datatypes

Synopsis

- class SimpleType a where
  - acceptingParser :: TextParser a
  - simpleTypeText :: a -> String
- module Text.Parse
- newtype XsdString = XsdString String
- type Boolean = Bool
- data Base64Binary = Base64Binary String
- data HexBinary = HexBinary String
- data Float :: *
- data Decimal = Decimal Double
- data Double :: *
- data AnyURI = AnyURI String
- data QName
  - = N Name
  - | QN Namespace Name
- data NOTATION = NOTATION String
- data Duration = Duration Bool Int Int Int Int Int Float
- data DateTime = DateTime String
- data Time = Time String
- data Date = Date String
- data GYearMonth = GYearMonth String
- data GYear = GYear String
- data GMonthDay = GMonthDay String
- data GDay = GDay String
- data GMonth = GMonth String
- newtype NormalizedString = Normalized String
- newtype Token = Token String
- newtype Language = Language String
- newtype Name = Name String
- newtype NCName = NCName String
- newtype ID = ID String
- newtype IDREF = IDREF String
- newtype IDREFS = IDREFS String
- newtype ENTITY = ENTITY String
- newtype ENTITIES = ENTITIES String
- newtype NMTOKEN = NMTOKEN String
- newtype NMTOKENS = NMTOKENS String
- data Integer :: *
- newtype NonPositiveInteger = NonPos Integer
- newtype NegativeInteger = Negative Integer
- newtype Long = Long Int64
- data Int :: *
- newtype Short = Short Int16
- newtype Byte = Byte Int8
- newtype NonNegativeInteger = NonNeg Integer
- newtype UnsignedLong = ULong Word64
- newtype UnsignedInt = UInt Word32
- newtype UnsignedShort = UShort Word16
- newtype UnsignedByte = UByte Word8
- newtype PositiveInteger = Positive Integer

# Type class for parsing simpleTypes

class SimpleType a where

Ultimately, an XML parser will find some plain text as the content of a simpleType, which will need to be parsed. We use a TextParser, because values of simpleTypes can also be given elsewhere, e.g. as attribute values in an XSD definition, e.g. to restrict the permissible values of the simpleType. Such restrictions are therefore implemented as layered parsers.

Methods

acceptingParser :: TextParser a

simpleTypeText :: a -> String

Instances

SimpleType Bool |
SimpleType Double |
SimpleType Float |
SimpleType Int |
SimpleType Integer |
SimpleType PositiveInteger |
SimpleType UnsignedByte |
SimpleType UnsignedShort |
SimpleType UnsignedInt |
SimpleType UnsignedLong |
SimpleType NonNegativeInteger |
SimpleType Byte |
SimpleType Short |
SimpleType Long |
SimpleType NegativeInteger |
SimpleType NonPositiveInteger |
SimpleType NMTOKENS |
SimpleType NMTOKEN |
SimpleType ENTITIES |
SimpleType ENTITY |
SimpleType IDREFS |
SimpleType IDREF |
SimpleType ID |
SimpleType NCName |
SimpleType Name |
SimpleType Language |
SimpleType Token |
SimpleType NormalizedString |
SimpleType GMonth |
SimpleType GDay |
SimpleType GMonthDay |
SimpleType GYear |
SimpleType GYearMonth |
SimpleType Date |
SimpleType Time |
SimpleType DateTime |
SimpleType Duration |
SimpleType Decimal |
SimpleType NOTATION |
SimpleType AnyURI |
SimpleType HexBinary |
SimpleType Base64Binary |
SimpleType XsdString |

module Text.Parse

# Primitive XSD datatypes

newtype XsdString

Constructors

XsdString String |

Instances

Eq XsdString |
Show XsdString |
SimpleType XsdString |
SchemaType XsdString |

type Boolean = Bool

data Base64Binary

Constructors

Base64Binary String |

Instances

Eq Base64Binary |
Show Base64Binary |
SimpleType Base64Binary |
SchemaType Base64Binary |

data HexBinary

Constructors

HexBinary String |

Instances

Eq HexBinary |
Show HexBinary |
SimpleType HexBinary |
SchemaType HexBinary |

data Float :: *

Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.

Instances

Eq Float |
Floating Float |
Ord Float |
Read Float |
RealFloat Float |
Generic Float |
Parse Float |
SimpleType Float |
HTypeable Float |
SchemaType Float |
type Rep Float = D1 D_Float (C1 C_Float (S1 NoSelector (Rec0 Float))) |

data Decimal

Constructors

Decimal Double |

Instances

Eq Decimal |
Show Decimal |
SimpleType Decimal |
SchemaType Decimal |

data Double :: *

Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.

Instances

Eq Double |
Floating Double |
Ord Double |
Read Double |
RealFloat Double |
Generic Double |
Parse Double |
SimpleType Double |
HTypeable Double |
SchemaType Double |
type Rep Double = D1 D_Double (C1 C_Double (S1 NoSelector (Rec0 Double))) |

data AnyURI

Constructors

AnyURI String |

Instances

Eq AnyURI |
Show AnyURI |
SimpleType AnyURI |
SchemaType AnyURI |

data QName

A QName is a (possibly) qualified name, in the sense of XML namespaces.

Constructors

N Name |
QN Namespace Name |

Instances

Eq QName |
Ord QName |
Show QName |

data NOTATION

Constructors

NOTATION String |

Instances

Eq NOTATION |
Show NOTATION |
SimpleType NOTATION |
SchemaType NOTATION |

data Duration

Constructors

Duration Bool Int Int Int Int Int Float |

Instances

Eq Duration |
Show Duration |
SimpleType Duration |
SchemaType Duration |

data DateTime

Constructors

DateTime String |

Instances

Eq DateTime |
Show DateTime |
SimpleType DateTime |
SchemaType DateTime |

data Time

Constructors

Time String |

Instances

Eq Time |
Show Time |
SimpleType Time |
SchemaType Time |

data Date

Constructors

Date String |

Instances

Eq Date |
Show Date |
SimpleType Date |
SchemaType Date |

data GYearMonth

Constructors

GYearMonth String |

Instances

Eq GYearMonth |
Show GYearMonth |
SimpleType GYearMonth |
SchemaType GYearMonth |

data GYear

Constructors

GYear String |

Instances

Eq GYear |
Show GYear |
SimpleType GYear |
SchemaType GYear |

data GMonthDay

Constructors

GMonthDay String |

Instances

Eq GMonthDay |
Show GMonthDay |
SimpleType GMonthDay |
SchemaType GMonthDay |

data GDay

Constructors

GDay String |

Instances

Eq GDay |
Show GDay |
SimpleType GDay |
SchemaType GDay |

data GMonth

Constructors

GMonth String |

Instances

Eq GMonth |
Show GMonth |
SimpleType GMonth |
SchemaType GMonth |

# Derived, yet builtin, datatypes

newtype NormalizedString

Constructors

Normalized String |

Instances

Eq NormalizedString |
Show NormalizedString |
SimpleType NormalizedString |
SchemaType NormalizedString |

newtype Token

Constructors

Token String |

Instances

Eq Token |
Show Token |
SimpleType Token |
SchemaType Token |

newtype Language

Constructors

Language String |

Instances

Eq Language |
Show Language |
SimpleType Language |
SchemaType Language |

newtype Name

Constructors

Name String |

Instances

Eq Name |
Show Name |
SimpleType Name |
SchemaType Name |

newtype NCName

Constructors

NCName String |

Instances

Eq NCName |
Show NCName |
SimpleType NCName |
SchemaType NCName |

newtype ID

Constructors

ID String |

Instances

Eq ID |
Show ID |
SimpleType ID |
SchemaType ID |

newtype IDREF

Constructors

IDREF String |

Instances

Eq IDREF |
Show IDREF |
SimpleType IDREF |
SchemaType IDREF |

newtype IDREFS

Constructors

IDREFS String |

Instances

Eq IDREFS |
Show IDREFS |
SimpleType IDREFS |
SchemaType IDREFS |

newtype ENTITY

Constructors

ENTITY String |

Instances

Eq ENTITY |
Show ENTITY |
SimpleType ENTITY |
SchemaType ENTITY |

newtype ENTITIES

Constructors

ENTITIES String |

Instances

Eq ENTITIES |
Show ENTITIES |
SimpleType ENTITIES |
SchemaType ENTITIES |

newtype NMTOKEN

Constructors

NMTOKEN String |

Instances

Eq NMTOKEN |
Show NMTOKEN |
SimpleType NMTOKEN |
SchemaType NMTOKEN |

newtype NMTOKENS

Constructors

NMTOKENS String |

Instances

Eq NMTOKENS |
Show NMTOKENS |
SimpleType NMTOKENS |
SchemaType NMTOKENS |

data Integer :: *

Invariant: `Jn#` and `Jp#` are used iff value doesn't fit in `S#`

Useful properties resulting from the invariants:

-     abs (S# _) <= abs (Jp# _)

-     abs (S# _) <  abs (Jn# _)

Instances

Enum Integer |
Eq Integer |
Integral Integer |
Num Integer |
Ord Integer |
Read Integer |
Real Integer |
Show Integer |
Ix Integer |
Parse Integer |
SimpleType Integer |
HTypeable Integer |
SchemaType Integer |

newtype NonPositiveInteger

Constructors

NonPos Integer |

Instances

Eq NonPositiveInteger |
Show NonPositiveInteger |
SimpleType NonPositiveInteger |
SchemaType NonPositiveInteger |

newtype NegativeInteger

Constructors

Negative Integer |

Instances

Eq NegativeInteger |
Show NegativeInteger |
SimpleType NegativeInteger |
SchemaType NegativeInteger |

newtype Long

Constructors

Long Int64 |

Instances

Eq Long |
Show Long |
SimpleType Long |
SchemaType Long |

data Int :: *

A fixed-precision integer type with at least the range `[-2^29 .. 2^29-1]`. The exact range for a given implementation can be determined by using `minBound` and `maxBound` from the `Bounded` class.

Instances

Bounded Int |
Enum Int |
Eq Int |
Integral Int |
Num Int |
Ord Int |
Read Int |
Real Int |
Show Int |
Ix Int |
Generic Int |
Parse Int |
SimpleType Int |
HTypeable Int |
SchemaType Int |
type Rep Int = D1 D_Int (C1 C_Int (S1 NoSelector (Rec0 Int))) |

newtype Short

Constructors

Short Int16 |

Instances

Eq Short |
Show Short |
SimpleType Short |
SchemaType Short |

newtype Byte

Constructors

Byte Int8 |

Instances

Eq Byte |
Show Byte |
SimpleType Byte |
SchemaType Byte |

newtype NonNegativeInteger

Constructors

NonNeg Integer |

Instances

Eq NonNegativeInteger |
Show NonNegativeInteger |
SimpleType NonNegativeInteger |
SchemaType NonNegativeInteger |

newtype UnsignedLong

Constructors

ULong Word64 |

Instances

Eq UnsignedLong |
Show UnsignedLong |
SimpleType UnsignedLong |
SchemaType UnsignedLong |

newtype UnsignedInt

Constructors

UInt Word32 |

Instances

Eq UnsignedInt |
Show UnsignedInt |
SimpleType UnsignedInt |
SchemaType UnsignedInt |

newtype UnsignedShort

Constructors

UShort Word16 |

Instances

Eq UnsignedShort |
Show UnsignedShort |
SimpleType UnsignedShort |
SchemaType UnsignedShort |

newtype UnsignedByte

Constructors

UByte Word8 |

Instances

Eq UnsignedByte |
Show UnsignedByte |
SimpleType UnsignedByte |
SchemaType UnsignedByte |

newtype PositiveInteger

Constructors

Positive Integer |

Instances

Eq PositiveInteger |
Show PositiveInteger |
SimpleType PositiveInteger |
SchemaType PositiveInteger |