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/.
- data XTree
- 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
- xfile :: String -> IO XSeq
- xqdb :: String -> Q Exp
- connect :: FilePath -> IO Connection
- disconnect :: conn -> IO ()
- xqueryDB :: IConnection conn => String -> conn -> IO XSeq
- xfileDB :: IConnection conn => String -> conn -> IO XSeq
- genSchema :: IConnection conn => conn -> String -> String -> IO Table
- shred :: IConnection conn => conn -> String -> String -> IO ()
- shredC :: String -> String -> String -> Q Exp
- printSchema :: IConnection conn => conn -> String -> IO ()
- createIndex :: IConnection conn => conn -> 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
- prepareSQL :: IConnection conn => conn -> String -> IO Statement
- executeSQL :: Statement -> XSeq -> IO XSeq
The XML Data Representation
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.
XElem !Tag !AttList !Int XTree [XTree] | an XML tree node (element) |
XText !String | an XML tree leaf (PCDATA) |
XInt !Int | an XML tree leaf (int) |
XFloat !Float | an XML tree leaf (float) |
XBool !Bool | an XML tree leaf (boolean) |
XPI Tag String | processing instruction |
XGERef Tag | general entity reference |
XComment String | comment |
XError String | error report |
XNoPad | marker for no padding in XSeq |
putXSeq :: XSeq -> IO ()Source
Print the XQuery result (which is a sequence of XML fragments) without buffering.
The XQuery Compiler
Run an XQuery that may read XML documents. When evaluated, it returns IO XSeq.
Run an XQuery expression that does not perform IO. When evaluated, it returns XSeq.
The XQuery Interpreter
The XQuery Compiler with Database Connectivity
Run an XQuery that reads XML documents and queries databases. When evaluated, it returns (IConnection conn) => conn -> IO XSeq.
disconnect :: conn -> IO ()Source
The XQuery Interpreter with Database Connectivity
xqueryDB :: IConnection conn => String -> conn -> IO XSeqSource
Evaluate the XQuery with database connectivity using the interpreter.
xfileDB :: IConnection conn => String -> conn -> IO XSeqSource
Read an XQuery with database connectivity from a file and run it using the interpreter.
Shredding and Publishing XML Documents Using a Relational Database
genSchema :: IConnection conn => conn -> String -> String -> IO TableSource
Create a schema for an XML document into the database under the given name.
shred :: IConnection conn => conn -> 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 :: IConnection conn => conn -> String -> IO ()Source
Print the relational schema of the XML document stored in the database under the given name
createIndex :: IConnection conn => conn -> String -> String -> IO ()Source
Create a secondary index on tagname for the shredded document under the given name..
Other functions
StartEvent Name [(Name, String)] | |
EmptyEvent Name [(Name, String)] | |
EndEvent Name | |
TextEvent String | |
PIEvent Name String | |
GERefEvent Name | |
CommentEvent String | |
ErrorEvent String |
prepareSQL :: IConnection conn => conn -> String -> IO StatementSource
executeSQL :: Statement -> XSeq -> IO XSeqSource