public void removeAttributeNS(String namespaceURI, String localName) 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); } if (OMConstants.XMLNS_NS_URI.equals(namespaceURI)) { //look in the ns list if (this.namespaces != null) { this.namespaces.remove(DOMUtil.getLocalName(localName)); } } else if (this.attributes != null) { this.attributes.removeNamedItemNS(namespaceURI, localName); } }
/** * Removes the specified attribute node. * * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr) */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (this.attributes == null || this.attributes.getNamedItem(oldAttr.getName()) == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } return (AttrImpl) this.attributes.removeNamedItem(oldAttr .getName()); }
public void setIdAttributeNode(Attr idAttr, 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 Iterator attrIter = this.getAllAttributes(); AttrImpl tempAttr = null; while (attrIter.hasNext()) { AttrImpl attr = (AttrImpl) attrIter.next(); if (attr.equals(idAttr)) { tempAttr = attr; break; } } 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); }
if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN,
/** * Removes an attribute by name. * * @param name The name of the attribute to remove * @see org.w3c.dom.Element#removeAttribute(String) */ public void removeAttribute(String name) 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); } if (name.startsWith(OMConstants.XMLNS_NS_PREFIX)) { String namespacePrefix = DOMUtil.getLocalName(name); if (this.findNamespaceURI(namespacePrefix) != null) { this.removeNamespace(namespacePrefix); } } if (this.attributes != null) { this.attributes.removeNamedItem(name); } }
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); }
public void setIdAttributeNS(String namespaceURI, String localName, 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.getAttributeNodeNS(namespaceURI, localName); 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); }
if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN,
/** * Creates a text node with the given value and adds it to the element. * * @see org.apache.axiom.om.OMElement#setText(String) */ public void setText(String text) { if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } // if we already have other text nodes remove them OMNode child = this.getFirstOMChild(); while (child != null) { if (child.getType() == OMNode.TEXT_NODE) { child.detach(); } child = child.getNextOMSibling(); } TextImpl textNode = (TextImpl) (this.ownerNode) .createTextNode(text); this.addChild(textNode); }
if (this.isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN,