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


Java DOMException.NOT_FOUND_ERR屬性代碼示例

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


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

示例1: replaceChild

public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
    if (mChildNodes.contains(oldChild)) {
        // Try to remove the new child if available
        try {
            mChildNodes.remove(newChild);
        } catch (DOMException e) {
            // Ignore exception
        }
        mChildNodes.setElementAt(newChild, mChildNodes.indexOf(oldChild));
        ((NodeImpl)newChild).setParentNode(this);
        ((NodeImpl)oldChild).setParentNode(null);
    } else {
        throw new DOMException(DOMException.NOT_FOUND_ERR, "Old child does not exist");
    }
    return oldChild;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:16,代碼來源:NodeImpl.java

示例2: removeAttribute

private void removeAttribute(String name, boolean checkPresent) {
    int numAttributes = attributes.size();
    for (int i = 0; i < numAttributes; i++) {
        IIOAttr attr = (IIOAttr)attributes.get(i);
        if (name.equals(attr.getName())) {
            attr.setOwnerElement(null);
            attributes.remove(i);
            return;
        }
    }

    // If we get here, the attribute doesn't exist
    if (checkPresent) {
        throw new IIODOMException(DOMException.NOT_FOUND_ERR,
                                  "No such attribute!");
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:IIOMetadataNode.java

示例3: removeItem

/**
 * NON-DOM: Remove the node object
 *
 * NOTE: Specifically removes THIS NODE -- not the node with this
 * name, nor the node with these contents. If node does not belong to
 * this named node map, we throw a DOMException.
 *
 * @param item       The node to remove
 * @param addDefault true -- magically add default attribute
 * @return Removed node
 * @exception DOMException
 */
protected Node removeItem(Node item, boolean addDefault)
    throws DOMException {

    int index = -1;
    if (nodes != null) {
        final int size = nodes.size();
        for (int i = 0; i < size; ++i) {
            if (nodes.get(i) == item) {
                index = i;
                break;
            }
        }
    }
    if (index < 0) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null);
        throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
    }

    return remove((AttrImpl)item, index, addDefault);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:32,代碼來源:AttributeMap.java

示例4: removeAttribute

private void removeAttribute(String name, boolean checkPresent) {
    int numAttributes = attributes.size();
    for (int i = 0; i < numAttributes; i++) {
        IIOAttr attr = attributes.get(i);
        if (name.equals(attr.getName())) {
            attr.setOwnerElement(null);
            attributes.remove(i);
            return;
        }
    }

    // If we get here, the attribute doesn't exist
    if (checkPresent) {
        throw new IIODOMException(DOMException.NOT_FOUND_ERR,
                                  "No such attribute!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:IIOMetadataNode.java

示例5: removeChild

public Node removeChild(Node oldChild) throws DOMException {
    if (mChildNodes.contains(oldChild)) {
        mChildNodes.remove(oldChild);
        ((NodeImpl)oldChild).setParentNode(null);
    } else {
        throw new DOMException(DOMException.NOT_FOUND_ERR, "Child does not exist");
    }
    return null;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:9,代碼來源:NodeImpl.java

示例6: removeNamedItem

public Node removeNamedItem(String name) throws DOMException {
    Node node = getNamedItem(name);
    if (node == null) {
        throw new DOMException(DOMException.NOT_FOUND_ERR, "Not found");
    } else {
        mNodes.remove(node);
    }
    return node;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:9,代碼來源:NamedNodeMapImpl.java

示例7: newFeatureNotFoundError

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

示例8: getParameter

/**
 * This method returns the value of a parameter if known.
 *
 * @see org.w3c.dom.DOMConfiguration#getParameter(java.lang.String)
 *
 * @param name A String containing the DOMConfiguration parameter name
 *             whose value is to be returned.
 * @return Object The value of the parameter if known.
 */
public Object getParameter(String name) throws DOMException {

    if(name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)){
                  return null;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) {
        return ((fFeatures & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) {
        return ((fFeatures & CDATA) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) {
        return ((fFeatures & ENTITIES) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) {
        return ((fFeatures & NAMESPACES) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) {
        return ((fFeatures & NAMESPACEDECLS) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) {
        return ((fFeatures & SPLITCDATA) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) {
        return ((fFeatures & WELLFORMED) != 0) ? Boolean.TRUE : Boolean.FALSE;
    }  else if (name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) {
        return ((fFeatures & DISCARDDEFAULT) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) {
        return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) {
        return ((fFeatures & XMLDECL) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) {
        return ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) ? Boolean.TRUE : Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
        return Boolean.TRUE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM)
            || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION)
            || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION)
            // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)
            || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE)
            || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) {
        return Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)){
        if ((fFeatures & ENTITIES) == 0 &&
                (fFeatures & CDATA) == 0 &&
                (fFeatures & ELEM_CONTENT_WHITESPACE) != 0 &&
                (fFeatures & NAMESPACES) != 0 &&
                (fFeatures & NAMESPACEDECLS) != 0 &&
                (fFeatures & WELLFORMED) != 0 &&
                (fFeatures & COMMENTS) != 0) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) {
        return fDOMErrorHandler;
    } else if (
            name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION)
            || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) {
        return null;
    } else {
        // Here we have to add the Xalan specific DOM Message Formatter
        String msg = Utils.messages.createMessage(
                MsgKey.ER_FEATURE_NOT_FOUND,
                new Object[] { name });
        throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:69,代碼來源:LSSerializerImpl.java

示例9: removeChild

/**
 * Remove a child from this Node. The removed child's subtree
 * remains intact so it may be re-inserted elsewhere.
 *
 * @return oldChild, in its new state (removed).
 *
 * @throws DOMException(NOT_FOUND_ERR) if oldChild is not a child of
 * this node.
 *
 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is
 * read-only.
 */
public Node removeChild(Node oldChild)
    throws DOMException {
    // Tail-call, should be optimizable
    if (hasStringValue()) {
        // we don't have any child per say so it can't be one of them!
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null);
        throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
    }
    return internalRemoveChild(oldChild, false);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:AttrImpl.java

示例10: removeChild

/**
 * Remove a child from this Node. The removed child's subtree
 * remains intact so it may be re-inserted elsewhere.
 * <P>
 * By default we do not have any children, ParentNode overrides this.
 * @see ParentNode
 *
 * @return oldChild, in its new state (removed).
 *
 * @throws DOMException(NOT_FOUND_ERR) if oldChild is not a child of
 * this node.
 *
 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is
 * read-only.
 */
public Node removeChild(Node oldChild)
            throws DOMException {
    throw new DOMException(DOMException.NOT_FOUND_ERR,
          DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
             "NOT_FOUND_ERR", null));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:NodeImpl.java


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