本文整理汇总了Java中org.w3c.dom.DOMException.NO_MODIFICATION_ALLOWED_ERR属性的典型用法代码示例。如果您正苦于以下问题:Java DOMException.NO_MODIFICATION_ALLOWED_ERR属性的具体用法?Java DOMException.NO_MODIFICATION_ALLOWED_ERR怎么用?Java DOMException.NO_MODIFICATION_ALLOWED_ERR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.DOMException
的用法示例。
在下文中一共展示了DOMException.NO_MODIFICATION_ALLOWED_ERR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeAttribute
/**
* Remove the named attribute from this Element. If the removed
* Attribute has a default value, it is immediately replaced thereby.
* <P>
* The default logic is actually implemented in NamedNodeMapImpl.
* PR-DOM-Level-1-19980818 doesn't fully address the DTD, so some
* of this behavior is likely to change in future versions. ?????
* <P>
* Note that this call "succeeds" even if no attribute by this name
* existed -- unlike removeAttributeNode, which will throw a not-found
* exception in that case.
*
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if the node is
* readonly.
*/
public void removeAttribute(String name) {
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();
}
if (attributes == null) {
return;
}
attributes.safeRemoveNamedItem(name);
}
示例2: removeAttributeNS
/**
* Introduced in DOM Level 2. <p>
*
* Removes an attribute by local name and namespace URI. If the removed
* attribute has a default value it is immediately replaced.
* The replacing attribute has the same namespace URI and local name,
* as well as the original prefix.<p>
*
* @param namespaceURI The namespace URI of the attribute to remove.
*
* @param localName The local name of the attribute to remove.
* @throws NO_MODIFICATION_ALLOWED_ERR: Raised if this
* node is readonly.
* @since WD-DOM-Level-2-19990923
*/
public void removeAttributeNS(String namespaceURI, String localName) {
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();
}
if (attributes == null) {
return;
}
attributes.safeRemoveNamedItemNS(namespaceURI, localName);
}
示例3: appendData
/**
* Concatenate additional characters onto the end of the data
* stored in this node. Note that this, and insert(), are the paths
* by which a DOM could wind up accumulating more data than the
* language's strings can easily handle. (See above discussion.)
*
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if node is readonly.
*/
public void appendData(String data) {
if (isReadOnly()) {
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null);
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg);
}
if (data == null) {
return;
}
if (needsSyncData()) {
synchronizeData();
}
setNodeValue(this.data + data);
}
示例4: removeAttribute
/**
* Remove the named attribute from this Element. If the removed Attribute
* has a default value, it is immediately replaced thereby.
* <P>
* The default logic is actually implemented in NamedNodeMapImpl.
* PR-DOM-Level-1-19980818 doesn't fully address the DTD, so some of this
* behavior is likely to change in future versions. ?????
* <P>
* Note that this call "succeeds" even if no attribute by this name existed
* -- unlike removeAttributeNode, which will throw a not-found exception in
* that case.
*
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if the node is
* readonly.
*/
public void removeAttribute(String name) {
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();
}
if (attributes == null) {
return;
}
attributes.safeRemoveNamedItem(name);
}
示例5: setPrefix
/**
* 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));
}
}
示例6: replaceData
/**
* Replace a series of characters at the specified (zero-based)
* offset with a new string, NOT necessarily of the same
* length. Convenience method, equivalent to a delete followed by an
* insert. Throws a DOMException if the specified offset is beyond
* the end of the existing data.
*
* @param offset The offset at which to begin replacing.
*
* @param count The number of characters to remove,
* interpreted as in the delete() method.
*
* @param data The new string to be inserted at offset in place of
* the removed data. Note that the entire string will
* be inserted -- the count parameter does not affect
* insertion, and the new data may be longer or shorter
* than the substring it replaces.
*
* @throws DOMException(INDEX_SIZE_ERR) if offset is negative or
* greater than length, or if count is negative.
*
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if node is
* readonly.
*/
public void replaceData(int offset, int count, String data)
throws DOMException {
CoreDocumentImpl ownerDocument = ownerDocument();
// The read-only check is done by deleteData()
// ***** This could be more efficient w/r/t Mutation Events,
// specifically by aggregating DOMAttrModified and
// DOMSubtreeModified. But mutation events are
// underspecified; I don't feel compelled
// to deal with it right now.
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();
}
//notify document
ownerDocument.replacingData(this);
// keep old value for document notification
String oldvalue = this.data;
internalDeleteData(offset, count, true);
internalInsertData(offset, data, true);
ownerDocument.replacedCharacterData(this, oldvalue, this.data);
}
示例7: splitText
/**
* Break a text node into two sibling nodes. (Note that if the current node
* has no parent, they won't wind up as "siblings" -- they'll both be
* orphans.)
*
* @param offset
* The offset at which to split. If offset is at the end of the
* available data, the second node will be empty.
*
* @return A reference to the new node (containing data after the offset
* point). The original node will contain data up to that point.
*
* @throws DOMException(INDEX_SIZE_ERR)
* if offset is <0 or >length.
*
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR)
* if node is read-only.
*/
public Text splitText(int offset)
throws DOMException {
if (isReadOnly()) {
throw new DOMException(
DOMException.NO_MODIFICATION_ALLOWED_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
}
if (needsSyncData()) {
synchronizeData();
}
if (offset < 0 || offset > data.length() ) {
throw new DOMException(DOMException.INDEX_SIZE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR", null));
}
// split text into two separate nodes
Text newText =
getOwnerDocument().createTextNode(data.substring(offset));
setNodeValue(data.substring(0, offset));
// insert new text node
Node parentNode = getParentNode();
if (parentNode != null) {
parentNode.insertBefore(newText, nextSibling);
}
return newText;
}
示例8: setNodeValue
/**
* Sets the node value.
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR)
*/
public void setNodeValue(String x)
throws DOMException {
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);
}
}
示例9: setPublicId
/**
* NON-DOM: The Public Identifier for this Notation. If no public
* identifier was specified, this will be null.
*/
public void setPublicId(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();
}
publicId = id;
}
示例10: setNodeValueInternal
/** This function added so that we can distinguish whether
* setNodeValue has been called from some other DOM functions.
* or by the client.<p>
* This is important, because we do one type of Range fix-up,
* from the high-level functions in CharacterData, and another
* type if the client simply calls setNodeValue(value).
*/
protected void setNodeValueInternal(String value, boolean replace) {
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);
}
// revisit: may want to set the value in ownerDocument.
// Default behavior, overridden in some subclasses
if (needsSyncData()) {
synchronizeData();
}
// keep old value for document notification
String oldvalue = this.data;
// notify document
ownerDocument.modifyingCharacterData(this, replace);
this.data = value;
// notify document
ownerDocument.modifiedCharacterData(this, oldvalue, value, replace);
}
示例11: removeNamedItem
public Node removeNamedItem(java.lang.String name) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
"This NamedNodeMap is read-only!");
}
示例12: setNamedItem
public Node setNamedItem(Node arg) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
"This NamedNodeMap is read-only!");
}
示例13: insertBefore
/**
*
* @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);
}
示例14: replaceChild
/**
*
* @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);
}
示例15: importNode
/**
*
* @param importedNode
* @param deep
*
*
*
* @throws DOMException
* @see org.w3c.dom.Document as of DOM Level 2 -- DTMNodeProxy is read-only
*/
@Override
public final Node importNode(Node importedNode, boolean deep)
throws DOMException
{
throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
}