當前位置: 首頁>>代碼示例>>Java>>正文


Java DOMException.TYPE_MISMATCH_ERR屬性代碼示例

本文整理匯總了Java中org.w3c.dom.DOMException.TYPE_MISMATCH_ERR屬性的典型用法代碼示例。如果您正苦於以下問題:Java DOMException.TYPE_MISMATCH_ERR屬性的具體用法?Java DOMException.TYPE_MISMATCH_ERR怎麽用?Java DOMException.TYPE_MISMATCH_ERR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.w3c.dom.DOMException的用法示例。


在下文中一共展示了DOMException.TYPE_MISMATCH_ERR屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newTypeMismatchError

private static DOMException newTypeMismatchError(String name) {
    String msg =
        DOMMessageFormatter.formatMessage (
                DOMMessageFormatter.DOM_DOMAIN,
                "TYPE_MISMATCH_ERR",
                new Object[] { name });
    return new DOMException (DOMException.TYPE_MISMATCH_ERR, msg);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:DOMParserImpl.java

示例2: setAttributeNode

/**
    * Adds a new attribute node. If an attribute with that name (
    * <code>nodeName</code>) is already present in the element, it is
    * replaced by the new one. Replacing an attribute node by itself has no
    * effect.
    * <br>To add a new attribute node with a qualified name and namespace
    * URI, use the <code>setAttributeNodeNS</code> method.
    * @param newAttr The <code>Attr</code> node to add to the attribute list.
    * @return If the <code>newAttr</code> attribute replaces an existing
    *   attribute, the replaced <code>Attr</code> node is returned,
    *   otherwise <code>null</code> is returned.
    * @exception DOMException
    *   WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
    *   different document than the one that created the element.
    *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
    *   attribute of another <code>Element</code> object. The DOM user must
    *   explicitly clone <code>Attr</code> nodes to re-use them in other
    *   elements.
    */
   public Attribute setAttributeNode(org.w3c.dom.Attr newAttr) {
checkNotInTree();
if(newAttr instanceof Attribute) {
    Attribute attribute = (Attribute)newAttr;
    Attribute oldAttr = getAttributeNode(newAttr.getName());
    if (oldAttr==null) {
	getAttributesForWrite().add(attribute);
	return attribute;
    } else {
	int index = getAttributesForRead().indexOf(oldAttr);
	return getAttributesForWrite().set(index,attribute);
    }
} else {
    throw new DOMException(DOMException.TYPE_MISMATCH_ERR,null);
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:Element.java


注:本文中的org.w3c.dom.DOMException.TYPE_MISMATCH_ERR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。