hxt-9.1.6: A collection of tools for processing XML with Haskell.

Portability | portable
Stability | stable
Maintainer | Uwe Schmidt (uwe@fh-wedel.de)

Text.XML.HXT.Arrow.XmlState.URIHandling

Description

the basic state arrows for URI handling

Synopsis

- setBaseURI :: IOStateArrow s String String
- getBaseURI :: IOStateArrow s b String
- changeBaseURI :: IOStateArrow s String String
- setDefaultBaseURI :: String -> IOStateArrow s b String
- getDefaultBaseURI :: IOStateArrow s b String
- runInLocalURIContext :: IOStateArrow s b c -> IOStateArrow s b c
- parseURIReference' :: String -> Maybe URI
- expandURIString :: String -> String -> Maybe String
- expandURI :: ArrowXml a => a (String, String) String
- mkAbsURI :: IOStateArrow s String String
- getSchemeFromURI :: ArrowList a => a String String
- getRegNameFromURI :: ArrowList a => a String String
- getPortFromURI :: ArrowList a => a String String
- getUserInfoFromURI :: ArrowList a => a String String
- getPathFromURI :: ArrowList a => a String String
- getQueryFromURI :: ArrowList a => a String String
- getFragmentFromURI :: ArrowList a => a String String
- getPartFromURI :: ArrowList a => (URI -> String) -> a String String

# Documentation

setBaseURI :: IOStateArrow s String String

set the base URI of a document, used e.g. for reading includes, e.g. external entities, the input must be an absolute URI

getBaseURI :: IOStateArrow s b String

read the base URI from the globale state

changeBaseURI :: IOStateArrow s String String

change the base URI with a possibly relative URI, can be used for evaluating the xml:base attribute. Returns the new absolute base URI. Fails, if input is not parsable with parseURIReference

see also: `setBaseURI`, `mkAbsURI`

setDefaultBaseURI :: String -> IOStateArrow s b String

set the default base URI, if parameter is null, the system base (`file:///<cwd>/` ) is used, else the parameter, must be called before any document is read

getDefaultBaseURI :: IOStateArrow s b String

get the default base URI

runInLocalURIContext :: IOStateArrow s b c -> IOStateArrow s b c

remember base uri, run an arrow and restore the base URI, used with external entity substitution

parseURIReference' :: String -> Maybe URI

parse a URI reference, in case of a failure, try to escape unescaped chars, convert backslashes to slashes for windows paths, and try parsing again

expandURIString :: String -> String -> Maybe String

compute the absolut URI for a given URI and a base URI

expandURI :: ArrowXml a => a (String, String) String

arrow variant of `expandURIString`, fails if `expandURIString` returns Nothing

mkAbsURI :: IOStateArrow s String String

arrow for expanding an input URI into an absolute URI using global base URI, fails if input is not a legal URI

getSchemeFromURI :: ArrowList a => a String String

arrow for selecting the scheme (protocol) of the URI, fails if input is not a legal URI.

See Network.URI for URI components

getRegNameFromURI :: ArrowList a => a String String

arrow for selecting the registered name (host) of the URI, fails if input is not a legal URI

getPortFromURI :: ArrowList a => a String String

arrow for selecting the port number of the URI without leading ':', fails if input is not a legal URI

getUserInfoFromURI :: ArrowList a => a String String

arrow for selecting the user info of the URI without trailing '@', fails if input is not a legal URI

getPathFromURI :: ArrowList a => a String String

arrow for computing the path component of an URI, fails if input is not a legal URI

getQueryFromURI :: ArrowList a => a String String

arrow for computing the query component of an URI, fails if input is not a legal URI

getFragmentFromURI :: ArrowList a => a String String

arrow for computing the fragment component of an URI, fails if input is not a legal URI

getPartFromURI :: ArrowList a => (URI -> String) -> a String String

arrow for computing the path component of an URI, fails if input is not a legal URI