S
Sunitha Kumar
Hi,
I'm just learning SAX, so I would appreciate advice with this problem I'm
wrestling with.
Here's the scenario:
I've just parsed a xml document and stored the values I need in a class so I
can print it out. But, I'm also looking for a particular data element within
the elements, so I pass in the value I'm looking for, via the command line
arguments.
For example, within the element <year>, I'm looking for the value 1988.
Should I:
1. create another handler just to handle this case?
(maybe subclass the class extending the DefaultHandler and override the
endElement method?)
2. I tried this approach, which failed miserably (it printed out everything
anyway)
if (year.equals(yearToFind))
{
System.out.print(article.toString);
}
else {
//print out what I have without worrying about a particular year
System.out.println(article.toString);
}
How can I do this? Any suggestions, comments, advice would be welcome!
Thanks,
Sunitha Kumar
I'm just learning SAX, so I would appreciate advice with this problem I'm
wrestling with.
Here's the scenario:
I've just parsed a xml document and stored the values I need in a class so I
can print it out. But, I'm also looking for a particular data element within
the elements, so I pass in the value I'm looking for, via the command line
arguments.
For example, within the element <year>, I'm looking for the value 1988.
Should I:
1. create another handler just to handle this case?
(maybe subclass the class extending the DefaultHandler and override the
endElement method?)
2. I tried this approach, which failed miserably (it printed out everything
anyway)
if (year.equals(yearToFind))
{
System.out.print(article.toString);
}
else {
//print out what I have without worrying about a particular year
System.out.println(article.toString);
}
How can I do this? Any suggestions, comments, advice would be welcome!
Thanks,
Sunitha Kumar