Thanks for the reply, but that doesn't seem to be an XML object at all. Isn't that simply a string that looks like XML. Also, by using get () aren't you simply converting that string into an array anyway?
On Jan 22, 3:00 am, Ricardo Tomasi <ricardob...@gmail.com> wrote: > What kind ofsorting? > > xml= '<base>';xml+= '<item type="c">one</item>';xml+= '<item > type="b">two</item>';xml+= '<item type="d">three</item>';xml+= '<item > type="f">three</item>';xml+= '<item type="a">three</item>';xml+= '</base>'; > > var sorted = $(xml).filter('item').get().sort(function(a,b){ > var at = $(a).attr('type'), bt = $(b).attr('type'); > return (at < bt) ? -1 : 1; > > }); > > $(sorted).each(function(){ > console.log( this ); > > }); > > https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global... > > - ricardo > > On Jan 21, 10:01 pm, skube <sku...@gmail.com> wrote: > > > It seems jQuery is really great at traversing anXMLobject. It is > > quite easy to gather and filter node data. However I can't seem to > > find any information regardingsortingXMLusing jQuery. Is it > > possible? Or is there a plug-in? > > > I have a project which requires me to read anXMLfile, then filter > > and sort the data. Filtering I can do, but I have no idea how to sort > >XML. Since arrays are easily sortable in JS, my idea is to convert the > >XMLinto an array first, then filter the array (which is not as easy > > as filteringXMLw/ jQuery) then sort the array. > > > Does anyone have any better ideas? > > > thanks, > > skube