Parsing a text file with custom syntax [duplicate]

This question already has an answer here:

THIS IS NOT AN XML FILE AND I'M NOT USING XML FILES. Merely trying to parse a text file with xml like taggs.

I have a text file containing xml like text and I have to parse individual values to store in individual variables.

<product>
<name>name1</name> 
<desc>desc1</desc>
<cost>233.90</cost>
<rdate>25122015</rdate>
<imgsrc></imgsrc>
<drate>10</drate>
</product>
<product>
<name>name2</name> 
<desc>desc2</desc>
<rdate>25122015</rdate>
<imgsrc></imgsrc>
<drate>10</drate>
<cost>243.90</cost>
</product>
...

Is there a way to parse such a text file based on those tags in C#?

Edit: This is not an xml file and I'm not allowed to use 3rd party librarys to parse it.


Click here view more answers http://ift.tt/1Potcdd