public String outputElement(final Element w, final String offset, final String regexpElement, final String regexpAttribute) {
StringBuffer result = new StringBuffer();
List<Element> wwElements = w.getElements();
for (int i=0; i<wwElements.size(); i++) {
Element ww = wwElements.get(i);
String elementId = getIdText(ww);
if (elementId.matches(regexpElement)) {
result.append("\n" + offset + elementId + " " + ww.getElementType().getClass().getSimpleName() + " childLayout [" + ww.getElementType().getAttributes().get("childLayout") + "]");
result.append("\n" + StringHelper.whitespace(offset.length()) + ww.getElementStateString(StringHelper.whitespace(offset.length()), regexpAttribute));
result.append(outputElement(ww, offset + " ", ".*", regexpAttribute));
} else {
result.append(outputElement(ww, offset + " ", regexpElement, regexpAttribute));
}
}