现在我被分配到网络项目,使用asp.net mvc与c#。 我需要像下面加载一些XML文件,这将告诉我需要创建哪些控件。 这也告诉,控件的类型,它们的价值,尺寸和位置。我无法找到我如何做的方式?请引导我正确的方式。XML文件到.net的网页
<Object type="System.Windows.Forms.Form" name="frmShow" >
<Object type="System.Windows.Forms.RadioButton" name="optOne">
<Property name="Size">86, 24</Property>
<Property name="Text">Option1</Property>
<Property name="Location">175, 126</Property>
</Object>
<Object type="System.Windows.Forms.CheckBox" name="chkOne">
<Property name="Size">84, 24</Property>
<Property name="Text">CheckOne</Property>
<Property name="Location">84, 126</Property>
</Object>
<Object type="System.Windows.Forms.TextBox" name="txtOne">
<Property name="Size">177, 20</Property>
<Property name="Text">ABC</Property>
<Property name="Location">84, 88</Property>
</Object>
<Object type="System.Windows.Forms.Label" name="lblOne">
<Property name="Size">100, 23</Property>
<Property name="Text">Name</Property>
<Property name="Location">8, 91</Property>
</Object>
<Object type="System.Windows.Forms.TextBox" name="txtTwo">
<Property name="Size">177, 20</Property>
<Property name="Text">Home Address</Property>
<Property name="Location">84, 50</Property>
</Object>
<Object type="System.Windows.Forms.Label" name="lblTwo">
<Property name="Size">100, 23</Property>
<Property name="Text">Address</Property>
<Property name="Location">7, 53</Property>
</Object>
<ItemDataSet>
<ItemTable>
<TableName>tblItemOne</TableName>
<Row1>
<Repeat>True</Repeat>
<ItemName>Item001</ItemName>
<Qty>10</Qty>
<Price>1000</Price>
</Row1>
<Row2>
<Repeat>True</Repeat>
<ItemName>Item002</ItemName>
<Qty>20</Qty>
<Price>2000</Price>
</Row2>
<Row3>
<Repeat>false</Repeat>
<ItemName>Item003</ItemName>
<Qty>30</Qty>
<Price>3000</Price>
</Row3>
</ItemTable>
</ItemDataSet>
</Object>
它可能是一个webf orm被序列化成xaml。尝试反序列化它。 – 2010-12-15 06:49:46
你能解释一下我的细节吗?其实我不熟悉webform.please给我一些例子或链接,谢谢。 – Chong 2010-12-15 07:10:42
XmlSerializer可以将对象转换为XML。你的XML可能是一个序列化的对象。 如果是这样,您可以反序列化XML,并将其转换为对象。它可能不是这种情况,但 这是值得一看。 http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx – 2010-12-15 08:34:31