I got an XML file familiar with this:
<root>
<carnumber>12</carnumber>
<carcolor>2</carcolor>
<cartype>5</cartype>
</root>
As you can see, I have some Elements with values / texts in it. An automobile element, for example, can take values from 1 to 1000. But a carcolor element can take values from 1 to 5, and cartography from 1 to 10.
The important thing is that the values of the carcolor and cartype elements mean something. carcolor "2" means red, "1" blue, etc.
Therefore, I need to present to the user not the values, but the real value of the values.
I found that I am creating several classes that represent elements with existing real values, and everything became really complex, and I don't know if this was / in the best way.
A friend of mine suggested I use XML serialization because my XML file is static. He will never change.
My question is simple. I just want to know how you solve this problem. My idea contains classes that represent an XML element, such as the file type in this class. I have a dictonary with a couple. This represents the values in the XML file, and the string is the value of this value. And I use a lot of Linq to navigate and edit values.
Thanks again!
Tomytomy
source
share