[Mono-devel-list] Re: Xml serializer questions

Erik LeBel eriklebel at yahoo.ca
Tue Mar 18 15:39:48 EST 2003


Hi Atsushi,
I may have poorly worded the first question. The use of Order to re-order the output of members of an object seems fairly straightforward. Its a good idea too.
My concern is that given it "internal" nature of the property, it cannot be used in an attribute:
     [XmlElement("element",Order=4)]...
cannot be used outside of the System.Xml library. Or am I mistaken? Should this property be public?
Secondly, if users find themselves using this property in their code, it will not compile on .NET. Now I'm not saying that that is neccessarily bad, but I think that compatibility is desireable.
This is driven by trying to use serialization to generate WSDLs, order matters. Also since we're on the topic, do you have any idea how attributes could be used to surpress the generation of a collection members top-level element tags?
   <items><item/><item/></items>
to
   <item/><item/>
cheers,
erik
PS thanks for the feedback. Any ideas on what such a test case would look like?
 ginga at kit.hi-ho.ne.jp wrote:Hello,

> 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?). 

Below is a comment I found in XmlSerializer.FillTypeTable:


// Sort the attributes for the members according to their Order
// This is an extension to MS's Implementation and will be useful
// if our reflection does not return the same order of elements
// as MS .NET impl



> 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).

Yeah, I think you're right. I fixed in cvs.

Hmm... we should dig some directories and add testcases.

Thanks,
Atsushi Eno



---------------------------------
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/f93143f9/attachment.html 


More information about the Mono-devel-list mailing list