List of usage examples for org.jdom2 Attribute setNamespace
public Attribute setNamespace(Namespace namespace)
Attribute
's Namespace
. From source file:com.c4om.autoconf.ulysses.extra.svrlinterpreter.SVRLInterpreterProcessor.java
License:Apache License
/** * This method://from w ww .j av a 2 s . c om * <ol> * <li>Takes an attribute from a source element</li> * <li>Detaches it</li> * <li>Removes its namespace</li> * <li>Attaches it to a destination element</li> * </ol> * @param sourceElement source element * @param destinationElement destination element * @param attrName the name of the attribute * @param attrNamespace the namespace of the source attribute (it will be removed at destination) */ private static void moveAndRemoveNSOfAttr(Element sourceElement, Element destinationElement, String attrName, Namespace attrNamespace) { Attribute mandatoryPathAttribute = sourceElement.getAttribute(attrName, attrNamespace); if (mandatoryPathAttribute != null) { mandatoryPathAttribute.detach(); mandatoryPathAttribute.setNamespace(Namespace.NO_NAMESPACE); destinationElement.setAttribute(mandatoryPathAttribute); } }