XML : C# make a list tree from xml file

Im trying to learn C# and I have the following task I want to tackle. I am not looking for an absolute answer but more of a push in the right direction in how to solve this problem.

I have an XML file that contains information about a userinterface ( GUI ). Here is an oversimplified example of what it may look like.

  <?xml version="1.0" encoding="utf-8"?>  <Gui w="320" h="480" bckColor="4281348144" id="abc123">  <Grp text="Livingroom" id="def123">  <Page text="lightSaveLivingroom" id="eid-485">    <Element text="Normal" x="130" y="120" w="130" h="40" type="Text" />    <Element text="Normal" x="130" y="120" w="130" h="40" type="Text" >      <State type="Release">        <Action action="NewValue" id="10454" value="3" />        <Action action="NewState" id="11456" value="0" />      </State>      <State type="Pressed" bckImage="circle_on.svg" fontCol="4294967295" />      <State type="Selected" bckImage="circle_on.svg" img="checkbox.svg" fontCol="4294967295" matchType="EQUAL" matchValue="3" />      <State type="Hold" bckImage="circle_off.svg" fontCol="4294967295" />    </Element>    <Element scaleFlag="64" text="Stemning" x="130" y="170" w="130" h="40" id="eid-491" type="Text" txtAlign="LeftCenter" fontSize="20" fontCol="4294967295" />  </Page>    

I want to convert this to html and be able to easily convert it back. My idea is to have an object, list or some other datatype that can store the xml nodes and its attributes. I want to easily be able to traverse this object and apply changes easily to it.

Like i said. Im looking for a gentle push in the right direction.

No comments:

Post a Comment