I have written a simple C++ shell program to parse large XML files and fix syntax errors.
I have so far covered everything I can think of except strings within strings, for example.
<ROOT>
<NODE attribute="This is a "string within" a string" />
<ROOT>
My program loops through the entire xml file character by character(keeping only a few characters in memory at a time for efficiency), it looks for things such as &<> etc and escapes them with & > <
etc. A basic example of what I am doing can be found at the accepted answer for this http://stackoverflow.com/questions/1817073/escaping-characters-in-large-xml-files
The question is: What conditions or logic can I use to detect "string within" to be able to escape the quotes to this:
<ROOT>
<NODE attribute="This is a "string within" a string" />
<ROOT>
Is it even possible at all?