[
Lists Home |
Date Index |
Thread Index
]
Hi Michael,
Could you give some pointers? I am really new at this. Thanks.
Peter
> -----Original Message-----
> From: Michael Kay [mailto:michael.h.kay@ntlworld.com]
> Sent: Tuesday, February 10, 2004 5:29 PM
> To: 'Peter Loh Yoon Chao'; xml-dev@lists.xml.org
> Subject: RE: [xml-dev] Existing libraries/mechanisms for alphabetically
> sorting and formatting XML files
>
>
> I don't think you'll find an off-the-shelf solution (structured tags
> like <a.b.c> are pretty weird) but it's not difficult to express this
> transformation in XSLT, especially if you split it into two phases.
>
> Michael Kay
>
> > -----Original Message-----
> > From: Peter Loh Yoon Chao [mailto:yoonchao@starhub.net.sg]
> > Sent: 10 February 2004 01:51
> > To: xml-dev@lists.xml.org
> > Subject: [xml-dev] Existing libraries/mechanisms for
> > alphabetically sorting and formatting XML files
> >
> >
> > Hi,
> >
> > I currently have XML files with a flat key-value structure
> > and the elements are unsorted and without proper formatting, e.g.
> >
> > <main>
> > <e.f.g>
> > <value xml:lang="en">data 2</value>
> > </e.f.g>
> > <a.b.c>
> > <value xml:lang="en">data 1</value>
> > </a.b.c>
> > ...
> > </main>
> >
> > Are there any existing libraries or mechanisms to do the following?
> > - convert the file structure into a hierarchical tree structure
> > - alphabetically sorting the individual elements at each level
> > - indent the individual nodes properly in the resulting XML file
> >
> > The resulting XML file should look something like the following:
> >
> > <main>
> > <a>
> > <b>
> > <c>
> > <value xml:lang="en">data 1</value>
> > </c>
> > </b>
> > </a>
> > <e>
> > <f>
> > <g>
> > <value xml:lang="en">data 2</value>
> > </g>
> > </f>
> > </e>
> > ...
> > </main>
> >
> > I would rather not reinvent the wheel if there are existing
> > libraries/mechanisms to do this sort of thing. Thanks in
> > advance for any input.
> >
> > Peter
> >
> >
> > -----------------------------------------------------------------
> > The xml-dev list is sponsored by XML.org
> > <http://www.xml.org>, an initiative of OASIS
> <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
|