[Mono-devel-list] Xml serializer questions

Erik LeBel eriklebel at yahoo.ca
Tue Mar 18 10:49:11 EST 2003


Xml serializer questions:

What purpose is XmlElementAttribute's Order property suposed to serve? It's marked as internal, and therefore cannot be used when describing a class' serialization rules (unless that class resides in the serialization library, no?). Ideally we could use it to specify the serialization order of elements. Though the code using this would not be portable to .NET, if it appeared in the class libraries, it would not need to be.

Why does XmlSerializer forcibly call the writter's WriteStartDocument and WriteEndDocument? If we only called these methods when the writer's WriteState says we are not already in a document, we could serialize and object into an already open and used XmlTextWriter (MS does something like this). This would make it easy to write custom/specialized serializers (though it looks to me like XmlSerializationWriter/Reader are meant to serve this purpose). A xml serializable object could then be embeded inside a containing xml document along with other such objects.

     writer.WriteStartDocument(false);
     writer.WriteStartElement(null, "people", null);
     
     XmlSerializer ser = new XmlSerializer(typeof(Employee));
     ser.Serialize(writer, me);

     writer.WriteEndElement();
     writer.WriteEndDocument();

thanks,
erik



---------------------------------
Post your free ad now! Yahoo! Canada Personals
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030318/89cb7aaa/attachment.html 


More information about the Mono-devel-list mailing list