1 #ifndef RAPIDXML_UTILS_HPP_INCLUDED 2 #define RAPIDXML_UTILS_HPP_INCLUDED 20 template<
class Ch =
char>
33 basic_ifstream<Ch> stream(filename, ios::binary);
35 throw runtime_error(
string(
"cannot open file ") + filename);
36 stream.unsetf(ios::skipws);
39 stream.seekg(0, ios::end);
40 size_t size = stream.tellg();
45 stream.read(&
m_data.front(),
static_cast<streamsize
>(
size));
51 file(std::basic_istream<Ch> &stream)
56 stream.unsetf(ios::skipws);
57 m_data.assign(istreambuf_iterator<Ch>(stream), istreambuf_iterator<Ch>());
58 if (stream.fail() || stream.bad())
59 throw runtime_error(
"error reading stream");
96 std::size_t count = 0;
111 std::size_t count = 0;
This file contains rapidxml parser and DOM implementation.
std::size_t count_children(xml_node< Ch > *node)
Represents data loaded from a file.
xml_attribute< Ch > * next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
file(const char *filename)
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
file(std::basic_istream< Ch > &stream)
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
xml_node< Ch > * next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
std::size_t count_attributes(xml_node< Ch > *node)