public ArrayList<String> getChildNames() { ArrayList<String> a = new ArrayList<String>(); for (SimpleXmlElement e : getChildren()) { a.add(e.getName()); } return a; }
public void removeChildren(String tagName) { for (Iterator<SimpleXmlElement> it = m_children.iterator(); it.hasNext(); ) { SimpleXmlElement e = it.next(); if (e.getName().equalsIgnoreCase(tagName)) { it.remove(); } } }
public SimpleXmlElement getChild(String name) { for (SimpleXmlElement c : m_children) { if (c.getName().equalsIgnoreCase(name)) { return c; } } return null; }
/** Returns an ArrayList with all children whose name matches the given regular expression. */ public ArrayList<SimpleXmlElement> getChildrenRegEx(String childNameAsRegEx) { ArrayList<SimpleXmlElement> selectedChildren = new ArrayList<SimpleXmlElement>(); for (SimpleXmlElement child : m_children) { if (child.getName().matches(childNameAsRegEx)) { selectedChildren.add(child); } } return selectedChildren; }
public ArrayList<SimpleXmlElement> getChildren(String childrenName) { ArrayList<SimpleXmlElement> a = new ArrayList<SimpleXmlElement>(); for (SimpleXmlElement c : m_children) { if (c.getName().equalsIgnoreCase(childrenName)) { a.add(c); } } return a; }
/** * Returns the first child that matches the given regular expression or null if there's no match. */ public SimpleXmlElement getChildRegEx(String childNameAsRegEx) { Iterator<SimpleXmlElement> iterator = m_children.iterator(); while (iterator.hasNext()) { SimpleXmlElement child = iterator.next(); if (child.getName().matches(childNameAsRegEx)) { return child; } } return null; }