Thanks for the ideas, Dan. I had considered these before hand, but I wanted to try and work within the standard functions without having to maintain information about attribute order in things like lists.
The XML spec specifically states that attributes are unorderd, but I was hoping there was a way to do this would too much of a hack. Thanks much, -- Alex Sherwood Hunter Warfield >Alex, > > >The xmlAttributes "property" is only a struct. I was hoping it might also >return a hidden array (so that you could do >oXml.parent.child.xmlAttributes[1], but alas that's not the case.) > >Anyway, here are some possible solutions. > >1) If you know you attribute list is relatively fixed (meaning you have >name, cellphone, etc) and you want them always printed in a specific manor, >you could create a list of the attribute names in the order you want them >processed. Then instead of looping through the xmlAttribute struct as a >collection, you loop through the list. Example: > ><cfset lstAttributes = "name,cellphone"> ><cfloop index="sAttrib" list="#lstAttributes#"> > <cfif structKeyExists(oNode.xmlAttributes, sAttrib)> > <cfoutput> > #sAttrib# = #oNode.xmlAttributes[sAttrib]#<br /> > </cfoutput> > </cfif> ></cfloop> > >Obviously, you could use an array instead of a list if you want to include >label friendly descriptions. > >2) If you have no idea what attributes are going to be present, but you need >to dump them out in a specific order you could use the toString() function >on the node to convert the node to it's original XML. You'll need to strip >out the <?xml version="1.0" encoding="UTF-8"?> declaration, but then you >could parse the tag to manually build a list of the attributes. Not very >elegant. > >3) Use a 3rd party Java XML DOM parser like Xerces--which using the >Attributes interfaces should return the attributes in order. > >-Dan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226668 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

