Java XML QName getXSTypeAsString(QName qname)

Here you can find the source of getXSTypeAsString(QName qname)

Description

Return XS type of the qualified name or XS String type in case of null.

License

Open Source License

Parameter

Parameter Description
qname qualified name

Return

string representation of qualified name

Declaration

public static String getXSTypeAsString(QName qname) 

Method Source Code

//package com.java2s;
/**//from  ww w  .  ja va 2s .c o  m
 * Copyright 2015 Pozna? Supercomputing and Networking Center
 *
 * Licensed under the GNU General Public License, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.gnu.org/licenses/gpl-3.0.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import javax.xml.namespace.QName;

public class Main {
    /**
     * XML Schema namespace URI.
     */
    private static final String XS_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";

    /**
     * Return XS type of the qualified name or XS String type in case of null.
     * 
     * @param qname
     *            qualified name
     * @return string representation of qualified name
     */
    public static String getXSTypeAsString(QName qname) {
        if (qname == null) {
            return XS_NAMESPACE_URI + "#string";
        } else {
            String namaspace = qname.getNamespaceURI() != null ? qname.getNamespaceURI() : XS_NAMESPACE_URI;
            return namaspace + "#" + qname.getLocalPart();
        }
    }
}

Related

  1. getValueAsQName(XMLStreamReader reader, String value)
  2. getXmlElementRefOrElementQName(Class jaxbClass, Field field)
  3. getXmlQName(final NamespaceContext context, final String value)
  4. getXmlRootElementQName(Class clazz)
  5. getXMLValue(String xml, String xQuery, QName resultType)
  6. hasAnnotatedQname(Object obj)
  7. hasChildElement(QName qName, Element element)
  8. hasGmlNamespace(QName qname)
  9. hasQName(final Node e, final QName name)