KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > kawa > xml > KCharacterData


1 // Copyright (c) 2004 Per M.A. Bothner.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.kawa.xml;
5 import gnu.xml.*;
6 /* #ifdef use:org.w3c.dom.Node */
7 // import org.w3c.dom.*;
8
/* #endif */
9
10 public abstract class KCharacterData extends KNode
11   /* #ifdef use:org.w3c.dom.Node */
12   // implements org.w3c.dom.CharacterData
13
/* #endif */
14 {
15   public KCharacterData (NodeTree seq, int ipos)
16   {
17     super(seq, ipos);
18   }
19
20   /** Non-optimized. */
21   public int getLength ()
22   {
23     StringBuffer JavaDoc sbuf = new StringBuffer JavaDoc();
24     NodeTree tlist = (NodeTree) sequence;
25     tlist.stringValue(tlist.posToDataIndex(ipos), sbuf);
26     return sbuf.length();
27   }
28
29   public String JavaDoc getData ()
30   {
31     return getNodeValue();
32   }
33
34   /* #ifdef use:org.w3c.dom.Node */
35   // public void setData(String data) throws DOMException
36
// {
37
// throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
38
// "setData not supported");
39
// }
40
// public String substringData(int offset, int count)
41
// throws DOMException
42
// {
43
// String data = getData();
44
// if (offset < 0 || count < 0 || offset + count >= data.length())
45
// throw new DOMException(DOMException.INDEX_SIZE_ERR,
46
// "invalid index to substringData");
47
// return data.substring(offset, count);
48
// }
49

50   // public void appendData (String data) throws DOMException
51
// {
52
// throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
53
// "appendData not supported");
54
// }
55

56   // public void insertData (int offset, String data) throws DOMException
57
// {
58
// replaceData(offset, 0, data);
59
// }
60

61   // public void deleteData (int offset, int count) throws DOMException
62
// {
63
// replaceData(offset, count, "");
64
// }
65

66   // public void replaceData (int offset, int count, String arg) throws DOMException
67
// {
68
// throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
69
// "replaceData not supported");
70
// }
71
/* #endif */
72 }
73
Popular Tags