return kid; } else { return kid.getChildRecursive(items, offset+1); return kid; } else { return kid.getChildRecursive(items, offset+1);
return kid; } else { return kid.getChildRecursive(items, offset+1); return kid; } else { return kid.getChildRecursive(items, offset+1);
/** * Get a child by its name or path. * * @param name element name or path/to/element * @return the first matching element or null if no match */ public XML getChild(String name) { if (name.length() > 0 && name.charAt(0) == '/') { throw new IllegalArgumentException("getChild() should not begin with a slash"); } if (name.indexOf('/') != -1) { return getChildRecursive(PApplet.split(name, '/'), 0); } int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { XML kid = getChild(i); String kidName = kid.getName(); if (kidName != null && kidName.equals(name)) { return kid; } } return null; }
/** * Get a child by its name or path. * * @param name element name or path/to/element * @return the first matching element */ public XML getChild(String name) { if (name.length() > 0 && name.charAt(0) == '/') { throw new IllegalArgumentException("getChild() should not begin with a slash"); } if (name.indexOf('/') != -1) { return getChildRecursive(PApplet.split(name, '/'), 0); } int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { XML kid = getChild(i); String kidName = kid.getName(); if (kidName != null && kidName.equals(name)) { return kid; } } return null; }