git.iko.soy/typeable/xml-lens
on master help sign in
Merge branch 'master' of https://github.com/fumieval/xml-lens
commit29993c2d69b559674f40fd4f4ce8c6619f5f3890 authorFumiaki Kinoshita <fumiexcel@gmail.com> dateFri 20 Sep 2013, 23:14 (13 years ago) parent35ded4fd4983a5
1 file changed+10−8
README.md+10−8
README.md+10−8
@@ -6,18 +6,20 @@ Lenses and traversals for [xml-conduit](http://hackage.haskell.org/package/xml-c
66Example
77========
88
9− > doc <- Text.XML.readFile def "examples/books.xml"
9+```haskell
10+> doc <- Text.XML.readFile def "examples/books.xml"
1011
11− > 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"]
12+> doc ^.. root . el "books" ./ el "book" . attributeIs "category" "Textbooks" ./ el "title" . text
13+["Learn You a Haskell for Great Good!","Programming in Haskell","Real World Haskell"]
1314
14− > lengthOf ?? doc $ root . el "books" ./ el "book"
15− 7
15+> lengthOf ?? doc $ root . el "books" ./ el "book"
16+7
1617
17− > doc ^? root . el "books" ./ attributeIs "category" "Joke" ./ el "title" . text
18− Just "Functional Ikamusume"
18+> doc ^? root . el "books" ./ attributeIs "category" "Joke" ./ el "title" . text
19+Just "Functional Ikamusume"
1920
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+```
2123
2224```xml
2325<?xml version="1.0" encoding="ISO-8859-1"?>