I have a string input from which I need to extract simple information, here is the sample xml (from mkyong):
&l
Seems you took this example from here . You need to pass a file with absolute path an not a string to method SAXParser.parse()
; Look the example closely. The method parse()
defined as follows
public void parse(File f,
DefaultHandler dh)
throws SAXException,
IOException
If you want to parse a string anyways. There is another method which takes Inputstream
.
public void parse(InputStream is,
DefaultHandler dh)
throws SAXException,
IOException
Then you need to convert your string to an InputStream. Here is how to do it.