package org.madore.damlengine; import java.util.ArrayList; import org.w3c.dom.*; public final class TodoEmailDespammedElement extends TodoDefaultElement { public static class Factory extends TodoElement.Factory { @Override public TodoEmailDespammedElement newItem(Element node, Context ctx, TodoItem caller) { return new TodoEmailDespammedElement(node, ctx, caller); } } public TodoEmailDespammedElement(Element node, Context ctx, TodoItem caller) { super(node, ctx, caller); } @Override public void handleNodeOnly() { Element out0 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "code"); String lang = LangHelper.getLangNorec(node); if ( lang != null ) LangHelper.setLangNorec(out0, lang); Element out1 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a"); out0.appendChild(out1); out1.setAttributeNS(null, "class", "despammed-address"); ArrayList childList = getChildList(node); ArrayList toProcess = new ArrayList(childList.size()+8); for ( Node child : childList ) { out1.appendChild(child); if ( child.getNodeType() == Node.ELEMENT_NODE ) { TodoElement it = TodoElement.getTodoElement((Element)child, this.ctx, this); toProcess.add(it); } } node.getParentNode().replaceChild(out0, node); this.ownerDeque.registerAtStart(toProcess); } }