Android RootElement - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android RootElement class.

This code example shows how to use the following methods:getChild, getContentHandler
	public List<Ad> parse() {
		final Ad currentAd = new Ad();
		final List<Ad> ads = new ArrayList<Ad>();
		final String labelValue[] = new String[2];
		 
		RootElement root = new RootElement("AdsResult");
 
		Element adElements = root.getChild("ads");
		Element adElement = adElements.getChild("ad");
		adElement.setEndElementListener(new EndElementListener() {
			public void end() { 
				ads.add(currentAd.copy());
			} 
		}); 
		Element adId = adElement.getChild("ad-external-reference-id");
		adId.setEndTextElementListener(new EndTextElementListener() {
			public void end(String body) {
				currentAd.setAdId(body);
			} 
		}); 

5
CodeRank
This code example shows how to use the following methods:getChild, getContentHandler
	} 
 
	@Override 
	public Object parseXml(String xmlString) throws Exception {
		Log.d(TAG, "xmlString: "+xmlString);
		RootElement rootElement = new RootElement("searchresults");
		Element placeElement = rootElement.getChild("place");
		placeElement.setStartElementListener(new StartElementListener() {
 
			@Override 
			public void start(Attributes attributes) {
				HashMap<String, Double> map = new HashMap<String, Double>();
				map.put("lat", Double.parseDouble(attributes.getValue("lat")));
				map.put("lon", Double.parseDouble(attributes.getValue("lon")));
				points.add(map);
			} 
		}); 
 
		Xml.parse(xmlString, rootElement.getContentHandler());
		Log.d(TAG, points.toString());

5
CodeRank
This code example shows how to use the following methods:getContentHandler
     
    @Override 
    public List<T> parse(InputStream inputStream)
    { 
        final ArrayList<T> dataList = new ArrayList<T>();
        RootElement root = new RootElement(ROOT);
         
        onParse(root,data,dataList);
         
        try 
        { 
            Xml.parse(inputStream, Xml.Encoding.UTF_8, root.getContentHandler());
        } catch (IOException e)
        { 
            e.printStackTrace();
            throw new RuntimeException(e);
        } catch (SAXException e)
        { 
            e.printStackTrace();
            throw new RuntimeException(e);
5
CodeRank
This code example shows how to use the following methods:getChild, getContentHandler
 
	public List<UserBean> parse(String str) {
		final List<UserBean> ulist = new ArrayList<UserBean>();
		final UserBean currentUser = new UserBean();
		 
		RootElement root = new RootElement("result");
		Element item = root.getChild("user");
		item.getChild("name").setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentUser.setName(body);
					} 
				}); 
		item.getChild("phone").setEndTextElementListener(
				new EndTextElementListener() {
					public void end(String body) {
						currentUser.setPhone(body);
					} 
				}); 
		item.setEndElementListener(new EndElementListener() {

5
CodeRank
This code example shows how to use the following methods:getChild, getContentHandler
	public RSSGallery(ViewCentral hub, EventBridge eventExchange) {
		 
		super(); 
		m_hub = hub;
		 
		RootElement root = new RootElement("sources");
		Element elem = root.getChild("source");
		elem.setEndElementListener(this);
	 
		m_handler = root.getContentHandler();
		m_template = new RSSSource(elem);
		m_eventExchange = eventExchange;
	} 
	 
    public View getView(int position, View convertView, ViewGroup parent) {
    	 
    	// todo; ändra cast  
    	 
    	RSSSource source = (RSSSource)getItem(position);
    	ImageView i = new ImageView(m_hub);
5
CodeRank
This code example shows how to use the following methods:getChild, getContentHandler
		try { 
		 
			URL metaURL = getURL();
			InputStream in = metaURL.openStream();
		 
			RootElement root = new RootElement("rss");
			Element elem = root.getChild("channel");
			elem = elem.getChild("image");
		 
			registerAttributeListener(elem, "url", ATR_IMAGE);
			registerAttributeListener(elem, "width", "image_width");
			registerAttributeListener(elem, "height", "image_height");
			 
			Xml.parse(in, Xml.Encoding.UTF_8, root.getContentHandler());
			 
			m_noMeta = false;
		 
		} catch(Exception e) {
			throw new LoggedException(e);
		} 
5
CodeRank
This code example shows how to use the following methods:getChild, getContentHandler
        } 
    } 
 
    public List<Tea> parse() {
        final Tea curTea = new Tea();
        RootElement root = new RootElement(ROOT_ELEMENT);
        final List<Tea> teas = new ArrayList<Tea>();
 
        Element tea = root.getChild(TEA);
        tea.setEndElementListener(new EndElementListener(){
            public void end() { 
                teas.add(curTea.copy());
            } 
        }); 
        tea.getChild(NAME).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setName(body);
            } 
        }); 
        tea.getChild(GROUP).setEndTextElementListener(new EndTextElementListener(){

5
CodeRank
This code example shows how to use the following methods:getChild, getContentHandler
	protected void addFileToCall(String key, String fileName) {
		multipartEntity.addPart(key, new FileBody(new File(fileName)));
	} 
	 
	protected void makeCall(RootElement root) {
		Element errorTag = root.getChild("error");
		errorTag.setStartElementListener(new StartElementListener(){
				public void start(Attributes attributes) {
					errorCode = attributes.getValue("code");
				} 
	        }); 
		errorTag.setEndTextElementListener(new EndTextElementListener(){
			public void end(String body) {
				errorMessage = body;
			} 
		});  
 
		try { 
			httppost.setEntity(multipartEntity);
			response = httpclient.execute(httppost);

4
CodeRank
This code example shows how to use the following methods:getContentHandler
 
	public static GoodreadsResponse parse(InputStream inputStream) throws IOException, SAXException
	{ 
		final GoodreadsResponse response = new GoodreadsResponse();
		 
		RootElement root = new RootElement("GoodreadsResponse");
		 
		response.setBook(Book.appendListener(root, 0));
		response.setRequest(Request.appendListener(root));
		response.setUser(User.appendListener(root, 0));
		response.setShelves(Shelves.appendListener(root, 0));
		response.setReviews(Reviews.appendListener(root, 0));
		response.setSearch(Search.appendListener(root, 0));
		response.setFollowers(Followers.appendListener(root, 0));
		response.setFriends(Friends.appendListener(root, 0));
		response.setFollowing(Following.appendListener(root, 0));
		response.setUpdates(Update.appendArrayListener(root, 0));
		response.setReview(Review.appendListener(root, 0));
		response.setAuthor(Author.appendListener(root, 0));
		response.setComments(Comments.appendListener(root, 0));

5
CodeRank
This code example shows how to use the following methods:getChild

Related Android RootElement Questions & Answers:

See Code Examples for Android RootElement Methods: