本文整理汇总了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;
}
示例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!");
}
}
示例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);
}
示例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!");
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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));
}