[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sorting/reordering XML files - Implementation/Design questions
[Note: this is cross-posted between perl-xml and xml-dev. I thought twice before I did this, but I couldn't talk myself out of it...] I have a very simple app that I want to do. Basically, I have an address list xml file built up using the vcard DTD, wrapped in a vCardSet. It looks like: <?xml version="1.0" encoding="UTF-8"?> <vCardSet name="GRKs vCards"> <vCard> <fn>Glenn Kronschnabl</fn> <n> <family>Kronschnabl</family> <given>Glenn</given></n> <org><orgname>UT Austin</orgname></org> </vCard> <vCard> .... </vCard> </vCardSet> Note that the order of <vCard>'s are not in any particular order. So, I would like to be able to sort (on family, given, etc) then print using both XSL/DSSSL. I am shooting for a telephone book-like printout ala Microsoft Outlook 2-column phone book printout. Q. Should I pre-sort using Perl-XML and XML::DOM and write out a new XML file? Right now I have been trying to use XML::DOM and I'm close but I'm not sure what I am trying to do even makes sense? The advantage of using the DOM is that I don't have to know anything about what I'm actually sorting accept for the relevant fields (the opposite would be to create the vCard data structure I guess). What are other people doing in this area? What is the best way? Should I rearrange the nodelist in memory or should I construct a new nodelist and write it out (not worrying about preserver whitespace)? -or- Q. Could this be done using just SAX? What are the tradeoffs? -or- Q. Should I sort the xml list in DSSSL (would appear painful, at least to me). I have found snippets in the dssslist that appear to give a good start, but if anyone has such a function around, that would help. Actually, I presume that both could be used. Just seems like a Perl-XML solution would be more generic and could be re-used more often. Thanks for you inputs. Cheers, Glenn -------------------- Glenn R. Kronschnabl Applied Research Laboratories | grk@a... (PGP/MIME ok) The University of Texas at Austin | http://www.arlut.utexas.edu/~grk PO Box 8029, Austin, TX 78713-8029 | (Ph) 512.835.3642 (FAX) 512.835.3808 10,000 Burnet Road, Austin, TX 78758 | ... but an Aggie at heart! xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|