1
2
3
4
5
6
7
8 package org.dom4j.tree;
9
10 import java.util.Map;
11
12 import org.dom4j.Element;
13
14 /***
15 * <p>
16 * <code>DefaultProcessingInstruction</code> is the default Processing
17 * Instruction implementation. It is a doubly linked node which supports the
18 * parent relationship and can be modified in place.
19 * </p>
20 *
21 * @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
22 * @version $Revision: 1.13 $
23 */
24 public class DefaultProcessingInstruction extends
25 org.dom4j.tree.FlyweightProcessingInstruction {
26 /*** The parent of this node */
27 private Element parent;
28
29 /***
30 * <p>
31 * This will create a new PI with the given target and values
32 * </p>
33 *
34 * @param target
35 * is the name of the PI
36 * @param values
37 * is the <code>Map</code> values for the PI
38 */
39 public DefaultProcessingInstruction(String target, Map values) {
40 super(target, values);
41 }
42
43 /***
44 * <p>
45 * This will create a new PI with the given target and values
46 * </p>
47 *
48 * @param target
49 * is the name of the PI
50 * @param values
51 * is the values for the PI
52 */
53 public DefaultProcessingInstruction(String target, String values) {
54 super(target, values);
55 }
56
57 /***
58 * <p>
59 * This will create a new PI with the given target and values
60 * </p>
61 *
62 * @param parent
63 * is the parent element
64 * @param target
65 * is the name of the PI
66 * @param values
67 * is the values for the PI
68 */
69 public DefaultProcessingInstruction(Element parent, String target,
70 String values) {
71 super(target, values);
72 this.parent = parent;
73 }
74
75 public void setTarget(String target) {
76 this.target = target;
77 }
78
79 public void setText(String text) {
80 this.text = text;
81 this.values = parseValues(text);
82 }
83
84 public void setValues(Map values) {
85 this.values = values;
86 this.text = toString(values);
87 }
88
89 public void setValue(String name, String value) {
90 values.put(name, value);
91 }
92
93 public Element getParent() {
94 return parent;
95 }
96
97 public void setParent(Element parent) {
98 this.parent = parent;
99 }
100
101 public boolean supportsParent() {
102 return true;
103 }
104
105 public boolean isReadOnly() {
106 return false;
107 }
108 }
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145