Updated: 17.05.2003; 11:52:05.
Nielsen's Weblog
.NET [use your Context dude]
        

14 April 2003

[System.Xml.Xsl.Serialization.Xsl.Sort("asc")]

Imagine I want to serialize a class to xml using the FileStream and XmlSerializer, no problem, but what if I want to sort my nodes upon serializing my class. This could probably be done  using the XPathNavigator and  XslTransform. But perhaps a more neat way would be to mark the node with this non existing attribute [System.Xml.Xsl.Serialization.Xsl.Sort("asc")]

I need this feature in .NET a.s.a.p :-).

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.jcsharp.net/2003/x/y/")]

[System.Xml.Serialization.XmlRootAttribute("xmltest", Namespace="http://www.jcsharp.net/2003/x/y/", IsNullable=false)]

public class xmltext {

/// remarks

// [System.Xml.Xsl.Serialization.Xsl.Sort("asc")] <-- I WOULD LOVE TO SEE SUCH A FEATURE HERE.

[System.Xml.Serialization.XmlArrayAttribute(ElementName = "Authors", IsNullable = false)]

[System.Xml.Serialization.XmlArrayItemAttribute("Books", Type = typeof(System.String), IsNullable = false)]

public ArrayList Book;

}

"Ask, and it shall be given you; Seek, and ye shall find; Knock, and it shall be opened unto you"

 


7:22:48 PM    comment []

© Copyright 2003 Allan Nielsen.
 
April 2003
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Mar   May


Click here to visit the Radio UserLand website.

Subscribe to "Nielsen's Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.