Code example for RootElement

Methods: getChild, getContentHandler

0
		} 
	} 
 
	public List<NewsItem> parse() {
		final NewsItem it = new NewsItem();
		RootElement root = new RootElement(RSS);
		final List<NewsItem> messages = new ArrayList<NewsItem>();
		Element channel = root.getChild(CHANNEL);
		Element item = channel.getChild(ITEM);
		item.setEndElementListener(new EndElementListener(){
			public void end() { 
				messages.add(it.copy());
			} 
		}); 
		item.getChild(TITLE).setEndTextElementListener(new EndTextElementListener(){
			public void end(String body) {
				it.set_title(Html.fromHtml(body).toString());
			} 
		}); 
		item.getChild(LINK).setEndTextElementListener(new EndTextElementListener(){
			public void end(String body) {
				it.set_link(body);
			} 
		}); 
		item.getChild(DESCRIPTION).setEndTextElementListener(new EndTextElementListener(){
			public void end(String body) {
				it.set_brief(body);
			} 
		}); 
 
		item.getChild(PUB_DATE).setEndTextElementListener(new EndTextElementListener(){
			public void end(String body) {
				it.set_written(body);
			} 
		}); 
 
		try { 
			Xml.parse(this.getInputStream(), Xml.Encoding.UTF_8, root.getContentHandler());
		} catch (IOException e) {
			e.printStackTrace();
			System.out.println(feedUrl);		
		} catch (SAXException e) {	
			e.printStackTrace();