Utils.java Source code

Java tutorial

Introduction

Here is the source code for Utils.java

Source

import javax.xml.namespace.QName;

import org.w3c.dom.Element;

public class Utils {
    /**
     * Build a QName from the element name
     * @param el
     * @return
     */
    public static QName getQName(Element el) {
        if (el == null) {
            return null;
        } else if (el.getPrefix() != null) {
            return new QName(el.getNamespaceURI(), el.getLocalName(), el.getPrefix());
        } else {
            return new QName(el.getNamespaceURI(), el.getLocalName());
        }
    }

}