I am developing several complex classes in VB.net (but you can write your answer in C # if you want: P) that contain data that needs to be loaded from XML. The obvious solution, of course, is to create a serializable class, therefore, to automate the boot process.
Now my problem is this: the XML structure is fixed, and I cannot change it, and it has some troubles that cause the pain to serialize. Here is an example of a tiny DTD snippet that better explains the problem:
<!ELEMENT Relationship ( AttributePairs | AscendCaption | DescendCaption | ErrPreventInsertOrUpdateChild | ErrPreventDeleteParent | ErrPreventUpdateParent |ExtendedProperties |HiddenProperties )* >
<!ATTLIST Relationship
CountAggregates CDATA #IMPLIED
CountReplicates CDATA #IMPLIED
OnParentUpdate (PreventIfChildren|UpdateChildren)
OnParentDelete (PreventIfChildren|DeleteChildren|NullChildrenForeignKey)
IsEnforce (True|False) #REQUIRED
OnChildInsertOrUpdate (PreventIfNoParent|InsertParentIfNone)
ChildRoleName CDATA
ParentRoleName CDATA
ParentAttributeGroupInstance CDATA
ChildAttributeGroupInstance CDATA
>
<!--Lots of other sutff not needed for this example -->
As you can see, all of the above attributes can be easily serialized by simply declaring the corresponding property and decorating it with a tag <XmlAttribute()>. With the exception of:
IsEnforce (True | False) #REQUIRED
True False xml (- T F), .
... , , - IXMLSerializable , , , , "" /, , .
, , : MIX ? ..: , "" "" ? ( , , )