Java Code Examples for org.w3c.dom.DOMException#NO_MODIFICATION_ALLOWED_ERR
The following examples show how to use
org.w3c.dom.DOMException#NO_MODIFICATION_ALLOWED_ERR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElementImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Add a new name/value pair, or replace the value of the existing * attribute having that name. * * Note: this method supports only the simplest kind of Attribute, * one whose value is a string contained in a single Text node. * If you want to assert a more complex value (which XML permits, * though HTML doesn't), see setAttributeNode(). * * The attribute is created with specified=true, meaning it's an * explicit value rather than inherited from the DTD as a default. * Again, setAttributeNode can be used to achieve other results. * * @throws DOMException(INVALID_NAME_ERR) if the name is not acceptable. * (Attribute factory will do that test for us.) * * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if the node is * readonly. */ public void setAttribute(String name, String value) { if (ownerDocument.errorChecking && isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (needsSyncData()) { synchronizeData(); } Attr newAttr = getAttributeNode(name); if (newAttr == null) { newAttr = getOwnerDocument().createAttribute(name); if (attributes == null) { attributes = new AttributeMap(this, null); } newAttr.setNodeValue(value); attributes.setNamedItem(newAttr); } else { newAttr.setNodeValue(value); } }
Example 2
Source File: EntityImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * The namespace prefix of this node * @exception DOMException * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void setPrefix(String prefix) throws DOMException { if (ownerDocument.errorChecking && isReadOnly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); } }
Example 3
Source File: NotationImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * NON-DOM: The System Identifier for this Notation. If no system * identifier was specified, this will be null. */ public void setSystemId(String id) { if(isReadOnly()) { throw new DOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); } if (needsSyncData()) { synchronizeData(); } systemId = id; }
Example 4
Source File: CharacterDataImpl.java From marklogic-contentpump with Apache License 2.0 | 4 votes |
/** Unsupported. */ public void setData(String data) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null); }
Example 5
Source File: AttrImpl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * The DOM doesn't clearly define what setValue(null) means. I've taken it * as "remove all children", which from outside should appear * similar to setting it to the empty string. */ public void setValue(String newvalue) { CoreDocumentImpl ownerDocument = ownerDocument(); if (ownerDocument.errorChecking && isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } Element ownerElement = getOwnerElement(); String oldvalue = ""; if (needsSyncData()) { synchronizeData(); } if (needsSyncChildren()) { synchronizeChildren(); } if (value != null) { if (ownerDocument.getMutationEvents()) { // Can no longer just discard the kids; they may have // event listeners waiting for them to disconnect. if (hasStringValue()) { oldvalue = (String) value; // create an actual text node as our child so // that we can use it in the event if (textNode == null) { textNode = (TextImpl) ownerDocument.createTextNode((String) value); } else { textNode.data = (String) value; } value = textNode; textNode.isFirstChild(true); textNode.previousSibling = textNode; textNode.ownerNode = this; textNode.isOwned(true); hasStringValue(false); internalRemoveChild(textNode, true); } else { oldvalue = getValue(); while (value != null) { internalRemoveChild((Node) value, true); } } } else { if (hasStringValue()) { oldvalue = (String) value; } else { // simply discard children if any oldvalue = getValue(); // remove ref from first child to last child ChildNode firstChild = (ChildNode) value; firstChild.previousSibling = null; firstChild.isFirstChild(false); firstChild.ownerNode = ownerDocument; } // then remove ref to current value value = null; needsSyncChildren(false); } if (isIdAttribute() && ownerElement != null) { ownerDocument.removeIdentifier(oldvalue); } } // Create and add the new one, generating only non-aggregate events // (There are no listeners on the new Text, but there may be // capture/bubble listeners on the Attr. // Note that aggregate events are NOT dispatched here, // since we need to combine the remove and insert. isSpecified(true); if (ownerDocument.getMutationEvents()) { // if there are any event handlers create a real node internalInsertBefore(ownerDocument.createTextNode(newvalue), null, true); hasStringValue(false); // notify document ownerDocument.modifiedAttrValue(this, oldvalue); } else { // directly store the string value = newvalue; hasStringValue(true); changed(); } if (isIdAttribute() && ownerElement != null) { ownerDocument.putIdentifier(newvalue, ownerElement); } }
Example 6
Source File: IIOMetadataNode.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public Node removeNamedItem(java.lang.String name) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); }
Example 7
Source File: IIOMetadataNode.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public Node removeNamedItem(java.lang.String name) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); }
Example 8
Source File: DocumentImpl.java From marklogic-contentpump with Apache License 2.0 | 4 votes |
/** Unsupported. */ public void normalizeDocument() { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null); }
Example 9
Source File: ElementImpl.java From marklogic-contentpump with Apache License 2.0 | 4 votes |
/** Unsupported. */ public void setAttribute(String name, String value) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null); }
Example 10
Source File: NodeImpl.java From marklogic-contentpump with Apache License 2.0 | 4 votes |
/** Unsupported. */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null); }
Example 11
Source File: AttrImpl.java From marklogic-contentpump with Apache License 2.0 | 4 votes |
/** Unsupported. */ public void setValue(String value) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null); }
Example 12
Source File: NodeImpl.java From marklogic-contentpump with Apache License 2.0 | 4 votes |
/** Unsupported. */ public void setTextContent(String textContent) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, null); }
Example 13
Source File: AttrImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * The DOM doesn't clearly define what setValue(null) means. I've taken it * as "remove all children", which from outside should appear * similar to setting it to the empty string. */ public void setValue(String newvalue) { CoreDocumentImpl ownerDocument = ownerDocument(); if (ownerDocument.errorChecking && isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } Element ownerElement = getOwnerElement(); String oldvalue = ""; if (needsSyncData()) { synchronizeData(); } if (needsSyncChildren()) { synchronizeChildren(); } if (value != null) { if (ownerDocument.getMutationEvents()) { // Can no longer just discard the kids; they may have // event listeners waiting for them to disconnect. if (hasStringValue()) { oldvalue = (String) value; // create an actual text node as our child so // that we can use it in the event if (textNode == null) { textNode = (TextImpl) ownerDocument.createTextNode((String) value); } else { textNode.data = (String) value; } value = textNode; textNode.isFirstChild(true); textNode.previousSibling = textNode; textNode.ownerNode = this; textNode.isOwned(true); hasStringValue(false); internalRemoveChild(textNode, true); } else { oldvalue = getValue(); while (value != null) { internalRemoveChild((Node) value, true); } } } else { if (hasStringValue()) { oldvalue = (String) value; } else { // simply discard children if any oldvalue = getValue(); // remove ref from first child to last child ChildNode firstChild = (ChildNode) value; firstChild.previousSibling = null; firstChild.isFirstChild(false); firstChild.ownerNode = ownerDocument; } // then remove ref to current value value = null; needsSyncChildren(false); } if (isIdAttribute() && ownerElement != null) { ownerDocument.removeIdentifier(oldvalue); } } // Create and add the new one, generating only non-aggregate events // (There are no listeners on the new Text, but there may be // capture/bubble listeners on the Attr. // Note that aggregate events are NOT dispatched here, // since we need to combine the remove and insert. isSpecified(true); if (ownerDocument.getMutationEvents()) { // if there are any event handlers create a real node internalInsertBefore(ownerDocument.createTextNode(newvalue), null, true); hasStringValue(false); // notify document ownerDocument.modifiedAttrValue(this, oldvalue); } else { // directly store the string value = newvalue; hasStringValue(true); changed(); } if (isIdAttribute() && ownerElement != null) { ownerDocument.putIdentifier(newvalue, ownerElement); } }
Example 14
Source File: IIOMetadataNode.java From hottub with GNU General Public License v2.0 | 4 votes |
public Node setNamedItem(Node arg) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); }
Example 15
Source File: DTMNodeProxy.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * * @param newChild * @param oldChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ @Override public final Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); }
Example 16
Source File: DTMNodeProxy.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * * @param newChild * @param refChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ @Override public final Node insertBefore(Node newChild, Node refChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); }
Example 17
Source File: DTMNodeProxy.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
/** * * @param newChild * @param oldChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ @Override public final Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); }
Example 18
Source File: DTMNodeProxy.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * * @param newChild * @param oldChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ @Override public final Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); }
Example 19
Source File: DTMNodeProxy.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * * @param prefix * * @throws DOMException * @see org.w3c.dom.Node as of DOM Level 2 -- DTMNodeProxy is read-only */ @Override public final void setPrefix(String prefix) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); }
Example 20
Source File: DTMNodeProxy.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * * @param nodeValue * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ @Override public final void setNodeValue(String nodeValue) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); }