public boolean hasAttribute(String name) { return this.getAttributeNode(name) != null; }
/** * Returns a named attribute if present. * * @see org.apache.axiom.om.OMElement#getAttribute (javax.xml.namespace.QName) */ public OMAttribute getAttribute(QName qname) { if (this.attributes == null) { return null; } if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals("")) { return (AttrImpl) this.getAttributeNode(qname.getLocalPart()); } else { return (AttrImpl) this.getAttributeNodeNS(qname.getNamespaceURI(), qname.getLocalPart()); } }
Attr attributeNode = this.getAttributeNode(qualifiedName); if (attributeNode != null) { AttrImpl tempAttr = ((AttrImpl) attributeNode);
public void setIdAttribute(String name, boolean isId) throws DOMException { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } //find the attr AttrImpl tempAttr = (AttrImpl) this.getAttributeNode(name); if (tempAttr == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } this.updateIsId(isId, tempAttr); }