-- | Parse a string containing xml to a value, or an error message on
-- failure.
eitherFromXML :: XmlPickler a => String -> Either String a
eitherFromXML text =
  case runLA (removeAllWhiteSpace . xread) text of
    []    -> Left "Failed to parse XML in eitherFromXML."
    [x]   -> unpickleDoc' xpickle x
    (_:_) -> Left "Multiple parses in eitherFromXML."
eitherFromXML :: XmlPickler a => String -> Either String a
eitherFromXML text =
  case runLA (removeAllWhiteSpace . xread) text of
    []    -> Left "Failed to parse XML in eitherFromXML."
    [x]   -> unpickleDoc' xpickle x
    (_:_) -> Left "Multiple parses in eitherFromXML."
eitherFromXML text =
  case runLA (removeAllWhiteSpace . xread) text of
    []    -> Left "Failed to parse XML in eitherFromXML."
    [x]   -> unpickleDoc' xpickle x
    (_:_) -> Left "Multiple parses in eitherFromXML."