Generic design for importing data via XML

gjbecv

New Member
I am designing a generic solution to import object data from an XML. In my application the class structure is like following:\[code\]class MyObject{ public string ID { get; private set; } // This may contain large set of values. public Dictionary<string, OtherClass> ObjectData { get; set; }; public MyObject() {}}class OtherClass{ public string SubProperty1 { get; set; } public string SubProperty2 { get; set; } public string SubProperty3 { get; set; }}\[/code\]There can be many other classes similar to \[code\]MyObject\[/code\] which may have properties of different types that needs to be imported.Schema design I've in my mind would generate following XML structure:\[code\]<BlobData DataType="MyObjectType"> <DataValues UniqueID="MyObjectID" Property="SerializedPropertyName"> <DataValue PointID="Point1" SubProperty="SubProperty1">Value1.1</DataValue> <DataValue PointID="Point2" SubProperty="SubProperty1">Value1.2</DataValue> <DataValue PointID="Point3" SubProperty="SubProperty1">Value1.3</DataValue> <DataValue PointID="Point1" SubProperty="SubProperty2">Value2.1</DataValue> <DataValue PointID="Point2" SubProperty="SubProperty2">Value2.2</DataValue> <DataValue PointID="Point3" SubProperty="SubProperty2">Value2.3</DataValue> </DataValues></BlobData>\[/code\]I am still confused whether this structure is sufficient for any future work that may come up. Please suggest if you have any experience of designing similar stuff.
 
Back
Top