Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import javax.xml.XMLConstants;
import javax.xml.namespace.QName;

public class Main {
    /**
     * Return the qualified name, that is to say the prefix -if any- with the
     * local name.
     *
     * @param qName
     *            The QName.
     * @return A string that looks like "<tt>prefix:localName</tt>" or "
     *         <tt>NCName</tt>".
     */
    public static String getQualifiedName(QName qName) {
        if (!XMLConstants.NULL_NS_URI.equals(qName.getNamespaceURI())
                && !XMLConstants.DEFAULT_NS_PREFIX.equals(qName.getPrefix())) {
            return qName.getPrefix() + ":" + qName.getLocalPart();
        } else {
            return qName.getLocalPart();
        }
    }
}