I have a situation here, I have to write a simple WPF apps with a textbox and a button, textbox is for "en", "fr", "ru", etc...
I have a lot of files with huge number of data like this. Consider this is a file
<?xml version="1.0" encoding="UTF-8"?>
<params>
<btestsir xml:lang="fr" tId="HHXAF">Test Sirène :</btestsir>
<btestsir xml:lang="en" tId="HHXAF">Test Siren :</btestsir>
<btestsir xml:lang="pt" tId="HHXAF">Testar sirene:</btestsir>
<btestsir xml:lang="ru" tId="HHXAF">Тест сирены:</btestsir>
<btestbeep xml:lang="fr" tId="HHXA2">Test Bip :</btestbeep>
<btestbeep xml:lang="en" tId="HHXA2">Test Beep :</btestbeep>
<btestbeep xml:lang="pt" tId="HHXA2">Testar aviso sonoro:</btestbeep>
<btestbeep xml:lang="ru" tId="HHXA2">Тест гудка:</btestbeep>
</params>
Now if I select "en" through my application, and click on the button then only two strings whose xml:lang="en" values match will be copied to an excel sheet. and would display something like this.
For English language
For Russian language
I have tried this
StreamReader reader = new StreamReader(strFilepath);
string line;
while(null != (line = reader.ReadLine()))
{
string[] s1 = line.Split('>');
string[] s2 = s1[1].Split('<');
if(s1[0].Contains("xml:lang="))
{
}
}
Logic behind this is simple first I want to split every line using ">"
So s1[0] will have <btestsir xml:lang="fr" transId="HHXAF"
s1[1] will have Test Sirène :</btestsir>
But here the problem I am facing is how to fetch the "key" for a specific language xml:lang= and put that key-value pair to excel sheet, As I have shown in the picture. Fetching the "value" is easy s2[0] will have the value.
But this two key-value pair should be match and then put into the excel sheet, then it will again continue for the next line. Edit: One point here the key value pair should be put into different excel-sheet for different language files. excel-sheet.en.xlsx will contain all "en", excel-sheet.fr.xlsx will contain all "fr", etc
As I said I have huge files and it should work seamlessly without manual intervention.
Can you help me please!
Thanks

