From what I could understand in the docs I deducted every xml_node knows it's position in the source text. What I'd like to do is to retrieve LINE and COLUMN for given xml_node<>*:
    rapidxml::file<> xmlFile("generators.xml"); // Open file, default template is char
    xml_document<> doc;               // character type defaults to char
    doc.parse<0>(xmlFile.data());;    // 0 means default parse flags
    xml_node<> *main = doc.first_node();  //Get the main node that contains everything
    cout << "My first node is: <" << main->name() << ">\n";
    cout << "   located at line " << main->?????() << ", column " << main->?????() << "\n";
How should I retrieve those offsets? Could I somehow crawl from the main->name() pointer back to the beginning of the document? But how can I access the document string from xml_document<> doc to compare offsets?
                        
Let's say you parse a simple xml document in a string.
RapidXML will insert null terminators (and maybe make other mods to the "document", so it might look like this now:
If you than ask for the
name()of the 'hello' node, it returns a pointer to the 'h' in yourxmlarray. You can just subtract the base of the array to get an offset.Obviously this isn't line and character. To get that, you'd need to count the number of newlines between the offset and the array start. (but maybe do this on a 'clean' version of the xml data, as RapidXML might well mangle newline sequences in the processed version..