use of XmlAttribute() to retrieve in C# visual2005

n00bf0rc3

New Member
I'm trying to do something, that may be extremely simple so please bear with me, I just want to get an Attribute from an XML file into a string in my C# code. here's what I have:XML:\[code\]<MonitorResponseRecord Enabled="false" DisplayName="ValveFailureAtCentralPosition"> <ExpressionMonitor> <AlarmName>Valve_Position_Fault</AlarmName> <Parameter> Sensor Position = {X}</Parameter> </ExpressionMonitor></MonitorResponseRecord><MonitorResponseRecord ... ... ...>... ...... ... and so on about 1600 times.\[/code\]C#:\[code\][Selrializable][XmlType("Alarm")] public class AlarmDefinition { public AlarmDefinition() {} public AlarmDefinition Clone() { AlarmDefinition clone = new AlarmDefinition(); clone.DisplayName = DisplayName; clone.Category = Category; clone.Color = Color; clone.Description = Description; return clone; } [XmlAttribute( ??????????? )] public string DisplayName = "";\[/code\]so does anyone know what I would need in the '???????????' section?I've tried:\[code\][XmlAttribute("MonitorResponseRecord",AttributeName = "DisplayName")] public string DisplayName = "";\[/code\]
 
Back
Top