XML -> Java Properties -> XML

Subject: XML -> Java Properties -> XML
From: Dylan Parker <dylan@xxxxxxxxxxxxx>
Date: Thu, 12 Oct 2000 17:45:22 -0700
Hello, all.

I am in the process of writing an XSLT sheet that converts from an XML file into
a Java Properties file...

Why convert to the inferior properties files? Well.. until Java can read
directly from an XML file and perform localization procedures with it... the
properties will have to suffice. (If anybody knows of ResourceBundle classes
that use XML.. LET ME KNOw!)

Anyways.. so I want this XML...
===============================
<tag1>
      <tag2>
            <tag3>Here is tag3 Text</tag3>
      </tag2>
      <tag4>
            Here is some tag4 text...
            Here is another line.. CR should get converted to \n
            Here is some embedded HTML <BR/><BR/><BR/> They should be copied
            across.
      </tag4>
</tag1>
================================
to be converted into this format of a property file
================================
tag1.tag2.tag3=Here is tag3 Text
tag1.tag4=Here is some tag4 text...\nHere [etc...] HTML <BR/><BR/>[etc...]
================================

So effectively keeping the structure of the xml.. just converted to the dotted
notation... also Carriage returns are converted to \n's ... and HOPEFULLY the
HTML within the XML is passed through and kept (yeah right!)...

I DO have a script that is working somewhat... but it doesn't like the HTML tags
inside of the text... it effectively treats them like two separate text sections
with an XML node inbetween (which it is)...

I then added a namespace to all of the XML sections to aid in filtering the non
name-spaced HTML elements.. that's where I am now and it is getting pretty ugly.
Anyone already done this? Can I (hopefully) stop re-inventing the wheel?

Ideally it would be nice to also convert from the Java Properties file BACK to
the XML... but I think that is more of a PERL job than XSL... any PERL scripts
out there to do this? (I know.. OT ..)

Any help appreciated

Thanks,
Dylan Parker



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread