com.github.simy4.xpath.dom4j.navigator.node.Dom4jAttribute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xpath-to-xml-dom4j Show documentation
Show all versions of xpath-to-xml-dom4j Show documentation
Convenient utility to build XML models by evaluating XPath expressions
package com.github.simy4.xpath.dom4j.navigator.node;
import com.github.simy4.xpath.XmlBuilderException;
import org.dom4j.Attribute;
import org.dom4j.Element;
import org.dom4j.Namespace;
import javax.xml.namespace.QName;
import java.util.Collections;
public final class Dom4jAttribute extends AbstractDom4jNode {
public Dom4jAttribute(Attribute attribute) {
super(attribute);
}
@Override
public QName getName() {
final Namespace namespace = getNode().getNamespace();
return new QName(namespace.getURI(), getNode().getName(), namespace.getPrefix());
}
@Override
public Iterable> elements() {
return Collections.emptyList();
}
@Override
public Iterable> attributes() {
return Collections.emptyList();
}
@Override
public Dom4jNode createAttribute(org.dom4j.QName attribute) throws XmlBuilderException {
throw new XmlBuilderException("Unable to append attribute to a non-element node " + getNode());
}
@Override
public Dom4jNode createElement(org.dom4j.QName element) throws XmlBuilderException {
throw new XmlBuilderException("Unable to append element to an attribute " + getNode());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy