Help, Substring not working, dont know why...
I need to load some xml file and extract some data from it.
I have this code.
I thing that this have to work but havent...it prints input error...
Any suggestion?
file is opened by this code it works
/////
if (e.getSource() == openButton) {
int returnVal = fc.showOpenDialog(FileChooserDemo.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
////
/// this doesnt work
try {
String f;
FileInputStream fstream = new FileInputStream(file);
BufferedReader in = new BufferedReader(new inputStreamReader(fstream));
while ((f = in.readLine()) != null)
{
System.out.println(in.readLine());
String document = in.readLine().toString();
String startTag = "<Text>";
String endTag = "</Text>";
int start = document.indexOf(startTag) + startTag.length();
int end = document.indexOf(endTag) + 1;
String result = document.substring(start,end);
System.err.println(result);
}
in.close();

