[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Using CVS to maintain XML

From: Shankar Unni
Subject: RE: Using CVS to maintain XML
Date: Wed, 11 Dec 2002 19:21:10 -0800

Wayne Johnson writes:

> Anyone know a good way to manage XML in CVS?  Is there a program
> that will sort an XML file?  To make sure that similar tags always
> appear in the same order?  Am I just dreaming?

It shouldn't be hard to write a small program that does this using the
Xerces-C or Xerces-Java APIs.  I would not recommend building this into
CVS, but you can certainly "strongly encourage" your users to run this
program each time before they attempt a checkin or merge (update).

The biggest problem you'll face, however, is that InstallAnywhere freely
renames the internal nodes that it generates, so an innocuous edit will
completely rename about a quarter of your nodes. No amount of node
sorting will fix this for you.

Anyway, if you want to go down this path, perhaps you can change the
installAnywhere invocation script to automatically call an XML sorter.
I had to do something like this at a previous job, where I had to
translate the absolute path names buried in the .iap file into a
templatized form, so that other developers checking out the file could
work with a proper path at their end.

Anyway, I ended up doing the following:

(a) I massaged the .iap file, and wrote a .iap_master file with the
templatized paths. I only ever checked in the .iap_master file.
(b) Created a couple of "ant" targets: one which I would execute to
massage the .iap_master file into the .iap file before launching
installAnywhere, and another that would clean up the saved .iap file
back into a .iap_master file, which I could use to check back in to CVS.

But because of the "unpredictable node renaming", we carefully avoided
concurrent editing sessions by placing a watch on the file..

reply via email to

[Prev in Thread] Current Thread [Next in Thread]