org.milyn.cdres.assemble.RemoveElementAU Maven / Gradle / Ivy
The newest version!
/*
Milyn - Copyright (C) 2006 - 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (version 2.1) as published by the Free Software
Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details:
http://www.gnu.org/licenses/lgpl.txt
*/
package org.milyn.cdres.assemble;
import org.milyn.cdr.SmooksResourceConfiguration;
import org.milyn.cdr.SmooksConfigurationException;
import org.milyn.container.ExecutionContext;
import org.milyn.delivery.dom.Phase;
import org.milyn.delivery.dom.VisitPhase;
import org.milyn.delivery.dom.DOMElementVisitor;
import org.w3c.dom.Element;
/**
* Removes a DOM element during the assembly phase.
*
* The element is visited by this Assembly Unit before it's child content
* has been iterated over.
* .cdrl Configuration
*
* <smooks-resource useragent="device/profile" selector="target-element-name"
* path="org.milyn.cdres.assemble.RemoveElementAU" />
* See {@link org.milyn.cdr.SmooksResourceConfiguration}.
* @author tfennelly
*/
@Phase(VisitPhase.ASSEMBLY)
public class RemoveElementAU implements DOMElementVisitor {
public void visitBefore(Element element, ExecutionContext executionContext) {
element.getParentNode().removeChild(element);
}
/* (non-Javadoc)
* @see org.milyn.delivery.dom.DOMElementVisitor#visitAfter(org.w3c.dom.Element, org.milyn.container.ExecutionContext)
*/
public void visitAfter(Element element, ExecutionContext request) {
}
}