I am currently working on a C ++ MFC project on visual studio 2003. The goal of this project is to get an XML file containing language data, convert it to a simple CSV file, and return to XML. To do this, I use the TinyXML library, which is simple and good enough for my needs.
The problem is that as soon as I try to convert my .CSV file to XML, the generated XML cannot be opened again with TinyXML. From what I see now, it seems that he cannot open the file just created.
After some testing, I managed to get TinyXML to tell me its error: "Error No. 9: Unable to read end tag." If I bypass the error, the file is read to the point where the DOM tree recedes to the right for no reason, and then, a little later, the file appears empty from any element.
This is an erroneous file that is read by TinyXML after its creation.
<app>
−
<global>
<langidglobal1 lang="fr">GLOBAL1</langidglobal1>
<langidglobal1 lang="en">GLOBAL1</langidglobal1>
<langidglobal1 lang="ru"/>
<langidglobal1 lang="de"/>
</global>
−
<mainmenu>
<system lang="fr">Syst me</system>
<system lang="en">System</system>
<system lang="ru"/>
<system lang="de"/>
<motor lang="fr">Moteurs</motor>
<motor lang="en">Motors</motor>
<motor lang="ru"/>
<motor lang="de"/>
<param lang="fr">Param tres</param>
<param lang="en">Parameters</param>
<param lang="ru"/>
<param lang="de"/>
<diag lang="fr">Diagnostique</diag>
<diag lang="en">Diagnostic</diag>
<diag lang="ru"/>
<diag lang="de"/>
<rod lang="fr">Tiges</rod>
<rod lang="en">Rods</rod>
<rod lang="ru"/>
<rod lang="de"/>
<aide lang="fr">Aide</aide>
<aide lang="en">Help</aide>
<aide lang="ru"/>
<aide lang="de"/>
<exit lang="fr">Quitter</exit>
<exit lang="en">Exit</exit>
<exit lang="ru"/>
<exit lang="de"/>
<runningtools lang="fr">Outils</runningtools>
<runningtools lang="en">Running Tools</runningtools>
<runningtools lang="ru"/>
<runningtools lang="de"/>
<manualpatterns lang="fr">Patron Manuel</manualpatterns>
<manualpatterns lang="en">Manual Patterns</manualpatterns>
<manualpatterns lang="ru"/>
<manualpatterns lang="de"/>
<alarm lang="fr">Alarmes Actives</alarm>
<alarm lang="en">Active Alarms</alarm>
<alarm lang="ru"/>
<alarm lang="de"/>
<patternno lang="fr"># Patron</patternno>
<patternno lang="en">Pattern #</patternno>
<patternno lang="ru"/>
<patternno lang="de"/>
<lastlogs lang="fr">Derni res Billes</lastlogs>
<lastlogs lang="en">Last Logs</lastlogs>
<lastlogs lang="ru"/>
<lastlogs lang="de"/>
<maintenancemode lang="fr">Entretien</maintenancemode>
<maintenancemode lang="en">Maintenance</maintenancemode>
<maintenancemode lang="ru"/>
<maintenancemode lang="de"/>
−
<toolcustom1 lang="fr">
Force Entr e
<toolcustom1 lang="en">Force Input</toolcustom1>
<toolcustom1 lang="ru"/>
<toolcustom1 lang="de"/>
<toolcustom2 lang="fr">Force Sortie</toolcustom2>
<toolcustom2 lang="en">Force Output</toolcustom2>
<toolcustom2 lang="ru"/>
<toolcustom2 lang="de"/>
<jogaxis lang="fr">Jog Axes</jogaxis>
<jogaxis lang="en">Jog Axis</jogaxis>
<jogaxis lang="ru"/>
<jogaxis lang="de"/>
</toolcustom1>
<toolcustom1 lang="en">Force Input</toolcustom1>
<toolcustom1 lang="ru"/>
<toolcustom1 lang="de"/>
</mainmenu>
<menuparam/>
<menudiag/>
<menurod/>
<menuaide/>
<button/>
<progrid/>
<aboutbox/>
<dlgexit/>
<doc/>
</app>
If I get a pointer to the first element and look at it during debugging, this is exactly what TinyXML reads with the "LoadFile ()" command.
Also note that if I open the file (the source of the error above) with Firefox or wordpad or something else, the syntax is correct and there is no error at all. Everything is here, nothing is missing.
I do not suspect that my read / write code is wrong, because when I open / read / write an untouched XML file, everything works as planned.
, - , , .
TinyXML .
.