I've been fiddling for 3 hours and I can't get this F*** parser to work. Sorry for cursing. I don't understand why I can't find **one decent tutorial that does exactly what I want.
I just want to send the function a String/XML. Then, parse it. it's not that hard. In python, I can do it with my eyes closed. Awesome, freaking documentation right here: http://www.crummy.com/software/BeautifulSoup/documentation.html
import BeautifulSoup
soup = BeautifulSoup(the_xml)
persons_name = soup.findAll('first_name')[0].string
Why can't I find a good, simple, documentation that teaches me how to parse XML????? This is my current code for JAVA SAX, and its not working, and I don't even know why.
public static void parseit(String thexml)
{
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser saxParser = factory.newSAXParser();
saxParser.parse( thexml , new DefaultHandler() );
} catch (Throwable err) {
err.printStackTrace ();
}
}
Can someone just write me the code to parse the XML using SAX parser...please...It's just like 5 lines of code.