| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Text.XML.Hexml.Lens
Contents
Nodes
Minimal complete definition
_XML, _contents, _inner, _outer, textContents, _Attribute, iattributes, nodes
Methods
A prism for parsing and unparsing XML.
unparsing is provided by outer.
>>>"<?xml version=\"1.0\"?><foo/>" ^? _XMLJust Node "<?xml version=\"1.0\"?><foo/>"
Nameless nodes are inserted for trees with >1 root.
>>>"<?xml version=\"1.0\"?><foo/>" ^? _XML.to nameJust ""
>>>"<?xml version=\"1.0\"?><foo/>" ^? _XML._children.ix(0)Just Node "<?xml version=\"1.0\"?>"
>>>"<?xml version=\"1.0\"?><foo/>" ^? _XML._children.ix(1)Just Node "<foo/>"
If the tree has only 1 root, no nameless nodes are inserted.
>>>"<foo/>" ^? _XML.re(_XML @String)._XML.to nameJust "foo"
The law x ^? re _XML . _XML == x doesn't hold for the nameless nodes
injected by parse.
>>>parse "<foo/>" ^? _Right.to nameJust "">>>parse "<foo/>" ^? _Right.re(_XML @String)._XML.to nameJust "foo"
_contents :: Fold Node (Either s Node) #
Fold over all the children (text and element)
Getter for the inner contents of a node
Getter for the inner contents of a node
textContents :: Fold Node s #
Fold for accessing the text contents of a node
_Attribute :: s -> Getter Node (Maybe s) #
Fold for accessing attributes by name.
iattributes :: IndexedFold String Node s #
Name-Indexed fold over the attribute values
nodes :: s -> Getter Node [Node] #
A getter for accessing named children nodes This is a more efficient version of
nodes foo = _children . to (filter (\n -> name n == foo))
Instances
| XML String # | |
| XML String # | |
| XML ByteString # | |
Defined in Text.XML.Hexml.Lens Methods _XML :: Prism' ByteString Node # _contents :: Fold Node (Either ByteString Node) # _inner :: Getter Node ByteString # _outer :: Getter Node ByteString # textContents :: Fold Node ByteString # _Attribute :: ByteString -> Getter Node (Maybe ByteString) # | |
| XML ByteString # | |
Defined in Text.XML.Hexml.Lens Methods _XML :: Prism' ByteString Node # _contents :: Fold Node (Either ByteString Node) # _inner :: Getter Node ByteString # _outer :: Getter Node ByteString # textContents :: Fold Node ByteString # _Attribute :: ByteString -> Getter Node (Maybe ByteString) # | |
| XML Text # | |
Defined in Text.XML.Hexml.Lens | |
| XML Text # | |
Defined in Text.XML.Hexml.Lens | |
multiple :: Getting [a] s a -> IndexPreservingGetter s [a] #