I have a string in the program that stores xml-style text, I would like to assign
I can use only C# and only .NET 2.0 i .NET 3.5
<Document>
<IdSprawy>vff24</IdSprawy>
<TaskNumber>0173196</TaskNumber>
<TestText>ferf24</TestText>
</Document>
I want final result: (theoretically, such results would be)
string Id = 'vff24';
string TaskNumber = '0173196';
string TestText = 'ferf24';
I don't know completely how to do it
I start writting sth like this:
public class A_StartActSerScr
{
public static void OnFormExit()
{
string TextXML; // this xml
// here i want to assign data from xml to variables via the "Document" class
// for exp.
string IdSprawyX = 'vff24';
string TaskNumberX = '0173196';
string TestTextX = 'ferf24';
}
}
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public class Document
{
[System.Xml.Serialization.XmlElement("IdSprawy")]
public string IdSprawyField{ get; set; }
[System.Xml.Serialization.XmlElement("TaskNumber")]
public string TaskNumberField{ get; set; }
[System.Xml.Serialization.XmlElement("TestText")]
public string TestTextField { get; set; }
}
I dont know hot to write classes correctly:
and how to write deserialize function: