xml-types-0.3.3: Basic types for representing XML

Portabilityportable
Maintainerjmillikin@gmail.com
Safe HaskellSafe-Inferred

Data.XML.Types

Contents

Description

Basic types for representing XML.

The idea is to have a full set of appropriate types, which various XML libraries can share. Instead of having equivalent-but-incompatible types for every binding, parser, or client, they all share the same types can can thus interoperate easily.

This library contains complete types for most parts of an XML document, including the prologue, node tree, and doctype. Some basic combinators are included for common tasks, including traversing the node tree and filtering children.

Synopsis

Types

Document prologue

data Document

Instances

Eq Document 
Data Document 
Ord Document 
Show Document 
Typeable Document 

data Prologue

Instances

Eq Prologue 
Data Prologue 
Ord Prologue 
Show Prologue 
Typeable Prologue 

data Instruction

Instances

Document body

data Node

Instances

Eq Node 
Data Node 
Ord Node 
Show Node 
Typeable Node 

data Element

Constructors

Element 

Instances

Eq Element 
Data Element 
Ord Element 
Show Element 
Typeable Element 

data Content

Constructors

ContentText Text 
ContentEntity Text

For pass-through parsing

Instances

Eq Content 
Data Content 
Ord Content 
Show Content 
Typeable Content 

data Name

A fully qualified name.

Prefixes are not semantically important; they are included only to simplify pass-through parsing. When comparing names with Eq or Ord methods, prefixes are ignored.

The IsString instance supports Clark notation; see http://www.jclark.com/xml/xmlns.htm and http://infohost.nmt.edu/tcc/help/pubs/pylxml/etree-QName.html. Use the OverloadedStrings language extension for very simple Name construction:

 myname :: Name
 myname = "{http://example.com/ns/my-namespace}my-name"

Constructors

Name 

Fields

nameLocalName :: Text
 
nameNamespace :: Maybe Text
 
namePrefix :: Maybe Text
 

Instances

Eq Name 
Data Name 
Ord Name 
Show Name 
Typeable Name 
IsString Name 

Doctypes

data Doctype

Note: due to the incredible complexity of DTDs, this type only supports external subsets. I've tried adding internal subset types, but they quickly gain more code than the rest of this module put together.

It is possible that some future version of this library might support internal subsets, but I am no longer actively working on adding them.

Constructors

Doctype 

Fields

doctypeName :: Text
 
doctypeID :: Maybe ExternalID
 

Instances

Eq Doctype 
Data Doctype 
Ord Doctype 
Show Doctype 
Typeable Doctype 

data ExternalID

Constructors

SystemID Text 
PublicID Text Text 

Instances

Eq ExternalID 
Data ExternalID 
Ord ExternalID 
Show ExternalID 
Typeable ExternalID 

Incremental processing

data Event

Some XML processing tools are incremental, and work in terms of events rather than node trees. The Event type allows a document to be fully specified as a sequence of events.

Event-based XML libraries include:

Instances

Eq Event 
Data Event 
Ord Event 
Show Event 
Typeable Event 

Combinators

Filters

Element traversal

Node traversal

Attributes

hasAttributeText :: Name -> (Text -> Bool) -> Element -> [Element]