| 1345 | * Assumes valid xml |
| 1346 | */ |
| 1347 | private String getElement(Reader reader) throws IOException { |
| 1348 | StringBuilder result = new StringBuilder(); |
| 1349 | result.append('<'); |
| 1350 | |
| 1351 | boolean done = false; |
| 1352 | |
| 1353 | while (!done) { |
| 1354 | int current = reader.read(); |
| 1355 | while (current != '>') { |
| 1356 | if (current < 0) { |
| 1357 | throw new EOFException(); |
| 1358 | } |
| 1359 | result.append((char) current); |
| 1360 | current = reader.read(); |
| 1361 | } |
| 1362 | result.append((char) current); |
| 1363 | |
| 1364 | int len = result.length(); |
| 1365 | if (len > 4 && result.substring(0, 4).equals("<!--")) { |
| 1366 | // This is a comment - make sure we are at the end |
| 1367 | if (len >= 7 && result.substring(len - 3, len).equals("-->")) { |
| 1368 | done = true; |
| 1369 | } |
| 1370 | } else { |
| 1371 | done = true; |
| 1372 | } |
| 1373 | } |
| 1374 | |
| 1375 | |
| 1376 | return result.toString(); |
| 1377 | } |
| 1378 | |
| 1379 | /** |
| 1380 | * Processes a single JSP file, compiling it and generating the web.xml mapping. |