HXQ-0.14.0: A Compiler from XQuery to HaskellSource codeContentsIndex
Text.XML.HXQ.XQuery
Contents
The XML Data Representation
The XQuery Compiler
The XQuery Interpreter
The XQuery Compiler with Database Connectivity
The XQuery Interpreter with Database Connectivity
Shredding and Publishing XML Documents Using a Relational Database
Other Functions
Description
HXQ is a fast and space-efficient compiler from XQuery (the standard query language for XML) to embedded Haskell code. The translation is based on Haskell templates. It also provides an interpreter for evaluating ad-hoc XQueries read from input or from files and optional database connectivity using HDBC. For more information, look at http://lambda.uta.edu/HXQ/.
Synopsis
data XTree
= XElem !Tag !AttList !Int XTree [XTree]
| XText !String
| XInt !Int
| XFloat !Float
| XBool !Bool
| XPI Tag String
| XGERef Tag
| XComment String
| XError String
| XNull
| XNoPad
type XSeq = [XTree]
type Tag = String
type AttList = [(Name, String)]
putXSeq :: XSeq -> IO ()
xq :: String -> Q Exp
xe :: String -> Q Exp
xquery :: String -> IO XSeq
xqdb :: String -> Q Exp
xqueryDB :: String -> Connection -> IO XSeq
genSchema :: Connection -> String -> String -> IO Table
shred :: Connection -> String -> String -> IO ()
shredC :: String -> String -> String -> Q Exp
printSchema :: Connection -> String -> IO ()
createIndex :: Connection -> String -> String -> IO ()
data XMLEvent
= StartEvent Name [(Name, String)]
| EmptyEvent Name [(Name, String)]
| EndEvent Name
| TextEvent String
| PIEvent Name String
| GERefEvent Name
| CommentEvent String
| ErrorEvent String
connect :: FilePath -> IO Connection
disconnect :: Connection -> IO ()
commit :: Connection -> IO ()
rollback :: Connection -> IO ()
prepareSQL :: Connection -> String -> IO Statement
executeSQL :: Statement -> XSeq -> IO XSeq
qx
The XML Data Representation
data XTree Source
A rose tree representation of XML data. An XML element is: XElem tagname atributes preorder parent children. The preorder numbering is the document order of elements. The parent is a cyclic reference to the parent element.
Constructors
XElem !Tag !AttList !Int XTree [XTree]an XML tree node (element)
XText !Stringan XML tree leaf (PCDATA)
XInt !Intan XML tree leaf (int)
XFloat !Floatan XML tree leaf (float)
XBool !Boolan XML tree leaf (boolean)
XPI Tag Stringprocessing instruction
XGERef Taggeneral entity reference
XComment Stringcomment
XError Stringerror report
XNullnull value
XNoPadmarker for no padding in XSeq
show/hide Instances
type XSeq = [XTree]Source
type Tag = StringSource
type AttList = [(Name, String)]Source
putXSeq :: XSeq -> IO ()Source
Print the XQuery result (which is a sequence of XML fragments) without buffering.
The XQuery Compiler
xq :: String -> Q ExpSource
Run an XQuery that may read XML documents. When evaluated, it returns IO XSeq.
xe :: String -> Q ExpSource
Run an XQuery expression that does not perform IO. When evaluated, it returns XSeq.
The XQuery Interpreter
xquery :: String -> IO XSeqSource
Evaluate the XQuery using the interpreter.
The XQuery Compiler with Database Connectivity
xqdb :: String -> Q ExpSource
Run an XQuery that reads XML documents and queries databases. When evaluated, it returns Connection -> IO XSeq.
The XQuery Interpreter with Database Connectivity
xqueryDB :: String -> Connection -> IO XSeqSource
Evaluate the XQuery with database connectivity using the interpreter.
Shredding and Publishing XML Documents Using a Relational Database
genSchema :: Connection -> String -> String -> IO TableSource
Create a schema for an XML document into the database under the given name.
shred :: Connection -> String -> String -> IO ()Source
Store an XML document into the database under the given name.
shredC :: String -> String -> String -> Q ExpSource
Store an XML document into the database under the given name. Generates Haskell code.
printSchema :: Connection -> String -> IO ()Source
Print the relational schema of the XML document stored in the database under the given name
createIndex :: Connection -> String -> String -> IO ()Source
Create a secondary index on tagname for the shredded document under the given name..
Other Functions
data XMLEvent Source
Constructors
StartEvent Name [(Name, String)]
EmptyEvent Name [(Name, String)]
EndEvent Name
TextEvent String
PIEvent Name String
GERefEvent Name
CommentEvent String
ErrorEvent String
show/hide Instances
connect :: FilePath -> IO ConnectionSource
Connect to the relational database in filepath
disconnect :: Connection -> IO ()Source
Disconnect from the relational database
commit :: Connection -> IO ()Source
commit the updates to the database
rollback :: Connection -> IO ()Source
rollback the updates from the database
prepareSQL :: Connection -> String -> IO StatementSource
executeSQL :: Statement -> XSeq -> IO XSeqSource
qx
Produced by Haddock version 2.4.2