KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom4j > o3impl > DefaultProcessingInstruction


1 /*
2  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
3  *
4  * This software is open source.
5  * See the bottom of this file for the licence.
6  *
7  * $Id: DefaultProcessingInstruction.java,v 1.2 2003/06/10 16:18:36 per_nyfelt Exp $
8  */

9
10 package org.ozoneDB.xml.dom4j.o3impl;
11
12 import org.dom4j.Element;
13
14 import java.util.Map JavaDoc;
15
16 /** <p><code>DefaultProcessingInstruction</code> is the default
17  * Processing Instruction implementation.
18  * It is a doubly linked node which supports the parent relationship
19  * and can be modified in place.</p>
20  *
21  * @author <a HREF="mailto:jstrachan@apache.org">James Strachan</a>
22  * @version $Revision: 1.2 $
23  */

24 public class DefaultProcessingInstruction extends FlyweightProcessingInstruction {
25
26     /** The parent of this node */
27     private Element parent;
28
29     /** <p>This will create a new PI with the given target and values</p>
30      *
31      * @param target is the name of the PI
32      * @param values is the <code>Map</code> values for the PI
33      */

34     public DefaultProcessingInstruction(String JavaDoc target, Map JavaDoc values) {
35         super(target, values);
36     }
37
38     /** <p>This will create a new PI with the given target and values</p>
39      *
40      * @param target is the name of the PI
41      * @param values is the values for the PI
42      */

43     public DefaultProcessingInstruction(String JavaDoc target, String JavaDoc values) {
44         super(target, values);
45     }
46
47     /** <p>This will create a new PI with the given target and values</p>
48      *
49      * @param parent is the parent element
50      * @param target is the name of the PI
51      * @param values is the values for the PI
52      */

53     public DefaultProcessingInstruction(Element parent, String JavaDoc target, String JavaDoc values) {
54         super(target, values);
55         this.parent = parent;
56     }
57
58     public void setTarget(String JavaDoc target) {
59         this.target = target;
60     }
61
62     public void setText(String JavaDoc text) {
63         this.text = text;
64         this.values = parseValues(text);
65     }
66
67     public void setValues(Map JavaDoc values) {
68         this.values = values;
69         this.text = toString(values);
70     }
71
72     public void setValue(String JavaDoc name, String JavaDoc value) {
73         values.put(name, value);
74     }
75
76
77     public Element getParent() {
78         return parent;
79     }
80
81     public void setParent(Element parent) {
82         this.parent = parent;
83     }
84
85     public boolean supportsParent() {
86         return true;
87     }
88
89     public boolean isReadOnly() {
90         return false;
91     }
92 }
93
94
95 /*
96  * Redistribution and use of this software and associated documentation
97  * ("Software"), with or without modification, are permitted provided
98  * that the following conditions are met:
99  *
100  * 1. Redistributions of source code must retain copyright
101  * statements and notices. Redistributions must also contain a
102  * copy of this document.
103  *
104  * 2. Redistributions in binary form must reproduce the
105  * above copyright notice, this list of conditions and the
106  * following disclaimer in the documentation and/or other
107  * materials provided with the distribution.
108  *
109  * 3. The name "DOM4J" must not be used to endorse or promote
110  * products derived from this Software without prior written
111  * permission of MetaStuff, Ltd. For written permission,
112  * please contact dom4j-info@metastuff.com.
113  *
114  * 4. Products derived from this Software may not be called "DOM4J"
115  * nor may "DOM4J" appear in their names without prior written
116  * permission of MetaStuff, Ltd. DOM4J is a registered
117  * trademark of MetaStuff, Ltd.
118  *
119  * 5. Due credit should be given to the DOM4J Project
120  * (http://dom4j.org/).
121  *
122  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
123  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
124  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
125  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
126  * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
127  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
128  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
129  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
130  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
131  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
132  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
133  * OF THE POSSIBILITY OF SUCH DAMAGE.
134  *
135  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
136  *
137  * $Id: DefaultProcessingInstruction.java,v 1.2 2003/06/10 16:18:36 per_nyfelt Exp $
138  */

139
Popular Tags