get Element from XML Element by index - Android XML

Android examples for XML:XML Element

Description

get Element from XML Element by index

Demo Code


//package com.java2s;
import org.w3c.dom.Element;

public class Main {
    public static Element getElement(Element element, String name, int index) {
        return (Element) element.getElementsByTagName(name).item(index);
    }// w ww  .  j  ava2 s .c om

    public static Element getElement(Element element, String name) {
        return getElement(element, name, 0);
    }
}

Related Tutorials