xml-lens-0.1.5: Lenses, traversals, prisms for xml-conduit

Portabilitynon-portable
Stabilityexperimental
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellNone

Text.XML.Lens

Contents

Description

Useful traversals inspired by XPath

Synopsis

Lenses, traversals for Element

data Element

Constructors

Element 

Instances

Eq Element 
Data Element 
Ord Element 
Show Element 
Typeable Element 
ToMarkup Element

Note that the special element name {http:www.snoyman.com/xml2html}ie-cond with the single attribute cond is used to indicate an IE conditional comment.

Plated Element 
NFData Element 

(./) :: Plated a => Traversal s t a a -> Traversal a a u v -> Traversal s t u vSource

Combine two Traversals just like XPath's slash.

 
 l ./ m ≡ l . plate . m

Names

el :: Name -> Traversal' Element ElementSource

Traverse elements which has the specified name.

ell :: Text -> Traversal' Element ElementSource

Traverse elements which has the specified *local* name.

Attributes

Contents

text :: Traversal' Element TextSource

Traverse all contents of the element.

comment :: Traversal' Element TextSource

Traverse all comments of the element.

Children

entire :: Traversal' Element ElementSource

Traverse itself with its all children. Rewriting subnodes of each children will break a traversal law.

Prisms for Node

Lenses for Document

root :: Lens' Document ElementSource

The root element of the document.

Lenses for Name

data Name

A fully qualified name.

Prefixes are not semantically important; they are included only to simplify pass-through parsing. When comparing names with Eq or Ord methods, prefixes are ignored.

The IsString instance supports Clark notation; see http://www.jclark.com/xml/xmlns.htm and http://infohost.nmt.edu/tcc/help/pubs/pylxml/etree-QName.html. Use the OverloadedStrings language extension for very simple Name construction:

 myname :: Name
 myname = "{http://example.com/ns/my-namespace}my-name"

Constructors

Name 

Fields

nameLocalName :: Text
 
nameNamespace :: Maybe Text
 
namePrefix :: Maybe Text
 

Instances

Eq Name 
Data Name 
Ord Name 
Show Name 
Typeable Name 
IsString Name 
NFData Name 

Lenses for Instruction

Reexport