01: // Copyright (c) 2004 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.kawa.xml;
05:
06: import gnu.xml.*;
07:
08: /* #ifdef use:org.w3c.dom.Node */
09: // import org.w3c.dom.*;
10: /* #endif */
11:
12: public class KProcessingInstruction extends KNode
13: /* #ifdef use:org.w3c.dom.Node */
14: // implements org.w3c.dom.ProcessingInstruction
15: /* #endif */
16: {
17: public KProcessingInstruction(NodeTree seq, int ipos) {
18: super (seq, ipos);
19: }
20:
21: /* #ifdef use:org.w3c.dom.Node */
22: // public short getNodeType () { return Node.PROCESSING_INSTRUCTION_NODE; }
23: /* #endif */
24:
25: public String getNodeName() {
26: return getTarget();
27: }
28:
29: public String getData() {
30: return getNodeValue();
31: }
32:
33: /* #ifdef use:org.w3c.dom.Node */
34: // public void setData(String data) throws DOMException
35: // {
36: // throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
37: // "setData not supported");
38: // }
39: /* #endif */
40:
41: public String getTarget() {
42: return ((NodeTree) sequence).posTarget(ipos);
43: }
44:
45: public static KProcessingInstruction valueOf(String target,
46: String content) {
47: NodeTree tree = new NodeTree();
48: tree.writeProcessingInstruction(target, content, 0, content
49: .length());
50: return new KProcessingInstruction(tree, 0);
51: }
52: }
|