Okay, so I have the following code that I have modeled from online resources:
std::vector<std::string> VN::XDocument::getNode()
{
std::string xmld = document;
rapidxml::xml_document<> doc;
std::vector<char> xml_c(xmld.begin(), xmld.end());
xml_c.push_back('\0');
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(&xml_c[0]);
std::vector<std::string> v;
rapidxml::xml_node<>* rn = doc.first_node();
v.push_back(rn->first_attribute()->value());
return v;
}
Please note that "document" is a variable storing an online XML file (I didn't post the actual URL for privacy reasons...) but anyway, I call the above code from the following:
VN::XDocument x(xmlStr);
std::vector<std::string> defs = x.getNode();
std::cout << defs[0];
It's a vector because I eventually plan to read off more of the XML file.. but for now I'm just calling the first node just to make sure it works. However, every time I debug I get the following error:
Microsoft C++ exception: rapidxml::parse_error at memory location 0x0018f180..
Here's the XML file:
<entry_list version="1.0">
<entry id="hello">
<ew>hello</ew>
<hw>hel*lo</hw>
<sound>
<wav>hello001.wav</wav>
<wpr>hu-!lO</wpr>
</sound>
<pr>hə-ˈlō, he-</pr>
<fl>noun</fl>
<in>
<il>plural</il>
<if>hellos</if>
</in>
<et>
alteration of
<it>hollo</it>
</et>
<def>
<date>1877</date>
<dt>
:an expression or gesture of greeting
<un>
used interjectionally in greeting, in answering the telephone, or to express surprise
</un>
</dt>
</def>
</entry>
<entry id="hullo">
<ew>hullo</ew>
<hw>hul*lo</hw>
<sound>
<wav>hullo001.wav</wav>
<wpr>(+)hu-!lO</wpr>
</sound>
<pr>(ˌ)hə-ˈlō</pr>
<cx>
<cl>chiefly British variant of</cl>
<ct>hello</ct>
</cx>
</entry>
</entry_list>
Anyone else ever get this? I don't know what to do! I tried everything! Please help. Thanks in advanced.
BTW, I'm a C++ newbie.