My application is to request (HTTP POST) an xml file from a website, and then format the data in the response on screen.
I'm very new to blackberry programming, and similarly new to java, and the API seems short on a lot of details.
I tried to use kXML, but it wouldn't verify properly, and then I found that blackberry has an API for parsing, so it's easier to just use that.
So far... (you can safely assume i've declared the neccessary variables/instantiated the objects..)
Code:
conn = (HttpConnection) Connector.open( url );
conn.setRequestMethod( HttpConnection.POST );
conn.setRequestProperty( "Content-Type", type );
OutputStream os = conn.openOutputStream();
os.write(encodedData.getBytes());
InputStream is = conn.openInputStream();
XMLParser parser = new XMLParser();
DefaultHandler handler = new DefaultHandler();
parser.parse(is, handler);
I'm not sure if this works, because I am unaware of what to do next.
How do I manipulate the xml data?
Also how would I test whether or not my http request returned an actual xml file?
edit:
After reading a lot of forum posts over again, perhaps I don't understand what the parser preforms, and the role of the handler?
Can anyone shed some light?
Any solutions are appreciated.
Thanks in advance,
Christian