//filename 1.xml
<category
hello world
</category>
//when iam trying to parse this file using the following code it throws String index out of range: -1
output: startPos: -1
endPosi: -1
String dataLine = nextLine.trim();
int startPos = dataLine.indexOf(startToken);
logger.debug("startPos: " + startPos);
int endPosi = dataLine.lastIndexOf(endToken);
logger.debug("endPosi: " + endPosi);
// 2.xml it parses this file which contains the following line
<category hello world </category>
// 这两个文件的唯一区别是第一个文件的内容是三行,第二个文件的内容是单行。