1 16 17 package org.apache.xerces.impl.xs.opti; 18 19 import org.w3c.dom.DOMException ; 20 import org.w3c.dom.Node ; 21 22 28 29 public class TextImpl extends DefaultText { 30 31 String fData = null; 33 SchemaDOM fSchemaDOM = null; 34 int fRow; 35 int fCol; 36 37 public TextImpl(StringBuffer str, SchemaDOM sDOM, int row, int col) { 38 fData = str.toString(); 39 fSchemaDOM = sDOM; 40 fRow = row; 41 fCol = col; 42 rawname = prefix = localpart = uri = null; 43 nodeType = Node.TEXT_NODE; 44 } 45 46 50 public Node getParentNode() { 51 return fSchemaDOM.relations[fRow][0]; 52 } 53 54 public Node getPreviousSibling() { 55 if (fCol == 1) { 56 return null; 57 } 58 return fSchemaDOM.relations[fRow][fCol-1]; 59 } 60 61 62 public Node getNextSibling() { 63 if (fCol == fSchemaDOM.relations[fRow].length-1) { 64 return null; 65 } 66 return fSchemaDOM.relations[fRow][fCol+1]; 67 } 68 69 71 86 public String getData() 87 throws DOMException { 88 return fData; 89 } 90 91 96 public int getLength() { 97 if(fData == null) return 0; 98 return fData.length(); 99 } 100 101 116 public String substringData(int offset, 117 int count) 118 throws DOMException { 119 if(fData == null) return null; 120 if(count < 0 || offset < 0 || offset > fData.length()) 121 throw new DOMException (DOMException.INDEX_SIZE_ERR, "parameter error"); 122 if(offset+count >= fData.length()) 123 return fData.substring(offset); 124 return fData.substring(offset, offset+count); 125 } 126 127 } 128 | Popular Tags |