git.iko.soy/typeable/xml-lens
on master help sign in
Update README.md
commitd4983a59bdf583128dedb69e4d0ad914bc014249 authorFumiaki Kinoshita <fumiexcel@gmail.com> dateSun 28 Jul 2013, 19:30 (13 years ago) parentd1790ef
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"?>