-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Utilities for manipulating XML documents
--
-- Haskell utilities for parsing, filtering, transforming and generating
-- XML documents.
@package HaXml
@version 1.20
-- | This is another hand-written lexer, this time for the Xtract
-- command-language. The entry point is lexXtract. You don't normally
-- need to use this module directly - the lexer is called automatically
-- by the parser. (We only expose this interface for debugging purposes.)
--
-- The Xtract command language is very like the XPath specification.
module Text.XML.HaXml.Xtract.Lex
-- | First argument is a transformer for pattern strings, e.g. map toLower,
-- but only applying to parts of the pattern not in quotation marks.
-- (Needed to canonicalise HTML where tags are case-insensitive, but
-- attribute values are case sensitive.)
lexXtract :: (String -> String) -> String -> [Token]
data Posn
Pn :: Int -> Posn
data TokenT
Symbol :: String -> TokenT
TokString :: String -> TokenT
TokNum :: Integer -> TokenT
type Token = Either String (Posn, TokenT)
instance Eq TokenT
instance Eq Posn
instance Show TokenT
instance Show Posn
-- | Define a position datatype for giving locations in error messages.
module Text.XML.HaXml.Posn
-- | Source positions contain a filename, line, column, and an inclusion
-- point, which is itself another source position, recursively.
data Posn
-- | posInNewCxt name pos creates a new source position from an
-- old one. It is used when opening a new file (e.g. a DTD inclusion), to
-- denote the start of the file name, but retain the stacked
-- information that it was included from the old pos.
posInNewCxt :: String -> Maybe Posn -> Posn
-- | Dummy value for generated data, where a true source position does not
-- exist.
noPos :: Posn
-- | Just used to strictify the internal values of a position, to avoid
-- space leaks.
forcep :: Posn -> Int
-- | Add n character positions to the given position.
addcol :: Int -> Posn -> Posn
newline :: Posn -> Posn
-- | Add a newline or tab to the given position.
tab :: Posn -> Posn
-- | Add the given whitespace char to the given position. Precondition:
-- white c | isSpace c = True
white :: Char -> Posn -> Posn
posnFilename :: Posn -> FilePath
posnLine :: Posn -> Int
posnColumn :: Posn -> Int
instance Eq Posn
instance Show Posn
-- | You don't normally need to use this Lex module directly - it is called
-- automatically by the parser. (This interface is only exposed for
-- debugging purposes.)
--
-- This is a hand-written lexer for tokenising the text of an XML
-- document so that it is ready for parsing. It attaches position
-- information in (line,column) format to every token. The main entry
-- point is xmlLex. A secondary entry point, xmlReLex, is
-- provided for when the parser needs to stuff a string back onto the
-- front of the text and re-tokenise it (typically when expanding
-- macros).
--
-- As one would expect, the lexer is essentially a small finite state
-- machine.
module Text.XML.HaXml.Lex
-- | The first argument to xmlLex is the filename (used for source
-- positions, especially in error messages), and the second is the string
-- content of the XML file.
xmlLex :: String -> String -> [Token]
-- | xmlReLex is used when the parser expands a macro (PE
-- reference). The expansion of the macro must be re-lexed as if for the
-- first time.
xmlReLex :: Posn -> String -> [Token]
-- | reLexEntityValue is used solely within parsing an entityvalue.
-- Normally, a PERef is logically separated from its surroundings by
-- whitespace. But in an entityvalue, a PERef can be juxtaposed to an
-- identifier, so the expansion forms a new identifier. Thus the need to
-- rescan the whole text for possible PERefs.
reLexEntityValue :: (String -> Maybe String) -> Posn -> String -> [Token]
-- | All tokens are paired up with a source position. Lexical errors are
-- passed back as a special TokenT value.
type Token = (Posn, TokenT)
-- | The basic token type.
data TokenT
-- | <!--
TokCommentOpen :: TokenT
-- |
TokCommentClose :: TokenT
-- | <?
TokPIOpen :: TokenT
-- | ?>
TokPIClose :: TokenT
-- | <![
TokSectionOpen :: TokenT
-- | ]]>
TokSectionClose :: TokenT
-- | CDATA INCLUDE IGNORE etc
TokSection :: Section -> TokenT
-- | <!
TokSpecialOpen :: TokenT
-- | DOCTYPE ELEMENT ATTLIST etc
TokSpecial :: Special -> TokenT
-- | </
TokEndOpen :: TokenT
-- | />
TokEndClose :: TokenT
-- | <
TokAnyOpen :: TokenT
-- |
--
TokAnyClose :: TokenT
-- | [
TokSqOpen :: TokenT
-- | ]
TokSqClose :: TokenT
-- | =
TokEqual :: TokenT
-- | ?
TokQuery :: TokenT
-- | *
TokStar :: TokenT
-- | +
TokPlus :: TokenT
-- | &
TokAmp :: TokenT
-- | ;
TokSemi :: TokenT
-- | #
TokHash :: TokenT
-- | (
TokBraOpen :: TokenT
-- | )
TokBraClose :: TokenT
-- | |
TokPipe :: TokenT
-- | %
TokPercent :: TokenT
-- | ,
TokComma :: TokenT
-- | '' or ""
TokQuote :: TokenT
-- | begins with letter, no spaces
TokName :: String -> TokenT
-- | any character data
TokFreeText :: String -> TokenT
-- | fake token
TokNull :: TokenT
-- | lexical error
TokError :: String -> TokenT
data Special
DOCTYPEx :: Special
ELEMENTx :: Special
ATTLISTx :: Special
ENTITYx :: Special
NOTATIONx :: Special
data Section
CDATAx :: Section
INCLUDEx :: Section
IGNOREx :: Section
instance Eq Section
instance Show Section
instance Eq Special
instance Show Special
instance Eq TokenT
instance Eq Where
instance Show TokenT
-- | Defines an internal representation of Haskell data/newtype definitions
-- that correspond to the XML DTD types, and provides pretty-printers to
-- convert these types into the Doc type of
-- Text.PrettyPrint.HughesPJ.
module Text.XML.HaXml.DtdToHaskell.TypeDef
data TypeDef
-- | Bool for main/aux.
DataDef :: Bool -> Name -> AttrFields -> Constructors -> TypeDef
EnumDef :: Name -> [Name] -> TypeDef
type Constructors = [(Name, [StructType])]
type AttrFields = [(Name, StructType)]
data StructType
Maybe :: StructType -> StructType
-- | String holds default value.
Defaultable :: StructType -> String -> StructType
List :: StructType -> StructType
-- | Non-empty lists.
List1 :: StructType -> StructType
Tuple :: [StructType] -> StructType
OneOf :: [StructType] -> StructType
-- | XML's contentspec allows ANY
Any :: StructType
String :: StructType
Defined :: Name -> StructType
ppTypeDef :: TypeDef -> Doc
-- | Pretty print Haskell name.
ppHName :: Name -> Doc
-- | Pretty print XML name.
ppXName :: Name -> Doc
-- | Pretty print Haskell attributes name.
ppAName :: Name -> Doc
-- | Need to keep both the XML and Haskell versions of a name.
data Name
Name :: String -> String -> Name
-- | original XML name
xName :: Name -> String
-- | mangled Haskell name
hName :: Name -> String
-- | Make a type name valid in both XML and Haskell.
name :: String -> Name
-- | Append an underscore to the Haskell version of the name.
name_ :: String -> Name
-- | Prefix an attribute enumeration type name with its containing element
-- name.
name_a :: String -> String -> Name
-- | Prefix an attribute enumeration constructor with its element-tag name,
-- and its enumeration type name.
name_ac :: String -> String -> String -> Name
-- | Prefix a field name with its enclosing element name.
name_f :: String -> String -> Name
-- | Convert an XML name to a Haskell conid.
mangle :: String -> String
-- | Convert an XML name to a Haskell varid.
manglef :: String -> String
instance Eq StructType
instance Eq TypeDef
instance Eq Name
instance Show StructType
module Text.XML.HaXml.DtdToHaskell.Instance
-- | Convert typedef to appropriate instance declaration, either
-- XmlContent, XmlAttributes, or XmlAttrType.
mkInstance :: TypeDef -> Doc
-- | This module defines an internal (generic) representation for XML
-- documents including their DTDs.
--
-- History: The original module was derived by hand from the XML
-- specification, following the grammar precisely. Then we simplified the
-- types, removing layers of indirection and redundancy, and generally
-- making things easier to work with. Then we allowed PEReferences to be
-- ubiquitous, by removing them from the types and resolving all PE
-- references at parse-time. Finally, we added a per-document symbol
-- table for GEReferences, and a whitespace-significance flag for
-- plaintext.
module Text.XML.HaXml.Types
type SymTab a = [(String, a)]
emptyST :: SymTab a
addST :: String -> a -> SymTab a -> SymTab a
lookupST :: String -> SymTab a -> Maybe a
-- | The symbol table stored in a document holds all its general entity
-- reference definitions.
data Document i
Document :: Prolog -> (SymTab EntityDef) -> (Element i) -> [Misc] -> Document i
data Element i
Elem :: Name -> [Attribute] -> [Content i] -> Element i
data ElemTag
ElemTag :: Name -> [Attribute] -> ElemTag
data Content i
CElem :: (Element i) -> i -> Content i
-- | bool is whether whitespace is significant
CString :: Bool -> CharData -> i -> Content i
CRef :: Reference -> i -> Content i
CMisc :: Misc -> i -> Content i
type Attribute = (Name, AttValue)
data AttValue
AttValue :: [Either String Reference] -> AttValue
info :: Content t -> t
data Prolog
Prolog :: (Maybe XMLDecl) -> [Misc] -> (Maybe DocTypeDecl) -> [Misc] -> Prolog
data XMLDecl
XMLDecl :: VersionInfo -> (Maybe EncodingDecl) -> (Maybe SDDecl) -> XMLDecl
data Misc
Comment :: Comment -> Misc
PI :: ProcessingInstruction -> Misc
type ProcessingInstruction = (PITarget, String)
type SDDecl = Bool
type VersionInfo = String
type Comment = String
type PITarget = String
data DocTypeDecl
DTD :: Name -> (Maybe ExternalID) -> [MarkupDecl] -> DocTypeDecl
data MarkupDecl
Element :: ElementDecl -> MarkupDecl
AttList :: AttListDecl -> MarkupDecl
Entity :: EntityDecl -> MarkupDecl
Notation :: NotationDecl -> MarkupDecl
MarkupMisc :: Misc -> MarkupDecl
data ExtSubset
ExtSubset :: (Maybe TextDecl) -> [ExtSubsetDecl] -> ExtSubset
data ExtSubsetDecl
ExtMarkupDecl :: MarkupDecl -> ExtSubsetDecl
ExtConditionalSect :: ConditionalSect -> ExtSubsetDecl
data ElementDecl
ElementDecl :: Name -> ContentSpec -> ElementDecl
data ContentSpec
EMPTY :: ContentSpec
ANY :: ContentSpec
Mixed :: Mixed -> ContentSpec
ContentSpec :: CP -> ContentSpec
data CP
TagName :: Name -> Modifier -> CP
Choice :: [CP] -> Modifier -> CP
Seq :: [CP] -> Modifier -> CP
data Modifier
-- | Just One
None :: Modifier
-- | Zero Or One
Query :: Modifier
-- | Zero Or More
Star :: Modifier
-- | One Or More
Plus :: Modifier
data Mixed
PCDATA :: Mixed
PCDATAplus :: [Name] -> Mixed
data AttListDecl
AttListDecl :: Name -> [AttDef] -> AttListDecl
data AttDef
AttDef :: Name -> AttType -> DefaultDecl -> AttDef
data AttType
StringType :: AttType
TokenizedType :: TokenizedType -> AttType
EnumeratedType :: EnumeratedType -> AttType
data TokenizedType
ID :: TokenizedType
IDREF :: TokenizedType
IDREFS :: TokenizedType
ENTITY :: TokenizedType
ENTITIES :: TokenizedType
NMTOKEN :: TokenizedType
NMTOKENS :: TokenizedType
data EnumeratedType
NotationType :: NotationType -> EnumeratedType
Enumeration :: Enumeration -> EnumeratedType
type NotationType = [Name]
type Enumeration = [NmToken]
data DefaultDecl
REQUIRED :: DefaultDecl
IMPLIED :: DefaultDecl
DefaultTo :: AttValue -> (Maybe FIXED) -> DefaultDecl
data FIXED
FIXED :: FIXED
data ConditionalSect
IncludeSect :: IncludeSect -> ConditionalSect
IgnoreSect :: IgnoreSect -> ConditionalSect
type IncludeSect = [ExtSubsetDecl]
type IgnoreSect = [IgnoreSectContents]
data Ignore
Ignore :: Ignore
data IgnoreSectContents
IgnoreSectContents :: Ignore -> [(IgnoreSectContents, Ignore)] -> IgnoreSectContents
data Reference
RefEntity :: EntityRef -> Reference
RefChar :: CharRef -> Reference
type EntityRef = Name
type CharRef = Int
type PEReference = Name
data EntityDecl
EntityGEDecl :: GEDecl -> EntityDecl
EntityPEDecl :: PEDecl -> EntityDecl
data GEDecl
GEDecl :: Name -> EntityDef -> GEDecl
data PEDecl
PEDecl :: Name -> PEDef -> PEDecl
data EntityDef
DefEntityValue :: EntityValue -> EntityDef
DefExternalID :: ExternalID -> (Maybe NDataDecl) -> EntityDef
data PEDef
PEDefEntityValue :: EntityValue -> PEDef
PEDefExternalID :: ExternalID -> PEDef
data ExternalID
SYSTEM :: SystemLiteral -> ExternalID
PUBLIC :: PubidLiteral -> SystemLiteral -> ExternalID
newtype NDataDecl
NDATA :: Name -> NDataDecl
data TextDecl
TextDecl :: (Maybe VersionInfo) -> EncodingDecl -> TextDecl
data ExtParsedEnt i
ExtParsedEnt :: (Maybe TextDecl) -> (Content i) -> ExtParsedEnt i
data ExtPE
ExtPE :: (Maybe TextDecl) -> [ExtSubsetDecl] -> ExtPE
data NotationDecl
NOTATION :: Name -> (Either ExternalID PublicID) -> NotationDecl
newtype PublicID
PUBLICID :: PubidLiteral -> PublicID
newtype EncodingDecl
EncodingDecl :: String -> EncodingDecl
data EntityValue
EntityValue :: [EV] -> EntityValue
data EV
EVString :: String -> EV
EVRef :: Reference -> EV
newtype PubidLiteral
PubidLiteral :: String -> PubidLiteral
newtype SystemLiteral
SystemLiteral :: String -> SystemLiteral
type Name = String
type Names = [Name]
type NmToken = String
type NmTokens = [NmToken]
type CharData = String
type CDSect = CharData
instance Eq SystemLiteral
instance Show SystemLiteral
instance Eq PubidLiteral
instance Show PubidLiteral
instance Eq EV
instance Show EV
instance Eq EntityValue
instance Show EntityValue
instance Eq AttValue
instance Eq EncodingDecl
instance Eq PublicID
instance Eq NotationDecl
instance Eq ExtPE
instance (Eq i) => Eq (ExtParsedEnt i)
instance Eq TextDecl
instance Eq NDataDecl
instance Eq ExternalID
instance Show ExternalID
instance Eq PEDef
instance Show PEDef
instance Eq EntityDef
instance Eq PEDecl
instance Eq GEDecl
instance Eq EntityDecl
instance Eq Reference
instance Show Reference
instance Eq IgnoreSectContents
instance Eq Ignore
instance Eq ConditionalSect
instance Eq FIXED
instance Eq DefaultDecl
instance Eq EnumeratedType
instance Eq TokenizedType
instance Eq AttType
instance Eq AttDef
instance Eq AttListDecl
instance Eq Mixed
instance Eq Modifier
instance Eq CP
instance Eq ContentSpec
instance Eq ElementDecl
instance (Eq i) => Eq (Content i)
instance (Eq i) => Eq (Element i)
instance Eq ExtSubsetDecl
instance Eq ExtSubset
instance Eq MarkupDecl
instance Eq DocTypeDecl
instance Eq Misc
instance Eq XMLDecl
instance Eq Prolog
instance (Eq i) => Eq (Document i)
instance Eq ElemTag
instance Show AttValue
instance Functor Content
instance Functor Element
instance Functor Document
-- | This module defines the notion of filters and filter combinators for
-- processing XML documents.
--
-- These XML transformation combinators are described in the paper
-- ``Haskell and XML: Generic Combinators or Type-Based Translation?''
-- Malcolm Wallace and Colin Runciman, Proceedings ICFP'99.
module Text.XML.HaXml.Combinators
-- | All document transformations are content filters. A filter
-- takes a single XML Content value and returns a sequence of
-- Content values, possibly empty.
type CFilter i = Content i -> [Content i]
keep :: a -> [a]
none :: a -> [b]
-- | Throw away current node, keep just the (unprocessed) children.
children :: CFilter i
-- | Process children using specified filters.
childrenBy :: CFilter i -> CFilter i
-- | Select the n'th positional result of a filter.
position :: Int -> CFilter i -> CFilter i
elm :: CFilter i
txt :: CFilter i
tag :: String -> CFilter i
attr :: Name -> CFilter i
attrval :: Attribute -> CFilter i
tagWith :: (String -> Bool) -> CFilter i
-- | For a mandatory attribute field, find key cont looks up the
-- value of the attribute name key, and applies the continuation
-- cont to the value.
find :: String -> (String -> CFilter i) -> CFilter i
-- | When an attribute field may be absent, use iffind key yes no
-- to lookup its value. If the attribute is absent, it acts as the
-- no filter, otherwise it applies the yes filter.
iffind :: String -> (String -> CFilter i) -> CFilter i -> CFilter i
-- | ifTxt yes no processes any textual content with the
-- yes filter, but otherwise is the same as the no
-- filter.
ifTxt :: (String -> CFilter i) -> CFilter i -> CFilter i
-- | Sequential (Irish,backwards) composition
o :: CFilter i -> CFilter i -> CFilter i
-- | Binary parallel composition. Each filter uses a copy of the input,
-- rather than one filter using the result of the other. (Has a more
-- general type than just CFilter.)
union :: (a -> [b]) -> (a -> [b]) -> (a -> [b])
-- | Glue a list of filters together. (A list version of union; also has a
-- more general type than just CFilter.)
cat :: [a -> [b]] -> (a -> [b])
-- | A special form of filter composition where the second filter works
-- over the same data as the first, but also uses the first's result.
andThen :: (a -> c) -> (c -> a -> b) -> (a -> b)
-- | Directional choice: in f |>| g give g-productions only if
-- no f-productions
(|>|) :: (a -> [b]) -> (a -> [b]) -> (a -> [b])
-- | Pruning: in f with g, keep only those f-productions
-- which have at least one g-production
with :: CFilter i -> CFilter i -> CFilter i
-- | Pruning: in f without g, keep only those f-productions
-- which have no g-productions
without :: CFilter i -> CFilter i -> CFilter i
-- | Pronounced slash, f /> g means g inside f
(/>) :: CFilter i -> CFilter i -> CFilter i
-- | Pronounced outside, f </ g means f containing g
() :: CFilter i -> CFilter i -> CFilter i
-- | Join an element-matching filter with a text-only filter
et :: (String -> CFilter i) -> CFilter i -> CFilter i
-- | Express a list of filters like an XPath query, e.g. path
-- [children, tag "name1", attr "attr1", children, tag "name2"] is
-- like the XPath query /name1[@attr1]/name2.
path :: [CFilter i] -> CFilter i
deep :: CFilter i -> CFilter i
deepest :: CFilter i -> CFilter i
multi :: CFilter i -> CFilter i
-- | Interior editing: f when g applies f only
-- when the predicate g succeeds, otherwise the content is
-- unchanged.
when :: CFilter i -> CFilter i -> CFilter i
-- | Interior editing: g guards f applies f only
-- when the predicate g succeeds, otherwise the content is
-- discarded.
guards :: CFilter i -> CFilter i -> CFilter i
-- | Process CHildren In Place. The filter is applied to any children of an
-- element content, and the element rebuilt around the results.
chip :: CFilter i -> CFilter i
-- | Process an element In Place. The filter is applied to the element
-- itself, and then the original element rebuilt around the results.
inplace :: CFilter i -> CFilter i
-- | Recursive application of filters: a fold-like operator. Defined as
-- f o chip (foldXml f).
foldXml :: CFilter i -> CFilter i
-- | Build an element with the given tag name - its content is the results
-- of the given list of filters.
mkElem :: String -> [CFilter i] -> CFilter i
-- | Build an element with the given name, attributes, and content.
mkElemAttr :: String -> [(String, CFilter i)] -> [CFilter i] -> CFilter i
-- | Build some textual content.
literal :: String -> CFilter i
-- | Build some CDATA content.
cdata :: String -> CFilter i
-- | Rename an element tag (leaving attributes in place).
replaceTag :: String -> CFilter i
-- | Replace the attributes of an element (leaving tag the same).
replaceAttrs :: [(String, String)] -> CFilter i
-- | Conjoin the two branches of a conditional.
data ThenElse a
(:>) :: a -> a -> ThenElse a
-- | Select between the two branches of a joined conditional.
(?>) :: (a -> [b]) -> ThenElse (a -> [b]) -> (a -> [b])
-- | A LabelFilter is like a CFilter except that it pairs up a polymorphic
-- value (label) with each of its results.
type LabelFilter i a = Content i -> [(a, Content i)]
-- | Compose a label-processing filter with a label-generating filter.
oo :: (a -> CFilter i) -> LabelFilter i a -> CFilter i
-- | Combine labels. Think of this as a pair-wise zip on labels. e.g.
-- (numbered x tagged)
x :: (CFilter i -> LabelFilter i a) -> (CFilter i -> LabelFilter i b) -> (CFilter i -> LabelFilter i (a, b))
-- | Number the results from 1 upwards.
numbered :: CFilter i -> LabelFilter i Int
-- | In interspersed a f b, label each result of f with
-- the string a, except for the last one which is labelled with
-- the string b.
interspersed :: String -> CFilter i -> String -> LabelFilter i String
-- | Label each element in the result with its tag name. Non-element
-- results get an empty string label.
tagged :: CFilter i -> LabelFilter i String
-- | Label each element in the result with the value of the named
-- attribute. Elements without the attribute, and non-element results,
-- get an empty string label.
attributed :: String -> CFilter i -> LabelFilter i String
-- | Label each textual part of the result with its text. Element results
-- get an empty string label.
textlabelled :: CFilter i -> LabelFilter i (Maybe String)
-- | Label each content with some information extracted from itself.
extracted :: (Content i -> a) -> CFilter i -> LabelFilter i a
-- | A non-validating XML parser. For the input grammar, see
-- http://www.w3.org/TR/REC-xml.
module Text.XML.HaXml.Parse
-- | To parse a whole document, xmlParse file content takes a
-- filename (for generating error reports) and the string content of that
-- file. A parse error causes program failure, with message to stderr.
xmlParse :: String -> String -> Document Posn
-- | To parse a whole document, xmlParse' file content takes a
-- filename (for generating error reports) and the string content of that
-- file. Any parse error message is passed back to the caller through the
-- Either type.
xmlParse' :: String -> String -> Either String (Document Posn)
-- | To parse just a DTD, dtdParse file content takes a filename
-- (for generating error reports) and the string content of that file. If
-- no DTD was found, you get Nothing rather than an error.
-- However, if a DTD is found but contains errors, the program crashes.
dtdParse :: String -> String -> Maybe DocTypeDecl
-- | To parse just a DTD, dtdParse' file content takes a filename
-- (for generating error reports) and the string content of that file. If
-- no DTD was found, you get Right Nothing. If a DTD was found
-- but contains errors, you get a Left message.
dtdParse' :: String -> String -> Either String (Maybe DocTypeDecl)
-- | To parse a partial document, e.g. from an XML-based stream protocol,
-- where you may later want to get more document elements from the same
-- stream. Arguments are: a parser for the item you want, and the
-- already-lexed input to parse from. Returns the item you wanted (or an
-- error message), plus the remainder of the input.
xmlParseWith :: XParser a -> [(Posn, TokenT)] -> (Either String a, [(Posn, TokenT)])
-- | Return an entire XML document including prolog and trailing junk.
document :: XParser (Document Posn)
-- | Return a complete element including all its inner content.
element :: XParser (Element Posn)
-- | Return a content particle, e.g. text, element, reference, etc
content :: XParser (Content Posn)
-- | Return an XML comment.
comment :: XParser Comment
cdsect :: XParser CDSect
-- | Return parsed freetext (i.e. until the next markup)
chardata :: XParser CharData
-- | Return either a general entity reference, or a character reference.
reference :: XParser Reference
-- | Return a DOCTYPE decl, indicating a DTD.
doctypedecl :: XParser DocTypeDecl
-- | Parse a processing instruction.
processinginstruction :: XParser ProcessingInstruction
-- | Parse only the parts between angle brackets in an element tag.
elemtag :: XParser ElemTag
-- | Return just a name, e.g. element name, attribute name.
name :: XParser Name
-- | Return the next token from the input only if it matches the given
-- token.
tok :: TokenT -> XParser TokenT
-- | For use with stream parsers - returns the complete opening element
-- tag.
elemOpenTag :: XParser ElemTag
-- | For use with stream parsers - accepts a closing tag, provided it
-- matches the given element name.
elemCloseTag :: Name -> XParser ()
-- | Some empty symbol tables for GE and PE references.
emptySTs :: SymTabs
-- | XParser is just a specialisation of the PolyState parser.
type XParser a = Parser SymTabs (Posn, TokenT) a
fst3 :: (a, b, c) -> a
snd3 :: (a, b, c) -> b
thd3 :: (a, b, c) -> c
instance Show Modifier
instance Show CP
-- | This is a pretty-printer for turning the internal representation of
-- generic structured XML documents into the Doc type (which can later be
-- rendered using Text.PrettyPrint.HughesPJ.render). Essentially there is
-- one pp function for each type in Text.Xml.HaXml.Types, so you can
-- pretty-print as much or as little of the document as you wish.
module Text.XML.HaXml.Pretty
document :: Document i -> Doc
content :: Content i -> Doc
element :: Element i -> Doc
doctypedecl :: DocTypeDecl -> Doc
prolog :: Prolog -> Doc
cp :: CP -> Doc
-- | These are just some common abbreviations for generating HTML content
-- within the XML transformation framework defined by
-- Text.Xml.HaXml.Combinators.
module Text.XML.HaXml.Html.Generate
html :: [CFilter i] -> CFilter i
hhead :: [CFilter i] -> CFilter i
htitle :: [CFilter i] -> CFilter i
hbody :: [CFilter i] -> CFilter i
h1 :: [CFilter i] -> CFilter i
h2 :: [CFilter i] -> CFilter i
h3 :: [CFilter i] -> CFilter i
h4 :: [CFilter i] -> CFilter i
hpara :: [CFilter i] -> CFilter i
hdiv :: [CFilter i] -> CFilter i
hspan :: [CFilter i] -> CFilter i
margin :: [CFilter i] -> CFilter i
anchor :: [(String, CFilter i)] -> [CFilter i] -> CFilter i
makehref :: CFilter i -> [CFilter i] -> CFilter i
anchorname :: CFilter i -> [CFilter i] -> CFilter i
hpre :: [CFilter i] -> CFilter i
hcentre :: [CFilter i] -> CFilter i
hem :: [CFilter i] -> CFilter i
htt :: [CFilter i] -> CFilter i
hbold :: [CFilter i] -> CFilter i
parens :: CFilter i -> CFilter i
bullet :: [CFilter i] -> CFilter i
htable :: [CFilter i] -> CFilter i
hrow :: [CFilter i] -> CFilter i
hcol :: [CFilter i] -> CFilter i
hbr :: CFilter i
hhr :: CFilter i
showattr :: String -> CFilter i
(!) :: String -> CFilter i
(?) :: String -> CFilter i
htmlprint :: [Content i] -> Doc
-- | This is a parser for HTML documents. Unlike for XML documents, it must
-- include a certain amount of error-correction to account for HTML
-- features like self-terminating tags, unterminated tags, and incorrect
-- nesting. The input is tokenised by the XML lexer (a separate lexer is
-- not required for HTML).
module Text.XML.HaXml.Html.Parse
-- | The first argument is the name of the file, the second is the string
-- contents of the file. The result is the generic representation of an
-- XML document. Any errors cause program failure with message to stderr.
htmlParse :: String -> String -> Document Posn
module Text.XML.HaXml.Wrappers
-- | This useful auxiliary checks the commandline arguments for two
-- filenames, the input and output file respectively. If either is
-- missing, it is replaced by -, which can be interpreted by the
-- caller as stdin and/or stdout.
fix2Args :: IO (String, String)
-- | The wrapper processXmlWith returns an IO () computation that
-- collects the filenames (or stdin/stdout) to use when reading/writing
-- XML documents. Its CFilter argument is applied to transform the XML
-- document from the input and write it to the output. No DTD is attached
-- to the output.
--
-- If the input filename ends with .html or .htm, it is parsed using the
-- error-correcting HTML parser rather than the strict XML parser.
processXmlWith :: CFilter Posn -> IO ()
-- | The wrapper onContent simply applies a given content filter
-- to a document. Ambiguous or empty results raise an error exception.
onContent :: CFilter i -> Document i -> Document i
-- | The preferred method for rendering a Document or single
-- Content is by using the pretty printing facility defined in
-- Pretty. Pretty-printing does not work well for cases, however,
-- where the formatting in the XML document is significant. Examples of
-- this case are XHTML's <pre> tag, Docbook's
-- <literallayout> tag, and many more.
--
-- Theoretically, the document author could avoid this problem by
-- wrapping the contents of these tags in a <![CDATA[...]]>
-- section, but often this is not practical, for instance when the
-- literal-layout section contains other elements. Finally, program
-- writers could manually format these elements by transforming them into
-- a literal string in their CFliter, etc., but this is annoying to do
-- and prone to omissions and formatting errors.
--
-- As an alternative, this module provides the function verbatim,
-- which will format XML Content as a String while
-- retaining the formatting of the input document unchanged.
--
-- Know problems:
--
--
-- - HaXml's parser eats line feeds between two tags.
-- - Attributes should be formatted by making them an instance
-- of Verbatim as well, but since an Attribute is just a
-- tuple, not a full data type, the helper function verbAttr must
-- be used instead.
-- - CMisc is not yet supported.
-- - Elements, which contain no content, are formatted as
-- <element-name/>, even if they were not defined as being
-- of type EMPTY. In XML this perfectly alright, but in SGML it
-- is not. Those, who wish to use verbatim to format parts of say
-- an HTML page will have to (a) replace problematic elements by literals
-- before running verbatim or (b) use a second
-- search-and-replace stage to fix this.
--
module Text.XML.HaXml.Verbatim
-- | This class promises that the function verbatim knows how to
-- format this data type into a string without changing the formatting.
class Verbatim a
verbatim :: (Verbatim a) => a -> String
-- | This is a helper function is required because Haskell does not allow
-- to make an ordinary tuple (like Attribute) an instance of a
-- class. The resulting output will preface the actual attribute with a
-- single blank so that lists of Attributes can be handled
-- implicitly by the definition for lists of Verbatim data types.
verbAttr :: Attribute -> String
instance Verbatim Reference
instance Verbatim (Element i)
instance Verbatim (Content i)
instance (Verbatim a, Verbatim b) => Verbatim (Either a b)
instance Verbatim Char
instance (Verbatim a) => Verbatim [a]
module Text.XML.HaXml.Escape
xmlEscape :: XmlEscaper -> Element i -> Element i
xmlUnEscape :: XmlEscaper -> Element i -> Element i
xmlEscapeContent :: XmlEscaper -> [Content i] -> [Content i]
xmlUnEscapeContent :: XmlEscaper -> [Content i] -> [Content i]
data XmlEscaper
stdXmlEscaper :: XmlEscaper
mkXmlEscaper :: [(Char, String)] -> (Char -> Bool) -> XmlEscaper
-- | This is a fast non-pretty-printer for turning the internal
-- representation of generic structured XML documents into Lazy
-- ByteStrings. Like in Text.Xml.HaXml.Pretty, there is one pp function
-- for each type in Text.Xml.HaXml.Types, so you can pretty-print as much
-- or as little of the document as you wish.
module Text.XML.HaXml.ByteStringPP
document :: Document i -> ByteString
content :: Content i -> ByteString
element :: Element i -> ByteString
doctypedecl :: DocTypeDecl -> ByteString
prolog :: Prolog -> ByteString
cp :: CP -> ByteString
-- | This module performs the translation of a parsed XML DTD into the
-- internal representation of corresponding Haskell data/newtypes.
module Text.XML.HaXml.DtdToHaskell.Convert
dtd2TypeDef :: [MarkupDecl] -> [TypeDef]
-- | This is a parser for HTML documents. Unlike for XML documents, it must
-- include a certain amount of error-correction to account for HTML
-- features like self-terminating tags, unterminated tags, and incorrect
-- nesting. The input is tokenised by the XML lexer (a separate lexer is
-- not required for HTML).
module Text.XML.HaXml.Html.ParseLazy
-- | The first argument is the name of the file, the second is the string
-- contents of the file. The result is the generic representation of an
-- XML document. Any errors cause program failure with message to stderr.
htmlParse :: String -> String -> Document Posn
-- | This is a separate pretty-printer for HTML documents, recognising some
-- of the differences between HTML and true XML.
module Text.XML.HaXml.Html.Pretty
document :: Document i -> Doc
element :: Element i -> Doc
attribute :: Attribute -> Doc
content :: Content i -> Doc
-- | A non-validating XML parser. For the input grammar, see
-- http://www.w3.org/TR/REC-xml.
module Text.XML.HaXml.ParseLazy
-- | To parse a whole document, xmlParse file content takes a
-- filename (for generating error reports) and the string content of that
-- file. A parse error causes program failure, with message to stderr.
xmlParse :: String -> String -> Document Posn
-- | To parse just a DTD, dtdParse file content takes a filename
-- (for generating error reports) and the string content of that file. If
-- no DTD was found, you get Nothing rather than an error.
-- However, if a DTD is found but contains errors, the program crashes.
dtdParse :: String -> String -> Maybe DocTypeDecl
-- | To parse a partial document, e.g. from an XML-based stream protocol,
-- where you may later want to get more document elements from the same
-- stream. Arguments are: a parser for the item you want, and the
-- already-lexed input to parse from. Returns the item you wanted (or an
-- error message), plus the remainder of the input.
xmlParseWith :: XParser a -> [(Posn, TokenT)] -> (Either String a, [(Posn, TokenT)])
-- | Return an entire XML document including prolog and trailing junk.
document :: XParser (Document Posn)
-- | Return a complete element including all its inner content.
element :: XParser (Element Posn)
-- | Return a content particle, e.g. text, element, reference, etc
content :: XParser (Content Posn)
-- | Return an XML comment.
comment :: XParser Comment
-- | Return parsed freetext (i.e. until the next markup)
chardata :: XParser CharData
-- | Return either a general entity reference, or a character reference.
reference :: XParser Reference
-- | Return a DOCTYPE decl, indicating a DTD.
doctypedecl :: XParser DocTypeDecl
-- | Parse a processing instruction.
processinginstruction :: XParser ProcessingInstruction
-- | Parse only the parts between angle brackets in an element tag.
elemtag :: XParser ElemTag
-- | Return just a name, e.g. element name, attribute name.
name :: XParser Name
-- | Return the next token from the input only if it matches the given
-- token.
tok :: TokenT -> XParser TokenT
-- | For use with stream parsers - returns the complete opening element
-- tag.
elemOpenTag :: XParser ElemTag
-- | For use with stream parsers - accepts a closing tag, provided it
-- matches the given element name.
elemCloseTag :: Name -> XParser ()
-- | Some empty symbol tables for GE and PE references.
emptySTs :: SymTabs
-- | XParser is just a specialisation of the PolyStateLazy parser.
type XParser a = Parser SymTabs (Posn, TokenT) a
fst3 :: (a, b, c) -> a
snd3 :: (a, b, c) -> b
thd3 :: (a, b, c) -> c
instance Show Modifier
instance Show CP
-- | A streaming XML parser, using a method known as SAX. SAX isn't really
-- a standard, but an implementation, so it's just an "SAX-like" parser.
-- This module allows you parse an XML document without having to
-- evaluate it as a whole. This is needed for protocols like jabber,
-- which use xml streams for communication.
module Text.XML.HaXml.SAX
data SaxElement
-- | A doctype declaration occured(<!DOCTYPE>)
SaxDocTypeDecl :: DocTypeDecl -> SaxElement
-- | A processing instruction occured (<??>)
SaxProcessingInstruction :: ProcessingInstruction -> SaxElement
-- | A comment occured (<!-- -->)
SaxComment :: String -> SaxElement
-- | An element was opened (<>)
SaxElementOpen :: Name -> [Attribute] -> SaxElement
-- | An element was closed (</>)
SaxElementClose :: Name -> SaxElement
-- | An element without content occured (</>)
SaxElementTag :: Name -> [Attribute] -> SaxElement
-- | Some string data occured
SaxCharData :: CharData -> SaxElement
-- | A reference occured
SaxReference :: Reference -> SaxElement
-- | saxParse file content takes a filename and the string content
-- of that file and generates a stream of SaxElements. If an
-- error occurs, the parsing stops and a string is returned using the
-- Maybe type.
saxParse :: String -> String -> ([SaxElement], Maybe String)
module Text.XML.HaXml.TypeMapping
-- | HTypeable promises that we can create an explicit
-- representation of of the type of any value.
class HTypeable a
toHType :: (HTypeable a) => a -> HType
-- | A concrete representation of any Haskell type.
data HType
Maybe :: HType -> HType
List :: HType -> HType
Tuple :: [HType] -> HType
-- | separate Haskell name and XML name
Prim :: String -> String -> HType
String :: HType
-- | A user-defined type has a name, a sequence of type variables, and a
-- set of constructors. (The variables might already be instantiated to
-- actual types.)
Defined :: String -> [HType] -> [Constr] -> HType
-- | A concrete representation of any user-defined Haskell constructor. The
-- constructor has a name, and a sequence of component types. The first
-- sequence of types represents the minimum set of free type variables
-- occurring in the (second) list of real component types. If there are
-- fieldnames, they are contained in the final list, and correspond
-- one-to-one with the component types.
data Constr
Constr :: String -> [HType] -> [HType] -> Constr
showHType :: HType -> ShowS
-- | Project the n'th constructor from an HType and convert it to a string
-- suitable for an XML tagname.
showConstr :: Int -> HType -> String
-- | toDTD converts a concrete representation of the Haskell type of
-- a value (obtained by the method toHType) into a real
-- DocTypeDecl. It ensures that PERefs are defined before they are used,
-- and that no element or attribute-list is declared more than once.
toDTD :: HType -> DocTypeDecl
instance Eq Constr
instance Show Constr
instance Show HType
instance (HTypeable a) => HTypeable [a]
instance (HTypeable a, HTypeable b) => HTypeable (Either a b)
instance (HTypeable a) => HTypeable (Maybe a)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l, m)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k) => HTypeable (a, b, c, d, e, f, g, h, i, j, k)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j) => HTypeable (a, b, c, d, e, f, g, h, i, j)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i) => HTypeable (a, b, c, d, e, f, g, h, i)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h) => HTypeable (a, b, c, d, e, f, g, h)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g) => HTypeable (a, b, c, d, e, f, g)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f) => HTypeable (a, b, c, d, e, f)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e) => HTypeable (a, b, c, d, e)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d) => HTypeable (a, b, c, d)
instance (HTypeable a, HTypeable b, HTypeable c) => HTypeable (a, b, c)
instance (HTypeable a, HTypeable b) => HTypeable (a, b)
instance HTypeable ()
instance HTypeable Char
instance HTypeable Double
instance HTypeable Float
instance HTypeable Integer
instance HTypeable Int
instance HTypeable Bool
instance Eq HType
-- |
-- - Only a small module containing some helper functions to extract
-- xml content - I would have added this to Types but I've put it into an
-- additional module - to avoid circular references (Verbatim -
-- Types)
--
module Text.XML.HaXml.Util
-- | Get the main element of the document so that you can apply CFilters
-- directly. i is typically (posInNewCxt filename Nothing)
docContent :: i -> Document i -> Content i
-- | If you know that your CFilter returns a tag, you can use this function
-- to get the tagged Element.
contentElem :: Content i -> Element i
attrs :: Element i -> [Attribute]
tagTextContent :: Content i -> [Char]
-- | The class XmlContent is a kind of replacement for Read and
-- Show: it provides conversions between a generic XML tree
-- representation and your own more specialised typeful Haskell data
-- trees.
--
-- If you are starting with a set of Haskell datatypes, use DrIFT to
-- derive instances of this class for you:
-- http://repetae.net/john/computer/haskell/DrIFT If you are starting
-- with an XML DTD, use HaXml's tool DtdToHaskell to generate both the
-- Haskell types and the corresponding instances.
--
-- This unified class interface replaces two previous (somewhat similar)
-- classes: Haskell2Xml and Xml2Haskell. There was no real reason to have
-- separate classes depending on how you originally defined your
-- datatypes. However, some instances for basic types like lists will
-- depend on which direction you are using. See Text.XML.HaXml.XmlContent
-- and Text.XML.HaXml.XmlContent.Haskell.
module Text.XML.HaXml.XmlContent.Parser
-- | The symbol table stored in a document holds all its general entity
-- reference definitions.
data Document i
Document :: Prolog -> (SymTab EntityDef) -> (Element i) -> [Misc] -> Document i
data Element i
Elem :: Name -> [Attribute] -> [Content i] -> Element i
data ElemTag
ElemTag :: Name -> [Attribute] -> ElemTag
data Content i
CElem :: (Element i) -> i -> Content i
-- | bool is whether whitespace is significant
CString :: Bool -> CharData -> i -> Content i
CRef :: Reference -> i -> Content i
CMisc :: Misc -> i -> Content i
type Attribute = (Name, AttValue)
data AttValue
AttValue :: [Either String Reference] -> AttValue
data Prolog
Prolog :: (Maybe XMLDecl) -> [Misc] -> (Maybe DocTypeDecl) -> [Misc] -> Prolog
data Reference
RefEntity :: EntityRef -> Reference
RefChar :: CharRef -> Reference
-- | The XmlContent class promises that an XML Content element can
-- be converted to and from a Haskell value.
class (HTypeable a) => XmlContent a
parseContents :: (XmlContent a) => XMLParser a
toContents :: (XmlContent a) => a -> [Content ()]
xToChar :: (XmlContent a) => a -> Char
xFromChar :: (XmlContent a) => Char -> a
-- | The XmlAttributes class promises that a list of XML tag
-- attributes can be converted to and from a Haskell value.
class XmlAttributes a
fromAttrs :: (XmlAttributes a) => [Attribute] -> a
toAttrs :: (XmlAttributes a) => a -> [Attribute]
-- | The XmlAttrType class promises that an attribute taking an
-- XML enumerated type can be converted to and from a Haskell value.
class XmlAttrType a
fromAttrToTyp :: (XmlAttrType a) => String -> Attribute -> Maybe a
toAttrFrTyp :: (XmlAttrType a) => String -> a -> Maybe Attribute
-- | We need a parsing monad for reading generic XML Content into specific
-- datatypes. This is a specialisation of the Text.ParserCombinators.Poly
-- ones, where the input token type is fixed as XML Content.
type XMLParser a = Parser (Content Posn) a
-- | The most primitive combinator for XMLParser - get one content item.
content :: String -> XMLParser (Content Posn)
-- | A specialisation of posnElementWith (==).
posnElement :: [String] -> XMLParser (Posn, Element Posn)
-- | Get the next content element, checking that it has one of the required
-- tags. (Skips over comments and whitespace, rejects text and refs.)
element :: [String] -> XMLParser (Element Posn)
-- | Run an XMLParser on the contents of the given element (i.e. not on the
-- current monadic content sequence), checking that the contents are
-- exhausted, before returning the calculated value within the current
-- parser context.
interior :: Element Posn -> XMLParser a -> XMLParser a
-- | A combination of element + interior.
inElement :: String -> XMLParser a -> XMLParser a
-- | text is a counterpart to element, parsing text content
-- if it exists. Adjacent text and references are coalesced.
text :: XMLParser String
-- | Do some parsing of the attributes of the given element
attributes :: (XmlAttributes a) => Element Posn -> XMLParser a
-- | Get the next content element, checking that it has one of the required
-- tags, using the given matching function. (Skips over comments and
-- whitespace, rejects text and refs. Also returns position of element.)
posnElementWith :: (String -> String -> Bool) -> [String] -> XMLParser (Posn, Element Posn)
-- | Like element, only permits a more flexible match against the tagname.
elementWith :: (String -> String -> Bool) -> [String] -> XMLParser (Element Posn)
-- | A combination of elementWith + interior.
inElementWith :: (String -> String -> Bool) -> String -> XMLParser a -> XMLParser a
-- | 'choice f p' means if parseContents succeeds, apply f to the result,
-- otherwise use the continuation parser.
choice :: (XmlContent a) => (a -> b) -> XMLParser b -> XMLParser b
-- | not sure this is needed now. 'definite p' previously ensured that an
-- element was definitely present. Now I think the monad might take care
-- of that for us.
definite :: (XmlContent a) => XMLParser a -> String -> String -> XMLParser a
-- | Generate an element with no attributes, named for its HType.
mkElem :: (XmlContent a) => a -> [Content ()] -> Content ()
-- | Generate an element with no attributes, named directly.
mkElemC :: String -> [Content ()] -> Content ()
-- | Generate a single attribute.
mkAttr :: String -> String -> Attribute
-- | Turn a simple string into XML text.
toText :: String -> [Content ()]
-- | Turn a string into an XML CDATA section. (i.e. special characters like
-- & are preserved without interpretation.)
toCData :: String -> [Content ()]
maybeToAttr :: (String -> a -> Maybe Attribute) -> String -> Maybe a -> Maybe Attribute
defaultToAttr :: (String -> a -> Maybe Attribute) -> String -> Defaultable a -> Maybe Attribute
definiteA :: (String -> Attribute -> Maybe a) -> String -> String -> [Attribute] -> a
defaultA :: (String -> Attribute -> Maybe a) -> a -> String -> [Attribute] -> Defaultable a
possibleA :: (String -> Attribute -> Maybe a) -> String -> [Attribute] -> Maybe a
fromAttrToStr :: String -> Attribute -> Maybe String
toAttrFrStr :: String -> String -> Maybe Attribute
-- | If an attribute is defaultable, then it either takes the default value
-- (which is omitted from the output), or a non-default value (which
-- obviously must be printed).
data Defaultable a
Default :: a -> Defaultable a
NonDefault :: a -> Defaultable a
str2attr :: String -> AttValue
attr2str :: AttValue -> String
-- | Read a single attribute called value.
attval :: (Read a) => Element i -> a
-- | The catMaybes function takes a list of Maybes and
-- returns a list of all the Just values.
catMaybes :: [Maybe a] -> [a]
-- | The List1 type represents lists with at least one element. It is
-- required for DTD content models that use + as a modifier.
data List1 a
NonEmpty :: [a] -> List1 a
-- | A type corresponding to XML's ANY contentspec. It is either a list of
-- unconverted xml Content or some XmlContent-able value.
--
-- Parsing functions (e.g. parseContents) will always produce
-- UnConverted. Note: The Show instance for UnConverted
-- uses verbatim.
data ANYContent
ANYContent :: a -> ANYContent
UnConverted :: [Content Posn] -> ANYContent
instance (Eq a) => Eq (List1 a)
instance (Show a) => Show (List1 a)
instance (Eq a) => Eq (Defaultable a)
instance (Show a) => Show (Defaultable a)
instance XmlContent ANYContent
instance HTypeable ANYContent
instance (XmlContent a) => XmlContent (List1 a)
instance (HTypeable a) => HTypeable (List1 a)
instance Eq ANYContent
instance Show ANYContent
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o) => XmlContent (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n) => XmlContent (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m) => XmlContent (a, b, c, d, e, f, g, h, i, j, k, l, m)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l) => XmlContent (a, b, c, d, e, f, g, h, i, j, k, l)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k) => XmlContent (a, b, c, d, e, f, g, h, i, j, k)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j) => XmlContent (a, b, c, d, e, f, g, h, i, j)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i) => XmlContent (a, b, c, d, e, f, g, h, i)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h) => XmlContent (a, b, c, d, e, f, g, h)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g) => XmlContent (a, b, c, d, e, f, g)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f) => XmlContent (a, b, c, d, e, f)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e) => XmlContent (a, b, c, d, e)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d) => XmlContent (a, b, c, d)
instance (XmlContent a, XmlContent b, XmlContent c) => XmlContent (a, b, c)
instance (XmlContent a, XmlContent b) => XmlContent (a, b)
-- | The class XmlContent is a kind of replacement for Read and
-- Show: it provides conversions between a generic XML tree
-- representation and your own more specialised typeful Haskell data
-- trees.
--
-- If you are starting with an XML DTD, use HaXml's tool DtdToHaskell to
-- generate both the Haskell types and the corresponding instances.
--
-- If you are starting with a set of Haskell datatypes, use DrIFT to
-- derive instances of this class for you:
-- http://repetae.net/john/computer/haskell/DrIFT and _do_not_ use the
-- current module, but rather Text.XML.HaXml.XmlContent.Haskell, for the
-- correct matching instances for standard Haskell datatypes.
module Text.XML.HaXml.XmlContent
-- | Convert a fully-typed XML document to a string (with or without DTD).
toXml :: (XmlContent a) => Bool -> a -> Document ()
-- | Read a Haskell value from an XML document, ignoring the DTD and using
-- the Haskell result type to determine how to parse it.
fromXml :: (XmlContent a) => Document Posn -> Either String a
-- | Read a fully-typed XML document from a string.
readXml :: (XmlContent a) => String -> Either String a
-- | Convert a fully-typed XML document to a string (without DTD).
showXml :: (XmlContent a) => Bool -> a -> String
-- | Convert a fully-typed XML document to a ByteString (without DTD).
fpsShowXml :: (XmlContent a) => Bool -> a -> ByteString
-- | Read an XML document from a file and convert it to a fully-typed
-- Haskell value.
fReadXml :: (XmlContent a) => FilePath -> IO a
-- | Write a fully-typed Haskell value to the given file as an XML
-- document.
fWriteXml :: (XmlContent a) => FilePath -> a -> IO ()
-- | Write any Haskell value to the given file as an XML document, using
-- the FastPackedString interface (output will not be prettified).
fpsWriteXml :: (XmlContent a) => FilePath -> a -> IO ()
-- | Read a fully-typed XML document from a file handle.
hGetXml :: (XmlContent a) => Handle -> IO a
-- | Write a fully-typed XML document to a file handle.
hPutXml :: (XmlContent a) => Handle -> Bool -> a -> IO ()
-- | Write a fully-typed XML document to a file handle, using the
-- FastPackedString interface (output will not be prettified).
fpsHPutXml :: (XmlContent a) => Handle -> Bool -> a -> IO ()
instance (XmlContent a) => XmlContent (Maybe a)
instance (XmlContent a) => XmlContent [a]
instance XmlContent Char
-- | Validate a document against a dtd.
module Text.XML.HaXml.Validate
-- | validate takes a DTD and a tagged element, and returns a list
-- of errors in the document with respect to its DTD.
--
-- If you have several documents to validate against a single DTD, then
-- you will gain efficiency by freezing-in the DTD through partial
-- application, e.g. checkMyDTD = validate myDTD.
validate :: DocTypeDecl -> Element i -> [String]
-- | partialValidate is like validate, except that it does not check
-- that the element type matches that of the DTD's root element.
partialValidate :: DocTypeDecl -> Element i -> [String]
module Text.XML.HaXml.OneOfN
data OneOf2 a b
OneOf2 :: a -> OneOf2 a b
TwoOf2 :: b -> OneOf2 a b
data OneOf3 a b c
OneOf3 :: a -> OneOf3 a b c
TwoOf3 :: b -> OneOf3 a b c
ThreeOf3 :: c -> OneOf3 a b c
data OneOf4 a b c d
OneOf4 :: a -> OneOf4 a b c d
TwoOf4 :: b -> OneOf4 a b c d
ThreeOf4 :: c -> OneOf4 a b c d
FourOf4 :: d -> OneOf4 a b c d
data OneOf5 a b c d e
OneOf5 :: a -> OneOf5 a b c d e
TwoOf5 :: b -> OneOf5 a b c d e
ThreeOf5 :: c -> OneOf5 a b c d e
FourOf5 :: d -> OneOf5 a b c d e
FiveOf5 :: e -> OneOf5 a b c d e
data OneOf6 a b c d e f
OneOf6 :: a -> OneOf6 a b c d e f
TwoOf6 :: b -> OneOf6 a b c d e f
ThreeOf6 :: c -> OneOf6 a b c d e f
FourOf6 :: d -> OneOf6 a b c d e f
FiveOf6 :: e -> OneOf6 a b c d e f
SixOf6 :: f -> OneOf6 a b c d e f
data OneOf7 a b c d e f g
OneOf7 :: a -> OneOf7 a b c d e f g
TwoOf7 :: b -> OneOf7 a b c d e f g
ThreeOf7 :: c -> OneOf7 a b c d e f g
FourOf7 :: d -> OneOf7 a b c d e f g
FiveOf7 :: e -> OneOf7 a b c d e f g
SixOf7 :: f -> OneOf7 a b c d e f g
SevenOf7 :: g -> OneOf7 a b c d e f g
data OneOf8 a b c d e f g h
OneOf8 :: a -> OneOf8 a b c d e f g h
TwoOf8 :: b -> OneOf8 a b c d e f g h
ThreeOf8 :: c -> OneOf8 a b c d e f g h
FourOf8 :: d -> OneOf8 a b c d e f g h
FiveOf8 :: e -> OneOf8 a b c d e f g h
SixOf8 :: f -> OneOf8 a b c d e f g h
SevenOf8 :: g -> OneOf8 a b c d e f g h
EightOf8 :: h -> OneOf8 a b c d e f g h
data OneOf9 a b c d e f g h i
OneOf9 :: a -> OneOf9 a b c d e f g h i
TwoOf9 :: b -> OneOf9 a b c d e f g h i
ThreeOf9 :: c -> OneOf9 a b c d e f g h i
FourOf9 :: d -> OneOf9 a b c d e f g h i
FiveOf9 :: e -> OneOf9 a b c d e f g h i
SixOf9 :: f -> OneOf9 a b c d e f g h i
SevenOf9 :: g -> OneOf9 a b c d e f g h i
EightOf9 :: h -> OneOf9 a b c d e f g h i
NineOf9 :: i -> OneOf9 a b c d e f g h i
data OneOf10 a b c d e f g h i j
OneOf10 :: a -> OneOf10 a b c d e f g h i j
TwoOf10 :: b -> OneOf10 a b c d e f g h i j
ThreeOf10 :: c -> OneOf10 a b c d e f g h i j
FourOf10 :: d -> OneOf10 a b c d e f g h i j
FiveOf10 :: e -> OneOf10 a b c d e f g h i j
SixOf10 :: f -> OneOf10 a b c d e f g h i j
SevenOf10 :: g -> OneOf10 a b c d e f g h i j
EightOf10 :: h -> OneOf10 a b c d e f g h i j
NineOf10 :: i -> OneOf10 a b c d e f g h i j
TenOf10 :: j -> OneOf10 a b c d e f g h i j
data OneOf11 a b c d e f g h i j k
OneOf11 :: a -> OneOf11 a b c d e f g h i j k
TwoOf11 :: b -> OneOf11 a b c d e f g h i j k
ThreeOf11 :: c -> OneOf11 a b c d e f g h i j k
FourOf11 :: d -> OneOf11 a b c d e f g h i j k
FiveOf11 :: e -> OneOf11 a b c d e f g h i j k
SixOf11 :: f -> OneOf11 a b c d e f g h i j k
SevenOf11 :: g -> OneOf11 a b c d e f g h i j k
EightOf11 :: h -> OneOf11 a b c d e f g h i j k
NineOf11 :: i -> OneOf11 a b c d e f g h i j k
TenOf11 :: j -> OneOf11 a b c d e f g h i j k
ElevenOf11 :: k -> OneOf11 a b c d e f g h i j k
data OneOf12 a b c d e f g h i j k l
OneOf12 :: a -> OneOf12 a b c d e f g h i j k l
TwoOf12 :: b -> OneOf12 a b c d e f g h i j k l
ThreeOf12 :: c -> OneOf12 a b c d e f g h i j k l
FourOf12 :: d -> OneOf12 a b c d e f g h i j k l
FiveOf12 :: e -> OneOf12 a b c d e f g h i j k l
SixOf12 :: f -> OneOf12 a b c d e f g h i j k l
SevenOf12 :: g -> OneOf12 a b c d e f g h i j k l
EightOf12 :: h -> OneOf12 a b c d e f g h i j k l
NineOf12 :: i -> OneOf12 a b c d e f g h i j k l
TenOf12 :: j -> OneOf12 a b c d e f g h i j k l
ElevenOf12 :: k -> OneOf12 a b c d e f g h i j k l
TwelveOf12 :: l -> OneOf12 a b c d e f g h i j k l
data OneOf13 a b c d e f g h i j k l m
OneOf13 :: a -> OneOf13 a b c d e f g h i j k l m
TwoOf13 :: b -> OneOf13 a b c d e f g h i j k l m
ThreeOf13 :: c -> OneOf13 a b c d e f g h i j k l m
FourOf13 :: d -> OneOf13 a b c d e f g h i j k l m
FiveOf13 :: e -> OneOf13 a b c d e f g h i j k l m
SixOf13 :: f -> OneOf13 a b c d e f g h i j k l m
SevenOf13 :: g -> OneOf13 a b c d e f g h i j k l m
EightOf13 :: h -> OneOf13 a b c d e f g h i j k l m
NineOf13 :: i -> OneOf13 a b c d e f g h i j k l m
TenOf13 :: j -> OneOf13 a b c d e f g h i j k l m
ElevenOf13 :: k -> OneOf13 a b c d e f g h i j k l m
TwelveOf13 :: l -> OneOf13 a b c d e f g h i j k l m
ThirteenOf13 :: m -> OneOf13 a b c d e f g h i j k l m
data OneOf14 a b c d e f g h i j k l m n
OneOf14 :: a -> OneOf14 a b c d e f g h i j k l m n
TwoOf14 :: b -> OneOf14 a b c d e f g h i j k l m n
ThreeOf14 :: c -> OneOf14 a b c d e f g h i j k l m n
FourOf14 :: d -> OneOf14 a b c d e f g h i j k l m n
FiveOf14 :: e -> OneOf14 a b c d e f g h i j k l m n
SixOf14 :: f -> OneOf14 a b c d e f g h i j k l m n
SevenOf14 :: g -> OneOf14 a b c d e f g h i j k l m n
EightOf14 :: h -> OneOf14 a b c d e f g h i j k l m n
NineOf14 :: i -> OneOf14 a b c d e f g h i j k l m n
TenOf14 :: j -> OneOf14 a b c d e f g h i j k l m n
ElevenOf14 :: k -> OneOf14 a b c d e f g h i j k l m n
TwelveOf14 :: l -> OneOf14 a b c d e f g h i j k l m n
ThirteenOf14 :: m -> OneOf14 a b c d e f g h i j k l m n
FourteenOf14 :: n -> OneOf14 a b c d e f g h i j k l m n
data OneOf15 a b c d e f g h i j k l m n o
OneOf15 :: a -> OneOf15 a b c d e f g h i j k l m n o
TwoOf15 :: b -> OneOf15 a b c d e f g h i j k l m n o
ThreeOf15 :: c -> OneOf15 a b c d e f g h i j k l m n o
FourOf15 :: d -> OneOf15 a b c d e f g h i j k l m n o
FiveOf15 :: e -> OneOf15 a b c d e f g h i j k l m n o
SixOf15 :: f -> OneOf15 a b c d e f g h i j k l m n o
SevenOf15 :: g -> OneOf15 a b c d e f g h i j k l m n o
EightOf15 :: h -> OneOf15 a b c d e f g h i j k l m n o
NineOf15 :: i -> OneOf15 a b c d e f g h i j k l m n o
TenOf15 :: j -> OneOf15 a b c d e f g h i j k l m n o
ElevenOf15 :: k -> OneOf15 a b c d e f g h i j k l m n o
TwelveOf15 :: l -> OneOf15 a b c d e f g h i j k l m n o
ThirteenOf15 :: m -> OneOf15 a b c d e f g h i j k l m n o
FourteenOf15 :: n -> OneOf15 a b c d e f g h i j k l m n o
FifteenOf15 :: o -> OneOf15 a b c d e f g h i j k l m n o
data OneOf16 a b c d e f g h i j k l m n o p
OneOf16 :: a -> OneOf16 a b c d e f g h i j k l m n o p
TwoOf16 :: b -> OneOf16 a b c d e f g h i j k l m n o p
ThreeOf16 :: c -> OneOf16 a b c d e f g h i j k l m n o p
FourOf16 :: d -> OneOf16 a b c d e f g h i j k l m n o p
FiveOf16 :: e -> OneOf16 a b c d e f g h i j k l m n o p
SixOf16 :: f -> OneOf16 a b c d e f g h i j k l m n o p
SevenOf16 :: g -> OneOf16 a b c d e f g h i j k l m n o p
EightOf16 :: h -> OneOf16 a b c d e f g h i j k l m n o p
NineOf16 :: i -> OneOf16 a b c d e f g h i j k l m n o p
TenOf16 :: j -> OneOf16 a b c d e f g h i j k l m n o p
ElevenOf16 :: k -> OneOf16 a b c d e f g h i j k l m n o p
TwelveOf16 :: l -> OneOf16 a b c d e f g h i j k l m n o p
ThirteenOf16 :: m -> OneOf16 a b c d e f g h i j k l m n o p
FourteenOf16 :: n -> OneOf16 a b c d e f g h i j k l m n o p
FifteenOf16 :: o -> OneOf16 a b c d e f g h i j k l m n o p
SixteenOf16 :: p -> OneOf16 a b c d e f g h i j k l m n o p
data OneOf17 a b c d e f g h i j k l m n o p q
OneOf17 :: a -> OneOf17 a b c d e f g h i j k l m n o p q
TwoOf17 :: b -> OneOf17 a b c d e f g h i j k l m n o p q
ThreeOf17 :: c -> OneOf17 a b c d e f g h i j k l m n o p q
FourOf17 :: d -> OneOf17 a b c d e f g h i j k l m n o p q
FiveOf17 :: e -> OneOf17 a b c d e f g h i j k l m n o p q
SixOf17 :: f -> OneOf17 a b c d e f g h i j k l m n o p q
SevenOf17 :: g -> OneOf17 a b c d e f g h i j k l m n o p q
EightOf17 :: h -> OneOf17 a b c d e f g h i j k l m n o p q
NineOf17 :: i -> OneOf17 a b c d e f g h i j k l m n o p q
TenOf17 :: j -> OneOf17 a b c d e f g h i j k l m n o p q
ElevenOf17 :: k -> OneOf17 a b c d e f g h i j k l m n o p q
TwelveOf17 :: l -> OneOf17 a b c d e f g h i j k l m n o p q
ThirteenOf17 :: m -> OneOf17 a b c d e f g h i j k l m n o p q
FourteenOf17 :: n -> OneOf17 a b c d e f g h i j k l m n o p q
FifteenOf17 :: o -> OneOf17 a b c d e f g h i j k l m n o p q
SixteenOf17 :: p -> OneOf17 a b c d e f g h i j k l m n o p q
SeventeenOf17 :: q -> OneOf17 a b c d e f g h i j k l m n o p q
data OneOf18 a b c d e f g h i j k l m n o p q r
OneOf18 :: a -> OneOf18 a b c d e f g h i j k l m n o p q r
TwoOf18 :: b -> OneOf18 a b c d e f g h i j k l m n o p q r
ThreeOf18 :: c -> OneOf18 a b c d e f g h i j k l m n o p q r
FourOf18 :: d -> OneOf18 a b c d e f g h i j k l m n o p q r
FiveOf18 :: e -> OneOf18 a b c d e f g h i j k l m n o p q r
SixOf18 :: f -> OneOf18 a b c d e f g h i j k l m n o p q r
SevenOf18 :: g -> OneOf18 a b c d e f g h i j k l m n o p q r
EightOf18 :: h -> OneOf18 a b c d e f g h i j k l m n o p q r
NineOf18 :: i -> OneOf18 a b c d e f g h i j k l m n o p q r
TenOf18 :: j -> OneOf18 a b c d e f g h i j k l m n o p q r
ElevenOf18 :: k -> OneOf18 a b c d e f g h i j k l m n o p q r
TwelveOf18 :: l -> OneOf18 a b c d e f g h i j k l m n o p q r
ThirteenOf18 :: m -> OneOf18 a b c d e f g h i j k l m n o p q r
FourteenOf18 :: n -> OneOf18 a b c d e f g h i j k l m n o p q r
FifteenOf18 :: o -> OneOf18 a b c d e f g h i j k l m n o p q r
SixteenOf18 :: p -> OneOf18 a b c d e f g h i j k l m n o p q r
SeventeenOf18 :: q -> OneOf18 a b c d e f g h i j k l m n o p q r
EighteenOf18 :: r -> OneOf18 a b c d e f g h i j k l m n o p q r
data OneOf19 a b c d e f g h i j k l m n o p q r s
OneOf19 :: a -> OneOf19 a b c d e f g h i j k l m n o p q r s
TwoOf19 :: b -> OneOf19 a b c d e f g h i j k l m n o p q r s
ThreeOf19 :: c -> OneOf19 a b c d e f g h i j k l m n o p q r s
FourOf19 :: d -> OneOf19 a b c d e f g h i j k l m n o p q r s
FiveOf19 :: e -> OneOf19 a b c d e f g h i j k l m n o p q r s
SixOf19 :: f -> OneOf19 a b c d e f g h i j k l m n o p q r s
SevenOf19 :: g -> OneOf19 a b c d e f g h i j k l m n o p q r s
EightOf19 :: h -> OneOf19 a b c d e f g h i j k l m n o p q r s
NineOf19 :: i -> OneOf19 a b c d e f g h i j k l m n o p q r s
TenOf19 :: j -> OneOf19 a b c d e f g h i j k l m n o p q r s
ElevenOf19 :: k -> OneOf19 a b c d e f g h i j k l m n o p q r s
TwelveOf19 :: l -> OneOf19 a b c d e f g h i j k l m n o p q r s
ThirteenOf19 :: m -> OneOf19 a b c d e f g h i j k l m n o p q r s
FourteenOf19 :: n -> OneOf19 a b c d e f g h i j k l m n o p q r s
FifteenOf19 :: o -> OneOf19 a b c d e f g h i j k l m n o p q r s
SixteenOf19 :: p -> OneOf19 a b c d e f g h i j k l m n o p q r s
SeventeenOf19 :: q -> OneOf19 a b c d e f g h i j k l m n o p q r s
EighteenOf19 :: r -> OneOf19 a b c d e f g h i j k l m n o p q r s
NineteenOf19 :: s -> OneOf19 a b c d e f g h i j k l m n o p q r s
data OneOf20 a b c d e f g h i j k l m n o p q r s t
OneOf20 :: a -> OneOf20 a b c d e f g h i j k l m n o p q r s t
TwoOf20 :: b -> OneOf20 a b c d e f g h i j k l m n o p q r s t
ThreeOf20 :: c -> OneOf20 a b c d e f g h i j k l m n o p q r s t
FourOf20 :: d -> OneOf20 a b c d e f g h i j k l m n o p q r s t
FiveOf20 :: e -> OneOf20 a b c d e f g h i j k l m n o p q r s t
SixOf20 :: f -> OneOf20 a b c d e f g h i j k l m n o p q r s t
SevenOf20 :: g -> OneOf20 a b c d e f g h i j k l m n o p q r s t
EightOf20 :: h -> OneOf20 a b c d e f g h i j k l m n o p q r s t
NineOf20 :: i -> OneOf20 a b c d e f g h i j k l m n o p q r s t
TenOf20 :: j -> OneOf20 a b c d e f g h i j k l m n o p q r s t
ElevenOf20 :: k -> OneOf20 a b c d e f g h i j k l m n o p q r s t
TwelveOf20 :: l -> OneOf20 a b c d e f g h i j k l m n o p q r s t
ThirteenOf20 :: m -> OneOf20 a b c d e f g h i j k l m n o p q r s t
FourteenOf20 :: n -> OneOf20 a b c d e f g h i j k l m n o p q r s t
FifteenOf20 :: o -> OneOf20 a b c d e f g h i j k l m n o p q r s t
SixteenOf20 :: p -> OneOf20 a b c d e f g h i j k l m n o p q r s t
SeventeenOf20 :: q -> OneOf20 a b c d e f g h i j k l m n o p q r s t
EighteenOf20 :: r -> OneOf20 a b c d e f g h i j k l m n o p q r s t
NineteenOf20 :: s -> OneOf20 a b c d e f g h i j k l m n o p q r s t
TwentyOf20 :: t -> OneOf20 a b c d e f g h i j k l m n o p q r s t
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o, Eq p, Eq q, Eq r, Eq s, Eq t) => Eq (OneOf20 a b c d e f g h i j k l m n o p q r s t)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q, Show r, Show s, Show t) => Show (OneOf20 a b c d e f g h i j k l m n o p q r s t)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o, Eq p, Eq q, Eq r, Eq s) => Eq (OneOf19 a b c d e f g h i j k l m n o p q r s)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q, Show r, Show s) => Show (OneOf19 a b c d e f g h i j k l m n o p q r s)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o, Eq p, Eq q, Eq r) => Eq (OneOf18 a b c d e f g h i j k l m n o p q r)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q, Show r) => Show (OneOf18 a b c d e f g h i j k l m n o p q r)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o, Eq p, Eq q) => Eq (OneOf17 a b c d e f g h i j k l m n o p q)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q) => Show (OneOf17 a b c d e f g h i j k l m n o p q)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o, Eq p) => Eq (OneOf16 a b c d e f g h i j k l m n o p)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p) => Show (OneOf16 a b c d e f g h i j k l m n o p)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (OneOf15 a b c d e f g h i j k l m n o)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (OneOf15 a b c d e f g h i j k l m n o)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (OneOf14 a b c d e f g h i j k l m n)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (OneOf14 a b c d e f g h i j k l m n)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (OneOf13 a b c d e f g h i j k l m)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (OneOf13 a b c d e f g h i j k l m)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (OneOf12 a b c d e f g h i j k l)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (OneOf12 a b c d e f g h i j k l)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (OneOf11 a b c d e f g h i j k)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (OneOf11 a b c d e f g h i j k)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (OneOf10 a b c d e f g h i j)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (OneOf10 a b c d e f g h i j)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (OneOf9 a b c d e f g h i)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (OneOf9 a b c d e f g h i)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (OneOf8 a b c d e f g h)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (OneOf8 a b c d e f g h)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (OneOf7 a b c d e f g)
instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (OneOf7 a b c d e f g)
instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (OneOf6 a b c d e f)
instance (Show a, Show b, Show c, Show d, Show e, Show f) => Show (OneOf6 a b c d e f)
instance (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (OneOf5 a b c d e)
instance (Show a, Show b, Show c, Show d, Show e) => Show (OneOf5 a b c d e)
instance (Eq a, Eq b, Eq c, Eq d) => Eq (OneOf4 a b c d)
instance (Show a, Show b, Show c, Show d) => Show (OneOf4 a b c d)
instance (Eq a, Eq b, Eq c) => Eq (OneOf3 a b c)
instance (Show a, Show b, Show c) => Show (OneOf3 a b c)
instance (Eq a, Eq b) => Eq (OneOf2 a b)
instance (Show a, Show b) => Show (OneOf2 a b)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r, XmlContent s, XmlContent t) => XmlContent (OneOf20 a b c d e f g h i j k l m n o p q r s t)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q, HTypeable r, HTypeable s, HTypeable t) => HTypeable (OneOf20 a b c d e f g h i j k l m n o p q r s t)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r, XmlContent s) => XmlContent (OneOf19 a b c d e f g h i j k l m n o p q r s)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q, HTypeable r, HTypeable s) => HTypeable (OneOf19 a b c d e f g h i j k l m n o p q r s)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q, XmlContent r) => XmlContent (OneOf18 a b c d e f g h i j k l m n o p q r)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q, HTypeable r) => HTypeable (OneOf18 a b c d e f g h i j k l m n o p q r)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p, XmlContent q) => XmlContent (OneOf17 a b c d e f g h i j k l m n o p q)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q) => HTypeable (OneOf17 a b c d e f g h i j k l m n o p q)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o, XmlContent p) => XmlContent (OneOf16 a b c d e f g h i j k l m n o p)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p) => HTypeable (OneOf16 a b c d e f g h i j k l m n o p)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n, XmlContent o) => XmlContent (OneOf15 a b c d e f g h i j k l m n o)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o) => HTypeable (OneOf15 a b c d e f g h i j k l m n o)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m, XmlContent n) => XmlContent (OneOf14 a b c d e f g h i j k l m n)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n) => HTypeable (OneOf14 a b c d e f g h i j k l m n)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l, XmlContent m) => XmlContent (OneOf13 a b c d e f g h i j k l m)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m) => HTypeable (OneOf13 a b c d e f g h i j k l m)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k, XmlContent l) => XmlContent (OneOf12 a b c d e f g h i j k l)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l) => HTypeable (OneOf12 a b c d e f g h i j k l)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j, XmlContent k) => XmlContent (OneOf11 a b c d e f g h i j k)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k) => HTypeable (OneOf11 a b c d e f g h i j k)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i, XmlContent j) => XmlContent (OneOf10 a b c d e f g h i j)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j) => HTypeable (OneOf10 a b c d e f g h i j)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h, XmlContent i) => XmlContent (OneOf9 a b c d e f g h i)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i) => HTypeable (OneOf9 a b c d e f g h i)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g, XmlContent h) => XmlContent (OneOf8 a b c d e f g h)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h) => HTypeable (OneOf8 a b c d e f g h)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f, XmlContent g) => XmlContent (OneOf7 a b c d e f g)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g) => HTypeable (OneOf7 a b c d e f g)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e, XmlContent f) => XmlContent (OneOf6 a b c d e f)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f) => HTypeable (OneOf6 a b c d e f)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d, XmlContent e) => XmlContent (OneOf5 a b c d e)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e) => HTypeable (OneOf5 a b c d e)
instance (XmlContent a, XmlContent b, XmlContent c, XmlContent d) => XmlContent (OneOf4 a b c d)
instance (HTypeable a, HTypeable b, HTypeable c, HTypeable d) => HTypeable (OneOf4 a b c d)
instance (XmlContent a, XmlContent b, XmlContent c) => XmlContent (OneOf3 a b c)
instance (HTypeable a, HTypeable b, HTypeable c) => HTypeable (OneOf3 a b c)
instance (XmlContent a, XmlContent b) => XmlContent (OneOf2 a b)
instance (HTypeable a, HTypeable b) => HTypeable (OneOf2 a b)
module Text.XML.HaXml.ShowXmlLazy
-- | Convert a fully-typed XML document to a string (without DTD).
showXmlLazy :: (XmlContent a) => Bool -> a -> String
-- | The class XmlContent is a kind of replacement for Read and
-- Show: it provides conversions between a generic XML tree
-- representation and your own more specialised typeful Haskell data
-- trees.
--
-- If you are starting with a set of Haskell datatypes, use DrIFT to
-- derive instances of this class for you:
-- http://repetae.net/john/computer/haskell/DrIFT and use the current
-- module for instances of the standard Haskell datatypes list, Maybe,
-- and so on.
--
-- If you are starting with an XML DTD, use HaXml's tool DtdToHaskell to
-- generate both the Haskell types and the corresponding instances, but
-- _do_not_ use the current module for instances: use
-- Text.XML.HaXml.XmlContent instead.
module Text.XML.HaXml.XmlContent.Haskell
-- | Convert a fully-typed XML document to a string (with or without DTD).
toXml :: (XmlContent a) => Bool -> a -> Document ()
-- | Read a Haskell value from an XML document, ignoring the DTD and using
-- the Haskell result type to determine how to parse it.
fromXml :: (XmlContent a) => Document Posn -> Either String a
-- | Read a fully-typed XML document from a string.
readXml :: (XmlContent a) => String -> Either String a
-- | Convert a fully-typed XML document to a string (without DTD).
showXml :: (XmlContent a) => Bool -> a -> String
-- | Convert a fully-typed XML document to a ByteString (without DTD).
fpsShowXml :: (XmlContent a) => Bool -> a -> ByteString
-- | Read an XML document from a file and convert it to a fully-typed
-- Haskell value.
fReadXml :: (XmlContent a) => FilePath -> IO a
-- | Write a fully-typed Haskell value to the given file as an XML
-- document.
fWriteXml :: (XmlContent a) => FilePath -> a -> IO ()
-- | Write any Haskell value to the given file as an XML document, using
-- the FastPackedString interface (output will not be prettified).
fpsWriteXml :: (XmlContent a) => FilePath -> a -> IO ()
-- | Read a fully-typed XML document from a file handle.
hGetXml :: (XmlContent a) => Handle -> IO a
-- | Write a fully-typed XML document to a file handle.
hPutXml :: (XmlContent a) => Handle -> Bool -> a -> IO ()
-- | Write a fully-typed XML document to a file handle, using the
-- FastPackedString interface (output will not be prettified).
fpsHPutXml :: (XmlContent a) => Handle -> Bool -> a -> IO ()
instance (XmlContent a, XmlContent b) => XmlContent (Either a b)
instance (XmlContent a) => XmlContent (Maybe a)
instance XmlContent ()
instance (XmlContent a) => XmlContent [a]
instance XmlContent Char
instance XmlContent Double
instance XmlContent Float
instance XmlContent Integer
instance XmlContent Int
instance XmlContent Bool
-- | This is a new set of XML combinators for Xtract, not standard, but
-- based on the standard set in Text.Xml.Haxml.Combinators. The
-- main difference is that the Content Filter type becomes a Double
-- Filter. A Double Filter always takes the whole document as an extra
-- argument, so you can start to traverse it again from the root, when at
-- any inner location within the document tree.
--
-- The new combinator definitions are derived from the old ones. The same
-- names have the equivalent meaning - use module qualification on
-- imports to distinguish between CFilter and DFilter variations.
module Text.XML.HaXml.Xtract.Combinators
-- | double content filter - takes document root + local subtree.
type DFilter i = Content i -> Content i -> [Content i]
-- | lift an ordinary content filter to a double filter.
global :: CFilter i -> DFilter i
local :: CFilter i -> DFilter i
-- | drop a double filter to an ordinary content filter. (permitting
-- interior access to document root)
dfilter :: DFilter i -> CFilter i
-- | drop a double filter to an ordinary content filter. (Where interior
-- access to the document root is not needed, the retaining pointer to
-- the outer element can be pruned away. cfilter is more
-- space-efficient than dfilter in this situation.)
cfilter :: DFilter i -> CFilter i
-- | lift a CFilter combinator to a DFilter combinator
liftGlobal :: (CFilter i -> CFilter i) -> (DFilter i -> DFilter i)
liftLocal :: (CFilter i -> CFilter i) -> (DFilter i -> DFilter i)
-- | lifted composition over double filters.
o :: DFilter i -> DFilter i -> DFilter i
-- | lifted choice.
(|>|) :: (a -> b -> [c]) -> (a -> b -> [c]) -> (a -> b -> [c])
-- | lifted union.
union :: (a -> b -> [c]) -> (a -> b -> [c]) -> (a -> b -> [c])
-- | lifted predicates.
without :: DFilter i -> DFilter i -> DFilter i
with :: DFilter i -> DFilter i -> DFilter i
-- | lifted unit and zero.
none :: DFilter i
keep :: DFilter i
elm :: DFilter i
txt :: DFilter i
children :: DFilter i
applypred :: CFilter i -> DFilter i -> CFilter i
iffind :: String -> (String -> DFilter i) -> DFilter i -> DFilter i
ifTxt :: (String -> DFilter i) -> DFilter i -> DFilter i
cat :: [a -> b -> [c]] -> (a -> b -> [c])
(/>) :: DFilter i -> DFilter i -> DFilter i
() :: DFilter i -> DFilter i -> DFilter i
deepest :: DFilter i -> DFilter i
multi :: DFilter i -> DFilter i
deep :: DFilter i -> DFilter i
-- | A parser for the Xtract command-language. (The string input is
-- tokenised internally by the lexer lexXtract.) See
-- http://www.haskell.org/HaXml/Xtract.html for the grammar that
-- is accepted.
module Text.XML.HaXml.Xtract.Parse
-- | The cool thing is that the Xtract command parser directly builds a
-- higher-order DFilter (see
-- Text.XML.HaXml.Xtract.Combinators) which can be applied to an
-- XML document without further ado. (parseXtract halts the
-- program if a parse error is found.)
parseXtract :: [Token] -> DFilter i
-- | To convert an Xtract query into an ordinary HaXml combinator
-- expression. First arg is a tag-transformation function (e.g. map
-- toLower) applied
xtract :: (String -> String) -> String -> CFilter i
-- | This is just a convenient way of bunching the XML combinators together
-- with some other things you are likely to want at the same time.
module Text.XML.HaXml
-- | Renders the document as a string using the default style.
render :: Doc -> String
-- | The version of the library.
version :: String