/** * Creates a new OMNamespace. * * @see org.apache.axiom.om.OMFactory#createOMNamespace(String, String) */ public OMNamespace createOMNamespace(String uri, String prefix) { return new NamespaceImpl(uri, prefix); }
/** * Returns a qname representing the attribute. * * @see org.apache.axiom.om.OMAttribute#getQName() */ public QName getQName() { return (namespace == null) ? new QName(this.attrName) : // This next bit is because QName is kind of stupid, and throws an // IllegalArgumentException on null prefix instead of treating it exactly // as if no prefix had been passed. Grr. (namespace.getPrefix() == null ? new QName(namespace.getNamespaceURI(), attrName) : new QName(namespace.getNamespaceURI(), attrName, namespace.getPrefix())); }
OMAttribute other = (OMAttribute) obj; return (namespace == null ? other.getNamespace() == null : namespace.equals(other.getNamespace()) && attrName.equals(other.getLocalName()) && (attrValue == null ? other.getAttributeValue() == null : String ns = namespace.getNamespaceURI(); String prefix = namespace.getPrefix(); String otherPrefix = other.getPrefix();
/** * Returns the namespace prefix of this attr node. * * @see org.w3c.dom.Node#getPrefix() */ public String getPrefix() { // TODO Error checking return (this.namespace == null) ? null : this.namespace.getPrefix(); }
/** * Returns the namespace URI of this attr node. * * @see org.w3c.dom.Node#getNamespaceURI() */ public String getNamespaceURI() { if (this.namespace != null) { return namespace.getNamespaceURI(); } return null; }
public int hashCode() { return attrName.hashCode() ^ (attrValue != null ? attrValue.toString().hashCode() : 0) ^ (namespace != null ? namespace.hashCode() : 0); }
public String toString() { return (this.namespace == null) ? this.attrName : this.namespace .getPrefix() + ":" + this.attrName; }
public OMNamespace getNamespace() { return new NamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); }
public String getName() { if (this.namespace != null) { if ((OMConstants.XMLNS_NS_PREFIX.equals(this.attrName))) { return this.attrName; } else if (OMConstants.XMLNS_NS_URI.equals(this.namespace.getNamespaceURI())) { return OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName; } else if (this.namespace.getPrefix().equals("")) { return this.attrName; } else { return this.namespace.getPrefix() + ":" + this.attrName; } } else { return this.attrName; } }
public AttrImpl(DocumentImpl ownerDocument, String name, OMFactory factory) { super(ownerDocument, factory); this.attrName = name; //If this is a default namespace attr if (OMConstants.XMLNS_NS_PREFIX.equals(name)) { this.namespace = new NamespaceImpl( OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX); } }
public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new NamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); }
public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new NamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); }
/** * We use "" to store the default namespace of this element. As one can see user can not give "" * as the prefix, when he declare a usual namespace. * * @param uri */ public OMNamespace declareDefaultNamespace(String uri) { NamespaceImpl ns = new NamespaceImpl(uri, ""); if (namespaces == null) { this.namespaces = new HashMap(5); } namespaces.put("", ns); return ns; }
/** * Creates an OMElement. * * @see org.apache.axiom.om.OMFactory#createOMElement(String, String, * String) */ public OMElement createOMElement(String localName, String namespaceURI, String namespacePrefix) { NamespaceImpl ns = new NamespaceImpl(namespaceURI, namespacePrefix); return this.createOMElement(localName, ns); }
/** * Creates a new OMDOM Element node and adds it to the given parent. * * @see #createOMElement(String, OMNamespace, OMContainer) * @see org.apache.axiom.om.OMFactory#createOMElement( javax.xml.namespace.QName, * org.apache.axiom.om.OMContainer) */ public OMElement createOMElement(QName qname, OMContainer parent) throws OMException { NamespaceImpl ns; if (qname.getPrefix() != null) { ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix()); } else { ns = new NamespaceImpl(qname.getNamespaceURI()); } return createOMElement(qname.getLocalPart(), ns, parent); }
return new NamespaceImpl(uri, prefix);
/** * Allows overriding an existing declaration if the same prefix was used. * * @see org.apache.axiom.om.OMElement#declareNamespace(String, String) */ public OMNamespace declareNamespace(String uri, String prefix) { if (prefix == null) { prefix = OMSerializerUtil.getNextNSPrefix(); } NamespaceImpl ns = new NamespaceImpl(uri, prefix); return declareNamespace(ns); }
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if (!OMConstants.XMLNS_NS_PREFIX.equals(localName)) { this.checkQName(prefix, localName); } else { return this.createAttribute(localName); } return new AttrImpl(this, localName, new NamespaceImpl( namespaceURI, prefix), this.factory); }
/** * @param attributeName * @param attrValue * @param soapEnvelopeNamespaceURI */ protected void setAttribute(String attributeName, String attrValue, String soapEnvelopeNamespaceURI) { OMAttribute omAttribute = this.getAttribute( new QName(soapEnvelopeNamespaceURI, attributeName)); if (omAttribute != null) { omAttribute.setAttributeValue(attrValue); } else { OMAttribute attribute = new AttrImpl(this.ownerNode, attributeName, new NamespaceImpl(soapEnvelopeNamespaceURI, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX), attrValue, this.factory); this.addAttribute(attribute); } }