[jdom-interest] Using variables in XML files

Laurent Bihanic laurent.bihanic at atosorigin.com
Wed May 15 06:20:41 PDT 2002


Isaac Sparrow wrote:
> One solution would be to find and replace these variables while the XML file 
> is being parsed (although I don't know how). 
> 
You could use a SAX filter (see org.xml.sax.XMLFilter interface) to scan 
attribute values in startElement(), recognize the "${...}" pattern (maybe 
using regexp), evaluate the expression and replace it by the variable value.
Of course this assumes you are using SAXBuilder to create the JDOM documents.

The samples/sax directory of the JDOM distribution contains examples of SAX 
filter.

Laurent




More information about the jdom-interest mailing list