How is it I use the where() function?
using namespace rapidxml;
xml_document<> doc;
std:string xmlfile = "test.xml";
std::ifstream file ( xmlfile );
std::stringstream buffer;
buffer << file.rdbuf ( );
file.close ( );
std::string content ( buffer.str ( ) );
try
{
doc.parse<0> ( &content [ 0 ] );
}
catch ( rapidxml::parse_error& e )
{
std::cout << "Parsing error: " << e.what ( ) << "\n";
//const Ch* e.where ( );
}
got the what() but was looking to get some kind of indicator from where() like the last node that broke the xml?
To use the RapidXml where()
metohd, try something like this:
std::cout << e.where<char>();
Because where
returns a pointer into the raw XML data, it's a templated function. You can use the returned pointer and the original data to determine a line and column position by counting newlines.