本文整理汇总了Java中org.w3c.dom.ranges.RangeException.INVALID_NODE_TYPE_ERR属性的典型用法代码示例。如果您正苦于以下问题:Java RangeException.INVALID_NODE_TYPE_ERR属性的具体用法?Java RangeException.INVALID_NODE_TYPE_ERR怎么用?Java RangeException.INVALID_NODE_TYPE_ERR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.ranges.RangeException
的用法示例。
在下文中一共展示了RangeException.INVALID_NODE_TYPE_ERR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStart
public void setStart(Node refNode, int offset)
throws RangeException, DOMException
{
if (fDocument.errorChecking) {
if ( fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
checkIndex(refNode, offset);
fStartContainer = refNode;
fStartOffset = offset;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(true);
}
}
示例2: setEnd
public void setEnd(Node refNode, int offset)
throws RangeException, DOMException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
checkIndex(refNode, offset);
fEndContainer = refNode;
fEndOffset = offset;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(false);
}
}
示例3: setStartBefore
public void setStartBefore(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode) )
{
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fStartContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fStartOffset = i-1;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(true);
}
}
示例4: setStartAfter
public void setStartAfter(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fStartContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fStartOffset = i;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(true);
}
}
示例5: setEndBefore
public void setEndBefore(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fEndContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fEndOffset = i-1;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(false);
}
}
示例6: setEndAfter
public void setEndAfter(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if( fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fEndContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fEndOffset = i;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(false);
}
}
示例7: selectNode
public void selectNode(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer( refNode.getParentNode() ) ||
!isLegalContainedNode( refNode ) ) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
Node parent = refNode.getParentNode();
if (parent != null ) // REVIST: what to do if it IS null?
{
fStartContainer = parent;
fEndContainer = parent;
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fStartOffset = i-1;
fEndOffset = fStartOffset+1;
}
}
示例8: selectNodeContents
public void selectNodeContents(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if( fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fStartContainer = refNode;
fEndContainer = refNode;
Node first = refNode.getFirstChild();
fStartOffset = 0;
if (first == null) {
fEndOffset = 0;
} else {
int i = 0;
for (Node n = first; n!=null; n = n.getNextSibling()) {
i++;
}
fEndOffset = i;
}
}
示例9: setStart
public void setStart(Node refNode, int offset)
throws RangeException, DOMException
{
if (fDocument.errorChecking) {
if ( fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
checkIndex(refNode, offset);
fStartContainer = refNode;
fStartOffset = offset;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(true);
}
}
示例10: setEnd
public void setEnd(Node refNode, int offset)
throws RangeException, DOMException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
checkIndex(refNode, offset);
fEndContainer = refNode;
fEndOffset = offset;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(false);
}
}
示例11: setStartBefore
public void setStartBefore(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode) )
{
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fStartContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fStartOffset = i-1;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(true);
}
}
示例12: setStartAfter
public void setStartAfter(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fStartContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fStartOffset = i;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(true);
}
}
示例13: setEndBefore
public void setEndBefore(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fEndContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fEndOffset = i-1;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(false);
}
}
示例14: setEndAfter
public void setEndAfter(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if( fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !hasLegalRootContainer(refNode) ||
!isLegalContainedNode(refNode)) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
fEndContainer = refNode.getParentNode();
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fEndOffset = i;
// If one boundary-point of a Range is set to have a root container
// other
// than the current one for the Range, the Range should be collapsed to
// the new position.
// The start position of a Range should never be after the end position.
if (getCommonAncestorContainer() == null
|| (fStartContainer == fEndContainer && fEndOffset < fStartOffset)) {
collapse(false);
}
}
示例15: selectNode
public void selectNode(Node refNode)
throws RangeException
{
if (fDocument.errorChecking) {
if (fDetach) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
}
if ( !isLegalContainer( refNode.getParentNode() ) ||
!isLegalContainedNode( refNode ) ) {
throw new RangeExceptionImpl(
RangeException.INVALID_NODE_TYPE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
}
if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) {
throw new DOMException(
DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
}
}
Node parent = refNode.getParentNode();
if (parent != null ) // REVIST: what to do if it IS null?
{
fStartContainer = parent;
fEndContainer = parent;
int i = 0;
for (Node n = refNode; n!=null; n = n.getPreviousSibling()) {
i++;
}
fStartOffset = i-1;
fEndOffset = fStartOffset+1;
}
}