当前位置: 首页>>代码示例>>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;未经允许,请勿转载。