O'Reilly logo

BlackBerry Java Application Development by Bill Foust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - parsing the response

  1. You've already seen the output for a call to the CopyMe service. Even so, when creating a custom Handler for a specific response it's a good idea to have a copy of the raw XML response handy to compare with and view. The first step in implementing a parser is to create that custom Handler class.
  2. Create a new class in the existing HttpBasics namespace and call it CopyMeHandler.
  3. Insert the following code into the class stub that is created.
    private String currentElement; public String copymeResponse; public void startElement(String uri, String localName, String qName, Attributes attributes) { currentElement = localName; } public void characters(char[] ch, int start, int length) { if ( currentElement.equals( "string" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required