commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [configuration][digester] Other XML file formats...
Date Sun, 15 Feb 2004 14:25:21 GMT
hi mark

(sorry this is a little late.)

i don't think that there's anything in the standard digester rules that 
does what you want - but it'd be very easy to create a custom rule 
which would fit the bill.

something like:

public class JNDIRule extends Rule {
	public void begin(String namespace, String name, Attributes attributes)
			throws Exception {
		String type = attributes.getValue("type");
		String key = attribute.getValue("key");

		Context ctx = new InitialContext();
		Object someObject = ctx.lookup("java:comp/env/userconfig/type/key
		...
		do some processing
		...
	]
}

- robert

On 11 Feb 2004, at 18:52, Mark R. Diggory wrote:

> I have an XML config file format I'm trying to read into Configurator 
> or Digester which is not the standard format expected (and which I 
> cannot change), it looks like:
>
> <Config name="user_config">
>     <Variable type="option" key="DEBUG" value="1" />
>     <Variable type="option" key="SQUID_DIR_SIZE" value="750" />
>     <Variable type="option" key="auto" value="1" />
>     <Variable type="option" key="build_all" value="0" />
>     <Variable type="option" key="help" value="0" />
>
> which I'd like to get handled as
> value = user_config.<type>.<key> or value = user_config.<type>[<key>]
>
> my ultimate goal is to plug it into the tomcat JNDI Resources as to 
> attain something more like this in the long run:
>
> Context ctx = new InitialContext();
> ctx.lookup("java:comp/env/userconfig/<type>/<key>
>
> Is there a quick way I can get to this format using using digester or 
> configuration?
>
> thx,
> Mark
>
> -- 
> Mark Diggory
> Software Developer
> Harvard MIT Data Center
> http://www.hmdc.harvard.edu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message