commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject cvs commit: jakarta-commons/digester/src/java/org/apache/commons/digester/substitution package.html
Date Mon, 19 Apr 2004 08:33:16 GMT
skitching    2004/04/19 01:33:16

  Modified:    digester/src/java/org/apache/commons/digester/substitution
                        package.html
  Log:
  Provide example of setting up VariableSubstitutor.
  
  Revision  Changes    Path
  1.2       +17 -0     jakarta-commons/digester/src/java/org/apache/commons/digester/substitution/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/substitution/package.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- package.html	18 Apr 2004 07:26:23 -0000	1.1
  +++ package.html	19 Apr 2004 08:33:15 -0000	1.2
  @@ -19,5 +19,22 @@
   the application to define "variables" which the input data can reference
   using a syntax such as "${user.name}".
   </p>
  +<p>Here's an example of setting up the VariableSubstitutor:</p>
  +<pre>
  +  // set up the variables the input xml can reference
  +  Map vars = new HashMap();
  +  vars.put("user.name", "me");
  +  vars.put("os", "Linux");
  +  
  +  // map ${varname} to the entries in the var map
  +  MultiVariableExpander expander = new MultiVariableExpander();
  +  expander.addSource("$", vars);
  +
  +  // allow expansion in both xml attributes and element text
  +  Substitutor substitutor = new VariableSubstitutor(expander);
  +
  +  Digester digester = new Digester();
  +  digester.setSubstitutor(substitutor);
  +</pre>
   </body>
   </html>
  
  
  

---------------------------------------------------------------------
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