title: why is parsecs "choice" combinator seemingly stuck on the first choice?
body: <p>After looking at the CSV sample code in Real World Haskell, I've tried to build a little XML parser. But close tags error out with 'unexpected "/"' errors. Can you tell me why my "closeTag" parser doesn't work (or possibly isn't ever invoked)? Thanks!</p>
  
  <pre><code>import Text.ParserCombinators.Parsec
  
  xmlFile = manyTill line eof
  line = manyTill tag eol
  eol = char '\n'
  
  word = many1 (noneOf "&gt;&lt;/")
  
  tag = choice [openTag, closeTag, nullTag, word]
  
  nullTag = between (char '&lt;') (string "/&gt;") word
  closeTag = between (string "&lt;/") (char '&gt;') word
  openTag = between (char '&lt;') (char '&gt;')  tagContent
  attrval = between (char '"') (char '"') word
  
  atts = do {
          (char ' ')
          ; sepBy attr (char ' ')
  }
  
  attr = do {
                  word
                  ; char '='
                  ; attrval
          }
  
  tagContent = do {
                  w &lt;- word
                  ; option []  atts
                  ; return w
          }
  
  parseXML :: String -&gt; Either ParseError [[String]]
  parseXML input = parse xmlFile "(unknown)" input
  
  main =
      do c &lt;- getContents
         case parse xmlFile "(stdin)" c of
              Left e -&gt; do putStrLn "Error parsing input:"
                           print e
              Right r -&gt; mapM_ print r
  </code></pre>