[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Sorting/reordering XML files - Implementation/Design questions

  • From: "Glenn R. Kronschnabl" <grk@a...>
  • To: "Perl-XML Mailing List" <perl-xml@l...>
  • Date: Tue, 08 Dec 1998 09:05:34 -0600

sort xml nodelist
[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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.