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