xml serialization - c# Serializable Get the attribute and value from a list item -
i'm hoping can me following. i'm trying item description , value following xml in c#
<houselist> <house key="bungalow" description="bungalow house"> <houseitem description="bedroom">4</houseitem> <houseitem description="bathroom">3</houseitem> <houseitem description="kitchen">2</houseitem> </house> </houselist>
at moment i'm trying this:
[serializable] [xmltype(typename = "house")] public class house { private string key; private string description; private list<houseitem> items; ...... public list<linkitem> items { { return items; } set { items = value; } } [serializable] [xmltype(typename = "houseitem")] public class houseitem { private string value; private string description; [xmlattribute(attributename = "description")] public string description { { return description; } set { description = value; } } [xmltext(datatype = "string")] public string value { { return value; } set { this.value = value; } } }
i've had no joy far populating list of houseitem , wondering if spot when i'm going wrong? or advice appreciated!
thanks!
Comments
Post a Comment