2
Answers

Reading characters from XML file

John Simoes

John Simoes

16y
3.2k
1

Hi everyone, I'm having a problem where in an XML file, if the words in it contain a colon at the end, my translator application does not recognize it and does not find the translated word in a database. The XML file has thousands of words, therefore I cannot simply edit the XML file. In the database for example, there is a word Called Log:   There is an equivelent translated for Called Log but not Called Log:  <-- with a colon, so the program does not translate the word since it has a colon

foreach (DataGridViewRow row in dataGridView1.Rows)

{

var query = transDataContext.Translations.Where(trans => trans.English == row.Cells["Value"].Value.ToString());

if (query.Count() > 0)

{

Translation translationFound = query.First();

if (!translationsFound.Contains(row.Cells["Value"].Value.ToString()))

{

if(translationFound.French != string.Empty)

translationsFound.Add(row.Cells["Value"].Value.ToString(), translationFound.French);

}

}

if ((string)translationsFound[row.Cells["Value"].Value] != string.Empty)

{

row.Cells["Translation"].Value = translationsFound[row.Cells["Value"].Value];

}

 

That is part of the code which searches the Database for a equivalent word it works flawlessly for words without colons at the end. How would I construct a check to ignore if there is a colon at the end?

Answers (2)