| 1159 | } |
| 1160 | |
| 1161 | public String getPositionDescription() { |
| 1162 | |
| 1163 | StringBuffer buf = |
| 1164 | new StringBuffer(type < TYPES.length ? TYPES[type] : "unknown"); |
| 1165 | buf.append(' '); |
| 1166 | |
| 1167 | if (type == START_TAG || type == END_TAG) { |
| 1168 | if (degenerated) |
| 1169 | buf.append("(empty) "); |
| 1170 | buf.append('<'); |
| 1171 | if (type == END_TAG) |
| 1172 | buf.append('/'); |
| 1173 | |
| 1174 | if (prefix != null) |
| 1175 | buf.append("{" + namespace + "}" + prefix + ":"); |
| 1176 | buf.append(name); |
| 1177 | |
| 1178 | int cnt = attributeCount << 2; |
| 1179 | for (int i = 0; i < cnt; i += 4) { |
| 1180 | buf.append(' '); |
| 1181 | if (attributes[i + 1] != null) |
| 1182 | buf.append( |
| 1183 | "{" + attributes[i] + "}" + attributes[i + 1] + ":"); |
| 1184 | buf.append(attributes[i + 2] + "='" + attributes[i + 3] + "'"); |
| 1185 | } |
| 1186 | |
| 1187 | buf.append('>'); |
| 1188 | } |
| 1189 | else if (type == IGNORABLE_WHITESPACE); |
| 1190 | else if (type != TEXT) |
| 1191 | buf.append(getText()); |
| 1192 | else if (isWhitespace) |
| 1193 | buf.append("(whitespace)"); |
| 1194 | else { |
| 1195 | String text = getText(); |
| 1196 | if (text.length() > 16) |
| 1197 | text = text.substring(0, 16) + "..."; |
| 1198 | buf.append(text); |
| 1199 | } |
| 1200 | |
| 1201 | buf.append("@"+line + ":" + column); |
| 1202 | if(location != null){ |
| 1203 | buf.append(" in "); |
| 1204 | buf.append(location); |
| 1205 | } |
| 1206 | else if(reader != null){ |
| 1207 | buf.append(" in "); |
| 1208 | buf.append(reader.toString()); |
| 1209 | } |
| 1210 | return buf.toString(); |
| 1211 | } |
| 1212 | |
| 1213 | public int getLineNumber() { |
| 1214 | return line; |