@Nullable private static AntDomElement findElementById( AntDomElement from, final String id, final boolean skipCustomTags) { if (id.equals(from.getId().getRawText())) { return from; } final Ref<AntDomElement> result = new Ref<AntDomElement>(null); from.accept( new AntDomRecursiveVisitor() { public void visitAntDomCustomElement(AntDomCustomElement custom) { if (!skipCustomTags) { super.visitAntDomCustomElement(custom); } } public void visitAntDomElement(AntDomElement element) { if (result.get() != null) { return; } if (id.equals(element.getId().getRawText())) { result.set(element); return; } super.visitAntDomElement(element); } }); return result.get(); }
public String toString(@Nullable AntDomElement antDomElement, ConvertContext context) { return antDomElement != null ? antDomElement.getId().getRawText() : null; }