Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sort an XML document using DataView

Reply
Thread Tools

Sort an XML document using DataView

 
 
=?Utf-8?B?RWQgQ2hpdQ==?=
Guest
Posts: n/a
 
      12-14-2004
Hi,

I am tring to use DataView Sort ability to sort an XML document, here are my
code snippet:

ds1.ReadXml("c:\temp\catalog1.xml")
ds1.Tables(0).DefaultView.Sort = "ProdName"
ds1.WriteXml("c:\temp\catalog2.xml")

Does not work at all, can someone help?

TIA



 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      12-14-2004
The Sort property only applies if you look at the table through a
DataView (the DefaultView in this case). Since a DataView doesn't have
a WriteXml method, you'd have to hand craft the code to write the XML
out in specific order (perhaps by looping through the records as
sorted by DefaultView).

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 14 Dec 2004 11:19:04 -0800, "Ed Chiu"
<> wrote:

>Hi,
>
>I am tring to use DataView Sort ability to sort an XML document, here are my
>code snippet:
>
> ds1.ReadXml("c:\temp\catalog1.xml")
> ds1.Tables(0).DefaultView.Sort = "ProdName"
> ds1.WriteXml("c:\temp\catalog2.xml")
>
>Does not work at all, can someone help?
>
>TIA
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorted DataView, but unsorted datalist when bound to the dataview CodeMonkey ASP .Net 1 02-04-2011 10:55 AM
Refer to an XML document from within an XML document Manish Hatwalne XML 1 07-13-2004 10:24 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM
Query on DataView.Sort Property Denzil ASP .Net 1 10-22-2003 11:01 PM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM



Advertisments
 



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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57