[jdom-interest] Using variables in XML files

Ian Lea ian at digimem.net
Wed May 15 02:54:01 PDT 2002


I do this by custom code that examines, and replaces
where necessary, values for known elements after the
XML has been loaded into a JDOM document. Only works
if you know the structure of the document in advance
although I guess could work with a TreeWalker method.

An alternative might be to filter the XML input stream
through some regexp search/replace code before passing
it to the parser.



--
Ian.
ian at digimem.net

> isaac.sparrow at visicomp.com (Isaac Sparrow) wrote 
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I would like to use variables in my XML files. For instance take the "value" 
> attribute in the following element:
> 
> <foo name="projDir" value="${user.home}" />
> 
> My question is what is the best way to replace these "variables" and when? 
> 
> One solution would be to find and replace these variables while the XML file 
> is being parsed (although I don't know how). 
> 
> Does anyone have any ideas on how to use variables in an XML file while 
> keeping their use hidden from other code in a application?

----------------------------------------------------------------------
Searchable personal storage and archiving from http://www.digimem.net/


More information about the jdom-interest mailing list