Changeset 16331
- Timestamp:
- 2008-07-10T12:56:42+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/util/XMLTools.java
r15581 r16331 493 493 */ 494 494 public static void showXMLParseFailureLine(SAXParseException e, String xmlContents) { 495 496 // There should be no characters at all that preceed the <?xml>... bit. 497 // The first check is for starting spaces: 498 if(xmlContents.startsWith("\n") || xmlContents.startsWith(" ") || xmlContents.startsWith("\t")) { 499 DebugStream.println("ERROR: illegal start of XML. Space/tab/newline should not preceed xml declaration.\n"); 500 DebugStream.println("xmlContents (length is " + xmlContents.length() + "):\n" + xmlContents); 501 return; // nothing more to do, first error identified 502 } 503 495 504 // the actual line (String literal) where parsing failed and the SAXParseException occurred. 496 505 String line = ""; … … 504 513 for(int i = 1; i <= linenumber; i++) { 505 514 end = xmlContents.indexOf("\n"); 506 line = xmlContents.substring(start, end); 515 if(end > 0) { 516 line = xmlContents.substring(start, end); 517 } 507 518 start = end+1; 508 519 }
Note:
See TracChangeset
for help on using the changeset viewer.