Example usage for org.dom4j Attribute getQName

List of usage examples for org.dom4j Attribute getQName

Introduction

In this page you can find the example usage for org.dom4j Attribute getQName.

Prototype

QName getQName();

Source Link

Document

Returns the QName of this attribute which represents the local name, the qualified name and the Namespace.

Usage

From source file:poisondog.xml.Dom4jParser.java

License:Apache License

private Node createNode(Element element) {
    Node node = new Node(element.getQName().getName());
    for (int i = 0; i < element.attributeCount(); i++) {
        Attribute attribute = element.attribute(i);
        node.setAttribute(attribute.getQName().getName(), attribute.getValue());
    }/*from w  w w.j a  va  2  s.  c  o  m*/

    for (Iterator i = element.elementIterator(); i.hasNext();) {
        Element e = (Element) i.next();
        node.addChild(createNode(e));
    }

    node.setText(element.getText());
    return node;
}

From source file:poisondog.xml.XMLUtils.java

License:Apache License

private static Node createNode(Element element) {
    Node node = new Node(element.getQName().getName());
    for (int i = 0; i < element.attributeCount(); i++) {
        Attribute attribute = element.attribute(i);
        node.setAttribute(attribute.getQName().getName(), attribute.getValue());
    }/*  w ww.  j  av  a2 s .  c o m*/

    for (Iterator i = element.elementIterator(); i.hasNext();) {
        Element e = (Element) i.next();
        node.addChild(createNode(e));
    }

    node.setText(element.getText());
    return node;
}