Copyright | (c) Herbert Valerio Riedel 2019 |
---|---|
License | GPL-3.0-or-later |
Safe Haskell | Safe |
Language | Haskell2010 |
Basic XML types.
Synopsis
- type Root = Root' Content
- data Root' cnode = Root {
- rootXmlDeclaration :: Maybe XmlDeclaration
- rootPreElem :: MiscNodes
- rootDoctype :: Maybe (Text, MiscNodes)
- rootElement :: Element' cnode
- rootPostElem :: MiscNodes
- type MiscNodes = [Either Comment PI]
- data XmlDeclaration = XmlDeclaration (Maybe ShortText) (Maybe Bool)
- type Element = Element' Content
- data Element' cnode = Element {}
- blank_element :: Element
- xmlns_elem_wellformed :: [(ShortText, URI)] -> Element -> Bool
- xmlns_elem_wellformed' :: (Either Attr [Content] -> [QName] -> [QName]) -> [(ShortText, URI)] -> Element -> Bool
- data Attr = Attr {}
- xmlns_attr :: ShortText -> URI -> Attr
- xmlns_def_attr :: URI -> Attr
- xmlns_from_attr :: Attr -> Maybe (ShortText, URI)
- data Content
- data PI = PI {}
- data CData = CData {
- cdVerbatim :: !CDataKind
- cdData :: !Text
- data CDataKind
- blank_cdata :: CData
- newtype Comment = Comment Text
- data QName = QName {}
- blank_name :: QName
- qnameToText :: QName -> Text
- qnameFromText :: (ShortText -> URI) -> Text -> Maybe QName
- type NCName = ShortText
- newtype LName = LName {}
- newtype URI = URI {}
- isNullURI :: URI -> Bool
- type Pos = Int
Root node representation
Represents the implicit root node of an XML document
Since: 0.2.0
Root | |
|
Instances
Functor Root' Source # | |
Foldable Root' Source # | |
Defined in Text.XML.Types.Core fold :: Monoid m => Root' m -> m # foldMap :: Monoid m => (a -> m) -> Root' a -> m # foldr :: (a -> b -> b) -> b -> Root' a -> b # foldr' :: (a -> b -> b) -> b -> Root' a -> b # foldl :: (b -> a -> b) -> b -> Root' a -> b # foldl' :: (b -> a -> b) -> b -> Root' a -> b # foldr1 :: (a -> a -> a) -> Root' a -> a # foldl1 :: (a -> a -> a) -> Root' a -> a # elem :: Eq a => a -> Root' a -> Bool # maximum :: Ord a => Root' a -> a # minimum :: Ord a => Root' a -> a # | |
Traversable Root' Source # | |
Data cnode => Data (Root' cnode) Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Root' cnode -> c (Root' cnode) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Root' cnode) # toConstr :: Root' cnode -> Constr # dataTypeOf :: Root' cnode -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Root' cnode)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Root' cnode)) # gmapT :: (forall b. Data b => b -> b) -> Root' cnode -> Root' cnode # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Root' cnode -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Root' cnode -> r # gmapQ :: (forall d. Data d => d -> u) -> Root' cnode -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Root' cnode -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Root' cnode -> m (Root' cnode) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Root' cnode -> m (Root' cnode) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Root' cnode -> m (Root' cnode) # | |
Show cnode => Show (Root' cnode) Source # | |
Generic (Root' cnode) Source # | |
NFData cnode => NFData (Root' cnode) Source # | |
Defined in Text.XML.Types.Core | |
type Rep (Root' cnode) Source # | |
Defined in Text.XML.Types.Core type Rep (Root' cnode) = D1 (MetaData "Root'" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "Root" PrefixI True) ((S1 (MetaSel (Just "rootXmlDeclaration") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe XmlDeclaration)) :*: S1 (MetaSel (Just "rootPreElem") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 MiscNodes)) :*: (S1 (MetaSel (Just "rootDoctype") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe (Text, MiscNodes))) :*: (S1 (MetaSel (Just "rootElement") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Element' cnode)) :*: S1 (MetaSel (Just "rootPostElem") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 MiscNodes))))) |
data XmlDeclaration Source #
Denotes the <?xml version="1.0" encoding="..." standalone="..." ?>
declaration
Since: 0.2.0
Instances
Element nodes
XML elements
Instances
Functor Element' Source # | |
Foldable Element' Source # | |
Defined in Text.XML.Types.Core fold :: Monoid m => Element' m -> m # foldMap :: Monoid m => (a -> m) -> Element' a -> m # foldr :: (a -> b -> b) -> b -> Element' a -> b # foldr' :: (a -> b -> b) -> b -> Element' a -> b # foldl :: (b -> a -> b) -> b -> Element' a -> b # foldl' :: (b -> a -> b) -> b -> Element' a -> b # foldr1 :: (a -> a -> a) -> Element' a -> a # foldl1 :: (a -> a -> a) -> Element' a -> a # elem :: Eq a => a -> Element' a -> Bool # maximum :: Ord a => Element' a -> a # minimum :: Ord a => Element' a -> a # | |
Traversable Element' Source # | |
IsContent Element Source # | |
Node Element Source # | |
Data cnode => Data (Element' cnode) Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Element' cnode -> c (Element' cnode) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Element' cnode) # toConstr :: Element' cnode -> Constr # dataTypeOf :: Element' cnode -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Element' cnode)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Element' cnode)) # gmapT :: (forall b. Data b => b -> b) -> Element' cnode -> Element' cnode # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Element' cnode -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Element' cnode -> r # gmapQ :: (forall d. Data d => d -> u) -> Element' cnode -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Element' cnode -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Element' cnode -> m (Element' cnode) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Element' cnode -> m (Element' cnode) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Element' cnode -> m (Element' cnode) # | |
Show cnode => Show (Element' cnode) Source # | |
Generic (Element' cnode) Source # | |
NFData cnode => NFData (Element' cnode) Source # | |
Defined in Text.XML.Types.Core | |
Node [Element] Source # | |
Node ([Attr], [Element]) Source # | |
Node ([Attr], Element) Source # | |
Node (Attr, Element) Source # | |
type Rep (Element' cnode) Source # | |
Defined in Text.XML.Types.Core type Rep (Element' cnode) = D1 (MetaData "Element'" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "Element" PrefixI True) (S1 (MetaSel (Just "elName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 QName) :*: (S1 (MetaSel (Just "elAttribs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Attr]) :*: S1 (MetaSel (Just "elContent") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [cnode])))) |
blank_element :: Element Source #
Blank elements
__NOTE: This value is not a propler Element
.
xmlns_elem_wellformed :: [(ShortText, URI)] -> Element -> Bool Source #
Verify whether sub-tree is wellformed with respect to namespaces
The first argument denotes an optional parent context of
xmlns
-declarations that are in scope (where ShortText
and URI
have the same semantics as for the arguments of xmlns_attr
). In
case of duplicate prefixes, earlier entries shadow later entries.
NOTE: This function doesn't take into account the namespace
prefixes of xs:QName
-valued text-nodes or attributes; if you need
to handle such cases, see the xmlns_elem_wellformed'
function.
Since: 0.3.1
xmlns_elem_wellformed' :: (Either Attr [Content] -> [QName] -> [QName]) -> [(ShortText, URI)] -> Element -> Bool Source #
Variant of xmlns_elem_wellformed
which supports introspecting xs:QName
valued attributes and text-nodes.
The first argument is a function for extracting a (possibly empty) list of QName
s from attribute values and text-nodes:
- Its first
argument denotes either a (non-empty) attribute or an element's children which contain at least one non-empty text-node fragment.Either
Attr
[Content
] - The second argument of type
[
denotes the path of elementQName
]QName
s in reverse order (i.e. the top-level element of the traversal is last item in this list) leading to the currently focused attribute or text-node.
This QName
extracing function may return a list to accomodate for test fields which may contain multiple xs:QName
such as e.g. for
<xs:list itemType="xs:QName" />
The qnameFromText
function can be useful for decoding xs:QName
s text values.
xmlns_elem_wellformed' (\_ _ -> []) topns el = xmlns_elem_wellformed topns el
Since: 0.3.1
Element attributes
XML attributes
Instances
Eq Attr Source # | |
Data Attr Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Attr -> c Attr # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Attr # dataTypeOf :: Attr -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Attr) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr) # gmapT :: (forall b. Data b => b -> b) -> Attr -> Attr # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r # gmapQ :: (forall d. Data d => d -> u) -> Attr -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Attr -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Attr -> m Attr # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Attr -> m Attr # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Attr -> m Attr # | |
Ord Attr Source # | |
Show Attr Source # | |
Generic Attr Source # | |
NFData Attr Source # | |
Defined in Text.XML.Types.Core | |
Node Attr Source # | |
Node [Attr] Source # | |
Node ([Attr], [CData]) Source # | |
Node ([Attr], [Element]) Source # | |
Node ([Attr], [Content]) Source # | |
Node ([Attr], Text) Source # | |
Node ([Attr], ShortText) Source # | |
Node ([Attr], CData) Source # | |
Node ([Attr], Element) Source # | |
Node ([Attr], Content) Source # | |
Node (Attr, Text) Source # | |
Node (Attr, ShortText) Source # | |
Node (Attr, CData) Source # | |
Node (Attr, Element) Source # | |
Node (Attr, Content) Source # | |
type Rep Attr Source # | |
Defined in Text.XML.Types.Core type Rep Attr = D1 (MetaData "Attr" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "Attr" PrefixI True) (S1 (MetaSel (Just "attrKey") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 QName) :*: S1 (MetaSel (Just "attrVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))) |
:: ShortText | namespace prefix (if empty, denotes the default namespace; see also |
-> URI | Namespace URI |
-> Attr |
Smart constructor for xmlns:<prefix> = <namespace-uri>
Invariant: <namespace-uri>
MUST be non-empty for non-empty prefixes
Since: 0.3.0
Smart constructor for xmlns = [<namespace-uri>|""]
(i.e. for declaring the default namespace)
xmlns_attr "" ns == xmlns_def_attr ns
Since: 0.3.0
Non-element content nodes
XML content
Since: 0.2.0
Instances
Processing instruction
Since: 0.2.0
Instances
Data PI Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PI -> c PI # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PI # dataTypeOf :: PI -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PI) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PI) # gmapT :: (forall b. Data b => b -> b) -> PI -> PI # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PI -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PI -> r # gmapQ :: (forall d. Data d => d -> u) -> PI -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PI -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PI -> m PI # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PI -> m PI # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PI -> m PI # | |
Show PI Source # | |
Generic PI Source # | |
NFData PI Source # | |
Defined in Text.XML.Types.Core | |
IsContent PI Source # | |
type Rep PI Source # | |
Defined in Text.XML.Types.Core type Rep PI = D1 (MetaData "PI" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "PI" PrefixI True) (S1 (MetaSel (Just "piTarget") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ShortText) :*: S1 (MetaSel (Just "piData") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))) |
XML CData
CData | |
|
Instances
Data CData Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CData -> c CData # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CData # dataTypeOf :: CData -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CData) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CData) # gmapT :: (forall b. Data b => b -> b) -> CData -> CData # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r # gmapQ :: (forall d. Data d => d -> u) -> CData -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CData -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CData -> m CData # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CData -> m CData # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CData -> m CData # | |
Show CData Source # | |
Generic CData Source # | |
NFData CData Source # | |
Defined in Text.XML.Types.Core | |
IsContent CData Source # | |
Node CData Source # | |
Node [CData] Source # | |
Node ([Attr], [CData]) Source # | |
Node ([Attr], CData) Source # | |
Node (Attr, CData) Source # | |
type Rep CData Source # | |
Defined in Text.XML.Types.Core type Rep CData = D1 (MetaData "CData" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "CData" PrefixI True) (S1 (MetaSel (Just "cdVerbatim") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 CDataKind) :*: S1 (MetaSel (Just "cdData") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))) |
CDataText | Ordinary character data; pretty printer escapes &, < etc. |
CDataVerbatim | Unescaped character data; pretty printer embeds it in <![CDATA[.. |
CDataRaw | As-is character data; pretty printer passes it along without any escaping or CDATA wrap-up. |
Instances
Eq CDataKind Source # | |
Data CDataKind Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CDataKind -> c CDataKind # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CDataKind # toConstr :: CDataKind -> Constr # dataTypeOf :: CDataKind -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CDataKind) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CDataKind) # gmapT :: (forall b. Data b => b -> b) -> CDataKind -> CDataKind # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CDataKind -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CDataKind -> r # gmapQ :: (forall d. Data d => d -> u) -> CDataKind -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CDataKind -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind # | |
Show CDataKind Source # | |
Generic CDataKind Source # | |
NFData CDataKind Source # | |
Defined in Text.XML.Types.Core | |
type Rep CDataKind Source # | |
Defined in Text.XML.Types.Core type Rep CDataKind = D1 (MetaData "CDataKind" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "CDataText" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "CDataVerbatim" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "CDataRaw" PrefixI False) (U1 :: Type -> Type))) |
blank_cdata :: CData Source #
Empty text-node
Represents a XML comment
Invariant: SHOULD not contain --
(occurences of --
will be automatically substituted by -~
on serialization)
Since: 0.2.0
Instances
Data Comment Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Comment -> c Comment # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Comment # toConstr :: Comment -> Constr # dataTypeOf :: Comment -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Comment) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Comment) # gmapT :: (forall b. Data b => b -> b) -> Comment -> Comment # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Comment -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Comment -> r # gmapQ :: (forall d. Data d => d -> u) -> Comment -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Comment -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Comment -> m Comment # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Comment -> m Comment # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Comment -> m Comment # | |
Show Comment Source # | |
Generic Comment Source # | |
NFData Comment Source # | |
Defined in Text.XML.Types.Core | |
IsContent Comment Source # | |
type Rep Comment Source # | |
Defined in Text.XML.Types.Core |
Namespace-qualified names
QName | |
|
Instances
Eq QName Source # | Compares namespace URI and local name for equality (i.e. the namespace prefix is ignored) Since: 0.3.0 |
Data QName Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> QName -> c QName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c QName # dataTypeOf :: QName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c QName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName) # gmapT :: (forall b. Data b => b -> b) -> QName -> QName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r # gmapQ :: (forall d. Data d => d -> u) -> QName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> QName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> QName -> m QName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> QName -> m QName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> QName -> m QName # | |
Ord QName Source # | Compares namespace URI and local name for equality (i.e. the namespace prefix is effectively ignored) The http://www.w3.org/2000/xmlns/ namespace is considered less than any other namespace (including the null namespace) Since: 0.3.0 |
Show QName Source # | |
Generic QName Source # | |
NFData QName Source # | |
Defined in Text.XML.Types.Core | |
type Rep QName Source # | |
Defined in Text.XML.Types.Core type Rep QName = D1 (MetaData "QName" "Text.XML.Types.Core" "X-0.3.1.0-FtMev6r53LM7jz5ldGnRwK" False) (C1 (MetaCons "QName" PrefixI True) (S1 (MetaSel (Just "qLName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 LName) :*: (S1 (MetaSel (Just "qURI") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 URI) :*: S1 (MetaSel (Just "qPrefix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe NCName))))) |
blank_name :: QName Source #
Blank names
NOTE: This value is not a proper QName
.
qnameToText :: QName -> Text Source #
Convert a QName
to its text-representation, i.e.
QName ::= PrefixedName | UnprefixedName PrefixedName ::= Prefix ':' LocalPart UnprefixedName ::= LocalPart Prefix ::= NCName LocalPart ::= NCName
See also NCName
>>>
qnameToText (QName "foo" "urn:example.org:bar" (Just "doo"))
"doo:foo"
>>>
qnameToText (QName "foo" "urn:example.org:bar" Nothing)
"foo"
See also qnameFromText
Since: 0.3.1
qnameFromText :: (ShortText -> URI) -> Text -> Maybe QName Source #
Decode a QName
from its text-representation (see qnameToText
)
This is the inverse to the qnameToText
function. However,
qnameToText
is a lossy conversion, therefore this function needs
to reconstruct the namespace (i.e. qURI
) with the help of a
lookup function provided in the first argument: The lookup
functions takes a ShortText
which can be either
- the empty string (i.e.
""
) which denotes an unprefixed name, or - a non-empty
NCName
string which denotes a prefixed name.
The result of this function shall be the respective namespace URI
to associate with this QName. An empty URI
may be returned In
case of unprefixed names to denote the name being in no namespace.
Finally, this function returns Nothing
in case of syntax errors
or when the prefix lookup function returns an empty URI
(see
isNullURI
) for a prefixed name.
Since: 0.3.1
Components of QName
s
XML local names
Invariant: MUST be a proper NCName
Instances
Eq LName Source # | |
Data LName Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LName -> c LName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LName # dataTypeOf :: LName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LName) # gmapT :: (forall b. Data b => b -> b) -> LName -> LName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LName -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LName -> r # gmapQ :: (forall d. Data d => d -> u) -> LName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LName -> m LName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LName -> m LName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LName -> m LName # | |
Ord LName Source # | |
Show LName Source # | |
IsString LName Source # | |
Defined in Text.XML.Types.Core fromString :: String -> LName # | |
Generic LName Source # | |
NFData LName Source # | |
Defined in Text.XML.Types.Core | |
type Rep LName Source # | |
Defined in Text.XML.Types.Core |
URIs resembling anyURI
Invariant: MUST be a valid URI-reference
as defined in RFC3986
NOTE: The special empty URI
is valid for denoting QName
s that aren't in any namespace.
Instances
Eq URI Source # | |
Data URI Source # | |
Defined in Text.XML.Types.Core gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URI -> c URI # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URI # dataTypeOf :: URI -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URI) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URI) # gmapT :: (forall b. Data b => b -> b) -> URI -> URI # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r # gmapQ :: (forall d. Data d => d -> u) -> URI -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> URI -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> URI -> m URI # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI # | |
Ord URI Source # | |
Show URI Source # | |
IsString URI Source # | |
Defined in Text.XML.Types.Core fromString :: String -> URI # | |
Generic URI Source # | |
NFData URI Source # | |
Defined in Text.XML.Types.Core | |
type Rep URI Source # | |
Defined in Text.XML.Types.Core |
isNullURI :: URI -> Bool Source #
Test for empty URI
>>>
isNullURI (URI mempty)
True
>>>
isNullURI (URI "")
True
>>>
isNullURI (URI " ")
False
Since: 0.3.0