Example usage for javax.xml.namespace QName getNamespaceURI

List of usage examples for javax.xml.namespace QName getNamespaceURI

Introduction

In this page you can find the example usage for javax.xml.namespace QName getNamespaceURI.

Prototype

public String getNamespaceURI() 

Source Link

Document

Get the Namespace URI of this QName.

Usage

From source file:org.apache.abdera.util.AbstractStreamWriter.java

public StreamWriter writeAttribute(QName qname, int value) {
    return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value);
}

From source file:org.apache.abdera.util.AbstractStreamWriter.java

public StreamWriter writeAttribute(QName qname, long value) {
    return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value);
}

From source file:org.apache.abdera.util.AbstractStreamWriter.java

public StreamWriter writeAttribute(QName qname, double value) {
    return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value);
}

From source file:org.apache.abdera2.writer.AbstractStreamWriter.java

public StreamWriter writeAttribute(QName qname, DateTime value) {
    return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value);
}

From source file:org.apache.axiom.om.impl.llom.OMElementImpl.java

/** Method handleNamespace. */
OMNamespace handleNamespace(QName qname) {
    OMNamespace ns = null;/*from w ww.j  ava 2s .c o  m*/

    // first try to find a namespace from the scope
    String namespaceURI = qname.getNamespaceURI();
    if (namespaceURI != null && namespaceURI.length() > 0) {
        String prefix = qname.getPrefix();
        ns = findNamespace(qname.getNamespaceURI(), prefix);

        /**
         * What is left now is
         *  1. nsURI = null & parent != null, but ns = null
         *  2. nsURI != null, (parent doesn't have an ns with given URI), but ns = null
         */
        if (ns == null) {
            if ("".equals(prefix)) {
                prefix = OMSerializerUtil.getNextNSPrefix();
            }
            ns = declareNamespace(namespaceURI, prefix);
        }
        if (ns != null) {
            this.ns = ns;
        }
    }
    return ns;
}

From source file:org.apache.axiom.om.impl.llom.OMElementImpl.java

/**
 * Searches for children with a given QName and returns an iterator to traverse through the
 * OMNodes. This QName can contain any combination of prefix, localname and URI.
 *
 * @throws OMException//from   w ww  .  j  av a  2s. co m
 */
public Iterator getChildrenWithName(QName elementQName) {
    OMNode firstChild = getFirstOMChild();
    Iterator it = new OMChildrenQNameIterator(firstChild, elementQName);

    // The getChidrenWithName method used to tolerate an empty namespace
    // and interpret that as getting any element that matched the local
    // name.  There are custmers of axiom that have hard-coded dependencies
    // on this semantic.
    // The following code falls back to this legacy behavior only if
    // (a) elementQName has no namespace, (b) the new iterator finds no elements
    // and (c) there are children.
    if (elementQName.getNamespaceURI().length() == 0 && firstChild != null && !it.hasNext()) {
        if (log.isTraceEnabled()) {
            log.trace("There are no child elements that match the unqualifed name: " + elementQName);
            log.trace("Now looking for child elements that have the same local name.");
        }
        it = new OMChildrenLegacyQNameIterator(getFirstOMChild(), elementQName);
    }

    return it;
}

From source file:org.apache.axiom.om.impl.llom.OMSourcedElementImpl.java

/**
 * Constructor that takes a QName instead of the local name and the namespace seperately
 *
 * @param qName//  w w  w . j  a  v  a2  s. com
 * @param factory
 * @param source
 */
public OMSourcedElementImpl(QName qName, OMFactory factory, OMDataSource source) {
    //create a namespace
    super(qName.getLocalPart(), null, factory);
    dataSource = source;
    isExpanded = (dataSource == null);
    if (!isExpanded) {
        if (!isLossyPrefix(dataSource)) {
            // Believe the prefix and create a normal OMNamespace
            definedNamespace = new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix());
        } else {
            // Create a deferred namespace that forces an expand to get the prefix
            definedNamespace = new DeferredNamespace(qName.getNamespaceURI());
        }
    } else {
        definedNamespace = new OMNamespaceImpl(qName.getNamespaceURI(), qName.getPrefix());
    }
}

From source file:org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.java

public boolean hasFault() {
    QName payloadQName = this.getPayloadQName_Optimized();
    if (payloadQName != null) {
        if (SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(payloadQName.getLocalPart())) {
            String ns = payloadQName.getNamespaceURI();
            return (ns != null && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns)
                    || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns)));
        }//from  w w  w. j  av a  2s . c o m
    }

    // Fallback: Get the body and get the fault information from the body
    SOAPBody body = this.getBody();
    return (body == null) ? false : body.hasFault();
}

From source file:org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.java

public OMNamespace getSOAPBodyFirstElementNS() {
    QName payloadQName = this.getPayloadQName_Optimized();
    if (payloadQName != null) {
        return this.factory.createOMNamespace(payloadQName.getNamespaceURI(), payloadQName.getPrefix());
    }// w  w w .j a  va  2s .  c  om
    SOAPBody body = this.getBody();
    return (body == null) ? null : body.getFirstElementNS();
}

From source file:org.apache.axis.AxisFault.java

/**
 * Create an element of the given qname and add it to the details.
 *
 * @param qname qname of the element/*w  w  w  . j  a  v  a 2 s. c  om*/
 * @param body string to use as body
 */
public void addFaultDetail(QName qname, String body) {
    Element detail = XMLUtils.StringToElement(qname.getNamespaceURI(), qname.getLocalPart(), body);

    addFaultDetail(detail);
}