org.apache.commons.digester.substitution

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » XML » digester » org.apache.commons.digester.substitution 
org.apache.commons.digester.substitution
Package Documentation for org.apache.commons.digester.substitution Package Provides for manipulation of xml attributes and element body text before the data is processed by any Rule objects.

The class org.apache.commons.digester.Substitutor defines an abstract interface for mechanisms which manipulate xml attributes and body text. The Digester method setSubstitutor can be used to define a concrete substitutor that will be applied to the data before it is passed to the matching rules.

This package provides some useful concrete implementations of the abstract Substitutor class. In particular, it provides an implementation that allows the application to define "variables" which the input data can reference using a syntax such as "${user.name}".

Here's an example of setting up the VariableSubstitutor:

  // 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);
Java Source File NameTypeComment
MultiVariableExpander.javaClass
TestAll.javaClass Entry point for all substitution package tests.
VariableAttributes.javaClass

Wrapper for an org.xml.sax.Attributes object which expands any "variables" referenced in the attribute value via ${foo} or similar.

VariableExpander.javaInterface

An Interface describing a class capable of expanding strings which may contain variable references.

VariableExpansionTestCase.javaClass

Test Case for the variable expansion facility in Digester.

VariableSubstitutor.javaClass Substitutor implementation that support variable replacement for both attributes and body text. The actual expansion of variables into text is delegated to VariableExpander implementations. Supports setting an expander just for body text or just for attributes. Also supported is setting no expanders for body text and for attributes.
w_ww__.___j__a_v_a2_s.__c__o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.