private List<String> fetchTitles(String category) throws SpeechletException {
  List<String> titles=new LinkedList<String>();
  try {
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document doc=db.parse(getRequestUrl(category));
    NodeList nodeList=doc.getElementsByTagName("Title");
    for (int i=0; i < nodeList.getLength(); i++) {
      Node node=nodeList.item(i);
      titles.add(node.getTextContent());
    }
  }
 catch (  Exception e) {
    throw new SpeechletException(e);
  }
  return titles;
}

private List < String > fetchTitles ( String category ) throws SpeechletException { List < String > titles = new LinkedList < String > ( ) ; try { DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder db = dbf . newDocumentBuilder ( ) ; Document doc = db . parse ( getRequestUrl ( category ) ) ; NodeList nodeList = doc . getElementsByTagName ( "Title" ) ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { Node node = nodeList . item ( i ) ; titles . add ( node . getTextContent ( ) ) ; } } catch ( Exception e ) { throw new SpeechletException ( e ) ; } return titles ; }
fetches the top ten selling titles from the product advertising api .
