1 57 58 package com.sun.org.apache.xerces.internal.impl.xs.opti; 59 60 import org.w3c.dom.DOMException ; 61 import org.w3c.dom.Node ; 62 63 67 68 public class TextImpl extends DefaultText { 69 70 String fData = null; 72 SchemaDOM fSchemaDOM = null; 73 int fRow; 74 int fCol; 75 76 public TextImpl(StringBuffer str, SchemaDOM sDOM, int row, int col) { 77 fData = str.toString(); 78 fSchemaDOM = sDOM; 79 fRow = row; 80 fCol = col; 81 rawname = prefix = localpart = uri = null; 82 nodeType = Node.TEXT_NODE; 83 } 84 85 89 public Node getParentNode() { 90 return fSchemaDOM.relations[fRow][0]; 91 } 92 93 public Node getPreviousSibling() { 94 if (fCol == 1) { 95 return null; 96 } 97 return fSchemaDOM.relations[fRow][fCol-1]; 98 } 99 100 101 public Node getNextSibling() { 102 if (fCol == fSchemaDOM.relations[fRow].length-1) { 103 return null; 104 } 105 return fSchemaDOM.relations[fRow][fCol+1]; 106 } 107 108 110 125 public String getData() 126 throws DOMException { 127 return fData; 128 } 129 130 135 public int getLength() { 136 if(fData == null) return 0; 137 return fData.length(); 138 } 139 140 155 public String substringData(int offset, 156 int count) 157 throws DOMException { 158 if(fData == null) return null; 159 if(count < 0 || offset < 0 || offset > fData.length()) 160 throw new DOMException (DOMException.INDEX_SIZE_ERR, "parameter error"); 161 if(offset+count >= fData.length()) 162 return fData.substring(offset); 163 return fData.substring(offset, offset+count); 164 } 165 166 } 167 | Popular Tags |