Java XML QName getXmlQName(final NamespaceContext context, final String value)

Here you can find the source of getXmlQName(final NamespaceContext context, final String value)

Description

get Xml Q Name

License

Apache License

Declaration

public static QName getXmlQName(final NamespaceContext context, final String value) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;

public class Main {
    public static QName getXmlQName(final NamespaceContext context, final String value) {
        if (value == null) {
            return null;
        } else {/*from ww  w . jav a  2  s.  c o m*/
            final int colonIndex = value.indexOf(':');
            if (colonIndex == -1) {
                return new QName(value);
            } else {
                final String prefix = value.substring(0, colonIndex);
                final String name = value.substring(colonIndex + 1);
                final String namespaceUri = context.getNamespaceURI(prefix);
                return new QName(namespaceUri, name, prefix);
            }
        }
    }
}

Related

  1. getTypeFromQName(final QName name)
  2. getTypeQName(Class type)
  3. getUniquePOAName(QName serviceName, String portName, String poaName)
  4. getValueAsQName(XMLStreamReader reader, String value)
  5. getXmlElementRefOrElementQName(Class jaxbClass, Field field)
  6. getXmlRootElementQName(Class clazz)
  7. getXMLValue(String xml, String xQuery, QName resultType)
  8. getXSTypeAsString(QName qname)
  9. hasAnnotatedQname(Object obj)