when non public i e private data is to be serialized a conventional binary formatting method is preferred the present invention provides the advantages of working with strongly typed classes while still having the flexibility of xml for example by using fields or properties of type xmlelement xmlattribute or xmlnode in strongly typed classes parts of the xml document instance can be read directly into xml objects attributes for the application programming interface api for xmlserializer 206 for controlling xml output and xml input are set forth in the following table the xmlanyelementattribute or xmlanyattributeattribute attributes can be applied to fields or properties that return arrays of xmlelement xmlattribute or xmlnode objects for reading unmapped elements and attributes into these fields or properties thus documents can be processed that have additional elements and attributes that were added after design time and that were not known when the strongly typed classes were designed when a property or field returns a complex object such as an array or a class instance xmlserializer 206 converts the complex object to an element nested within the main xml document for example the first class in the following exemplary c code returns an instance of the second class the serialized xml output provided by xmlserializer 206 given an instance of the classes mycontainer and myobject will be for this example u201c my string u201d is a particular value the class objectname in the given instance of the classes mycontainer and myobject when only the states of objects are saved the class does not need to be modified when however xml.