Code example for RootElement

Methods: getChild, getContentHandler

0
	 * Parse a plenum teaser (Plenum) object. 
	 */ 
	public PlenumTeaserObject parseTeaser() { 
		final PlenumTeaserObject currentPlenumObject = new PlenumTeaserObject();
 
		RootElement root = new RootElement(TAG_PLENUM_TEASER_ROOT_ELEMENT);
		root.getChild(TAG_PLENUM_TEASER_TITLE).setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentPlenumObject.setTitle(body);
					} 
				}); 
		root.getChild(TAG_PLENUM_TEASER_LINK).setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentPlenumObject.setLink(body);
					} 
				}); 
		root.getChild(TAG_PLENUM_TEASER_XMLLINK).setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentPlenumObject.setLinkXML(body);
					} 
				}); 
		root.getChild(TAG_PLENUM_TEASER_TEASER).setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentPlenumObject.setTeaser(body);
					} 
				}); 
		root.getChild(TAG_PLENUM_TEASER_IMAGE).setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentPlenumObject.setImage(body);
					} 
				}); 
 
		this.setSpecificParserURL(PLENUM_TEASER_URL);
		try { 
			Xml.Encoding encoding = ParseEncodingDetector
					.detectEncoding(getDetailsXMLURL()); 
			Xml.parse(this.getSpecificInputStream(), encoding,
					root.getContentHandler());
		} catch (Exception e) {
			throw new RuntimeException(e);
		} 
 
		return currentPlenumObject;