git.iko.soy/typeable/xml-lens
on master help sign in
Merge branch 'master' of https://github.com/fumieval/xml-lens
fd81c28fumieval
README.md+13−7
@@ -6,15 +6,19 @@ Lenses and traversals for [xml-conduit](http://hackage.haskell.org/package/xml-c
6Example
6Example
7========
7========
8
8
9−> doc <- Text.XML.readFile def "examples\\books.xml"
9+ > doc <- Text.XML.readFile def "examples\\books.xml"
10
10
11−> lengthOf ?? doc $ root . el "books" ./ el "book"
11+ > doc ^.. root . el "books" ./ el "book" . attributeIs "category" "Textbooks" ./ el "title" . text
12−7
12+ ["Learn You a Haskell for Great Good!","Programming in Haskell","Real World Haskell"]
13
13
14+ > lengthOf ?? doc $ root . el "books" ./ el "book"
15+ 7
16+
14−> doc ^? root . el "books" ./ attributeIs "category" "Joke" ./ el "title" . text
17+ > doc ^? root . el "books" ./ attributeIs "category" "Joke" ./ el "title" . text
15−Just "Functional Ikamusume"
18+ Just "Functional Ikamusume"
19+
20+ > doc & root . el "books" ./ el "book" ./ el "pages" . text <>~ " pages" & renderLBS def & BL.putStrLn
16
21
17−> doc & root . el "books" ./ el "book" ./ el "pages" . text <>~ " pages" & renderLBS def & BL.putStrLn
18```xml
22```xml
19<?xml version="1.0" encoding="ISO-8859-1"?>
23<?xml version="1.0" encoding="ISO-8859-1"?>
20<books>
24<books>
@@ -35,4 +39,6 @@ Just "Functional Ikamusume"
35 <pages>200 pages</pages>
39 <pages>200 pages</pages>
36</book>
40</book>
37…
41…
38−```
42+```
43+
44+