diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-05-09 18:29:36 -0700 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-05-09 18:29:36 -0700 |
commit | 163fe8b81e7d1f25d745936ca3812e1913d95389 (patch) | |
tree | e523c89839c48e7f8828594d34db562ae71a0ea5 | |
parent | 41569646f9b5e70e53769e24d5e8efe45c2d24b4 (diff) |
Use parsing exception as fall back for io error
-rw-r--r-- | xml/parser.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xml/parser.cxx b/xml/parser.cxx index 28a17ce..db1a9d0 100644 --- a/xml/parser.cxx +++ b/xml/parser.cxx @@ -96,6 +96,9 @@ namespace xml pqname_ = &qname_; pvalue_ = &value_; + line_ = 0; + column_ = 0; + attr_i_ = 0; start_ns_i_ = 0; end_ns_i_ = 0; @@ -672,6 +675,12 @@ namespace xml is.read (b, static_cast<streamsize> (cap)); } + // If the caller hasn't configured the stream to use exceptions, + // then use the parsing exception to report an error. + // + if (is.bad () || (is.fail () && !is.eof ())) + throw parsing (*this, "io failure"); + bool eof (is.eof ()); s = XML_ParseBuffer (p_, static_cast<int> (is.gcount ()), eof); |