Skip to content

Commit

Permalink
XML: Add a parameter fileName, for error reporting, to XMLParser
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Jun 15, 2018
1 parent a4ca409 commit 06b356e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/xml/xmlparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void deinitXML() {
}


XMLParser::XMLParser(Common::ReadStream &stream, bool makeLower) {
XMLParser::XMLParser(Common::ReadStream &stream, bool makeLower, const Common::UString &fileName) {
initXML();

Common::UString parseError;
Expand All @@ -83,7 +83,8 @@ XMLParser::XMLParser(Common::ReadStream &stream, bool makeLower) {
const int options = XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS | XML_PARSE_NONET |
XML_PARSE_NSCLEAN | XML_PARSE_NOCDATA;

xmlDocPtr xml = xmlReadIO(readStream, closeStream, static_cast<void *>(&stream), "stream.xml", 0, options);
xmlDocPtr xml = xmlReadIO(readStream, closeStream, static_cast<void *>(&stream),
fileName.c_str(), 0, options);
if (!xml) {
Common::Exception e;

Expand Down
4 changes: 3 additions & 1 deletion src/xml/xmlparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ class XMLParser : boost::noncopyable {
*
* @param stream The stream to read the XML from.
* @param makeLower Should all tags be converted to lowercase, to ease case-insensitive comparison?
* @param fileName The file name to tell libxml2. Only used for error reporting.
*/
XMLParser(Common::ReadStream &stream, bool makeLower = false);
XMLParser(Common::ReadStream &stream, bool makeLower = false,
const Common::UString &fileName = "stream.xml");
~XMLParser();

/** Return the XML root node. */
Expand Down

0 comments on commit 06b356e

Please sign in to comment.