1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.astrogrid.applications.commandline.digester;
15
16 import org.apache.axis.utils.XMLUtils;
17 import org.apache.commons.digester.BeanPropertySetterRule;
18 import org.w3c.dom.Element;
19 import org.w3c.dom.Node;
20
21 /***
22 * A rule that incorporates all of the enclosed elements into a property
23 * @author Paul Harrison (pah@jb.man.ac.uk)
24 * @version $Name: $
25 * @since iteration4
26 */
27 class AllBodyIncElementsRule extends BeanPropertySetterRule {
28 private static StringBuffer contents;
29 private boolean needinner;
30
31 public AllBodyIncElementsRule(String propName, boolean inner) {
32 super(propName);
33 needinner = inner;
34 }
35
36
37
38
39 public void end(String namespace, String name) throws Exception {
40
41 Object o = getDigester().peek();
42 if (o instanceof Node) {
43 String s;
44
45 if (needinner) {
46 s = XMLUtils.getInnerXMLString((Element)o);
47 }
48 else
49 {
50 s= XMLUtils.ElementToString((Element)o);
51 }
52 getDigester().pop();
53 bodyText = s;
54 }
55
56 super.end(namespace, name);
57
58 }
59
60 }