[libxml++] Remove some TODO comments
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml++] Remove some TODO comments
- Date: Thu, 8 Oct 2015 07:57:48 +0000 (UTC)
commit a6e487e26f5c3a2a17bd2d15e03e04c04ce53cf4
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Oct 8 09:54:49 2015 +0200
Remove some TODO comments
libxml++/parsers/domparser.cc | 19 +++++++++++--------
libxml++/parsers/saxparser.cc | 6 +++++-
2 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/libxml++/parsers/domparser.cc b/libxml++/parsers/domparser.cc
index 2628a53..6b76ed3 100644
--- a/libxml++/parsers/domparser.cc
+++ b/libxml++/parsers/domparser.cc
@@ -121,12 +121,12 @@ void DomParser::parse_context()
}
doc_ = new Document(context_->myDoc);
- // This is to indicate to release_underlying that we took the
+ // This is to indicate to release_underlying() that we took the
// ownership on the doc.
context_->myDoc = nullptr;
- //Free the parse context, but keep the document alive so people can navigate the DOM tree:
- //TODO: Why not keep the context alive too?
+ // Free the parser context because it's not needed anymore,
+ // but keep the document alive so people can navigate the DOM tree:
Parser::release_underlying();
}
@@ -151,7 +151,11 @@ void DomParser::parse_stream(std::istream& in)
initialize_context();
- //TODO: Shouldn't we use a Glib::ustring here, and some alternative to std::getline()?
+ // std::string or Glib::ustring?
+ // Output from the XML parser is UTF-8 encoded.
+ // But the istream "in" is input, i.e. an XML file. It can use any encoding.
+ // If it's not UTF-8, the file itself must contain information about which
+ // encoding it uses. See the XML specification. Thus use std::string.
int firstParseError = XML_ERR_OK;
std::string line;
while(std::getline(in, line))
@@ -194,13 +198,12 @@ void DomParser::parse_stream(std::istream& in)
}
doc_ = new Document(context_->myDoc);
- // This is to indicate to release_underlying that we took the
+ // This is to indicate to release_underlying() that we took the
// ownership on the doc.
context_->myDoc = nullptr;
-
- //Free the parse context, but keep the document alive so people can navigate the DOM tree:
- //TODO: Why not keep the context alive too?
+ // Free the parser context because it's not needed anymore,
+ // but keep the document alive so people can navigate the DOM tree:
Parser::release_underlying();
}
diff --git a/libxml++/parsers/saxparser.cc b/libxml++/parsers/saxparser.cc
index 8a83bf6..7b16c3c 100644
--- a/libxml++/parsers/saxparser.cc
+++ b/libxml++/parsers/saxparser.cc
@@ -233,7 +233,11 @@ void SaxParser::parse_stream(std::istream& in)
initialize_context();
- //TODO: Shouldn't we use a Glib::ustring here, and some alternative to std::getline()?
+ // std::string or Glib::ustring?
+ // Output from the XML parser is UTF-8 encoded.
+ // But the istream "in" is input, i.e. an XML file. It can use any encoding.
+ // If it's not UTF-8, the file itself must contain information about which
+ // encoding it uses. See the XML specification. Thus use std::string.
int firstParseError = XML_ERR_OK;
std::string line;
while (!exception_ptr_ && std::getline(in, line))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]