Skip to content

Commit a6e487e

Browse files
author
Kjell Ahlstedt
committed
Remove some TODO comments
1 parent 5abab30 commit a6e487e

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

libxml++/parsers/domparser.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ void DomParser::parse_context()
121121
}
122122

123123
doc_ = new Document(context_->myDoc);
124-
// This is to indicate to release_underlying that we took the
124+
// This is to indicate to release_underlying() that we took the
125125
// ownership on the doc.
126126
context_->myDoc = nullptr;
127127

128-
//Free the parse context, but keep the document alive so people can navigate the DOM tree:
129-
//TODO: Why not keep the context alive too?
128+
// Free the parser context because it's not needed anymore,
129+
// but keep the document alive so people can navigate the DOM tree:
130130
Parser::release_underlying();
131131
}
132132

@@ -151,7 +151,11 @@ void DomParser::parse_stream(std::istream& in)
151151

152152
initialize_context();
153153

154-
//TODO: Shouldn't we use a Glib::ustring here, and some alternative to std::getline()?
154+
// std::string or Glib::ustring?
155+
// Output from the XML parser is UTF-8 encoded.
156+
// But the istream "in" is input, i.e. an XML file. It can use any encoding.
157+
// If it's not UTF-8, the file itself must contain information about which
158+
// encoding it uses. See the XML specification. Thus use std::string.
155159
int firstParseError = XML_ERR_OK;
156160
std::string line;
157161
while(std::getline(in, line))
@@ -194,13 +198,12 @@ void DomParser::parse_stream(std::istream& in)
194198
}
195199

196200
doc_ = new Document(context_->myDoc);
197-
// This is to indicate to release_underlying that we took the
201+
// This is to indicate to release_underlying() that we took the
198202
// ownership on the doc.
199203
context_->myDoc = nullptr;
200204

201-
202-
//Free the parse context, but keep the document alive so people can navigate the DOM tree:
203-
//TODO: Why not keep the context alive too?
205+
// Free the parser context because it's not needed anymore,
206+
// but keep the document alive so people can navigate the DOM tree:
204207
Parser::release_underlying();
205208
}
206209

libxml++/parsers/saxparser.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ void SaxParser::parse_stream(std::istream& in)
233233

234234
initialize_context();
235235

236-
//TODO: Shouldn't we use a Glib::ustring here, and some alternative to std::getline()?
236+
// std::string or Glib::ustring?
237+
// Output from the XML parser is UTF-8 encoded.
238+
// But the istream "in" is input, i.e. an XML file. It can use any encoding.
239+
// If it's not UTF-8, the file itself must contain information about which
240+
// encoding it uses. See the XML specification. Thus use std::string.
237241
int firstParseError = XML_ERR_OK;
238242
std::string line;
239243
while (!exception_ptr_ && std::getline(in, line))

0 commit comments

Comments
 (0)