0

I am writting a C++ program that turns CSV files into XML. part of my CSV file has a city name with an AMPERSAND in it....when I populate the information to the XML I can not validate my code. is there a way to code C++ so that XML validates the word even though the ampersand is present... (not sure if this is being spit out properly, view below..)

<cit:city>
        <cit:name> Inisa </cit:name>
        <cit:district> Oyo & Osun </cit:district>
        <cit:population> 119800 </cit:population>
</cit:city>

this is my XML code after processing through my C++ program....

below is my error code in validation

Errors in the XML document: 
10990:  27  The entity name must immediately follow the '&' in the entity reference.
Jeremy
  • 84
  • 8

1 Answers1

0

No, your input is not XML and there is no way of pretending that it is. Change your program so that it generates proper XML. The best way to do this is by using an XML serialization library rather than constructing your XML by hand. I don't know what serialization libraries are available for C++ but I'm sure they exist.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164