当前位置: 首页>>代码示例>>Java>>正文


Java Node.getOwnerDocument方法代码示例

本文整理汇总了Java中mf.org.w3c.dom.Node.getOwnerDocument方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getOwnerDocument方法的具体用法?Java Node.getOwnerDocument怎么用?Java Node.getOwnerDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mf.org.w3c.dom.Node的用法示例。


在下文中一共展示了Node.getOwnerDocument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getXmlEncoding

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
private String _getXmlEncoding(Node node) {
    Document doc = (node.getNodeType() == Node.DOCUMENT_NODE) ? 
            (Document) node : node.getOwnerDocument();
    if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
        try {
            return (String) DocumentMethods.fgDocumentGetXmlEncodingMethod.invoke(doc, (Object[]) null);
        }
        // The VM ran out of memory or there was some other serious problem. Re-throw.
        catch (VirtualMachineError vme) {
            throw vme;
        }
        // ThreadDeath should always be re-thrown
        catch (ThreadDeath td) {
            throw td;
        }
        // Ignore all other exceptions and errors
        catch (Throwable t) {}
    }
    return null;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:21,代码来源:DOMSerializerImpl.java

示例2: _getXmlVersion

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
private String _getXmlVersion(Node node) {
    Document doc = (node.getNodeType() == Node.DOCUMENT_NODE) ? 
            (Document) node : node.getOwnerDocument();
    if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
        try {
            return (String) DocumentMethods.fgDocumentGetXmlVersionMethod.invoke(doc, (Object[]) null);
        }
        // The VM ran out of memory or there was some other serious problem. Re-throw.
        catch (VirtualMachineError vme) {
            throw vme;
        }
        // ThreadDeath should always be re-thrown
        catch (ThreadDeath td) {
            throw td;
        }
        // Ignore all other exceptions and errors
        catch (Throwable t) {}
    }
    return null;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:21,代码来源:DOMSerializerImpl.java

示例3: _getInputEncoding

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
private String _getInputEncoding(Node node) {
    Document doc = (node.getNodeType() == Node.DOCUMENT_NODE) ? 
            (Document) node : node.getOwnerDocument();
    if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
        try {
            return (String) DocumentMethods.fgDocumentGetInputEncodingMethod.invoke(doc, (Object[]) null);
        }
        // The VM ran out of memory or there was some other serious problem. Re-throw.
        catch (VirtualMachineError vme) {
            throw vme;
        }
        // ThreadDeath should always be re-thrown
        catch (ThreadDeath td) {
            throw td;
        }
        // Ignore all other exceptions and errors
        catch (Throwable t) {}
    }
    return null;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:21,代码来源:DOMSerializerImpl.java

示例4: insertBefore

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Since a Document may contain at most one top-level Element child,
 * and at most one DocumentType declaraction, we need to subclass our
 * add-children methods to implement this constraint.
 * Since appendChild() is implemented as insertBefore(,null),
 * altering the latter fixes both.
 * <p>
 * While I'm doing so, I've taken advantage of the opportunity to
 * cache documentElement and docType so we don't have to
 * search for them.
 *
 * REVISIT: According to the spec it is not allowed to alter neither the
 * document element nor the document type in any way
 */
public Node insertBefore(Node newChild, Node refChild)
throws DOMException {

    // Only one such child permitted
    int type = newChild.getNodeType();
    if (errorChecking) {
        if (needsSyncChildren()) {
            synchronizeChildren();
        }
        if((type == Node.ELEMENT_NODE && docElement != null) ||
        (type == Node.DOCUMENT_TYPE_NODE && docType != null)) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null);
            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
        }
    }
    // Adopt orphan doctypes
    if (newChild.getOwnerDocument() == null &&
    newChild instanceof DocumentTypeImpl) {
        ((DocumentTypeImpl) newChild).ownerDocument = this;
    }
    super.insertBefore(newChild,refChild);

    // If insert succeeded, cache the kid appropriately
    if (type == Node.ELEMENT_NODE) {
        docElement = (ElementImpl)newChild;
    }
    else if (type == Node.DOCUMENT_TYPE_NODE) {
        docType = (DocumentTypeImpl)newChild;
    }

    return newChild;

}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:48,代码来源:CoreDocumentImpl.java

示例5: replaceChild

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Since we cache the docElement (and, currently, docType),
 * replaceChild has to update the cache
 *
 * REVISIT: According to the spec it is not allowed to alter neither the
 * document element nor the document type in any way
 */
public Node replaceChild(Node newChild, Node oldChild)
throws DOMException {

    // Adopt orphan doctypes
    if (newChild.getOwnerDocument() == null &&
    newChild instanceof DocumentTypeImpl) {
        ((DocumentTypeImpl) newChild).ownerDocument = this;
    }

    if (errorChecking &&((docType != null &&
        oldChild.getNodeType() != Node.DOCUMENT_TYPE_NODE && 
        newChild.getNodeType() == Node.DOCUMENT_TYPE_NODE) 
        || (docElement != null && 
        oldChild.getNodeType() != Node.ELEMENT_NODE && 
        newChild.getNodeType() == Node.ELEMENT_NODE))) {
        	
        throw new DOMException(
            DOMException.HIERARCHY_REQUEST_ERR,
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null));
    }
    super.replaceChild(newChild, oldChild);

    int type = oldChild.getNodeType();
    if(type == Node.ELEMENT_NODE) {
        docElement = (ElementImpl)newChild;
    }
    else if (type == Node.DOCUMENT_TYPE_NODE) {
        docType = (DocumentTypeImpl)newChild;
    }
    return oldChild;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:39,代码来源:CoreDocumentImpl.java

示例6: useIsSameNode

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Use isSameNode() for testing node identity if the DOM implementation
 * supports DOM Level 3 core and it isn't the Xerces implementation.
 */
private boolean useIsSameNode(Node node) {
    if (node instanceof NodeImpl) {
        return false;
    }
    Document doc = node.getNodeType() == Node.DOCUMENT_NODE 
        ? (Document) node : node.getOwnerDocument();
    return (doc != null && doc.getImplementation().hasFeature("Core", "3.0"));
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:13,代码来源:TreeWalkerImpl.java

示例7: setStart

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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);
    } 
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:37,代码来源:RangeImpl.java

示例8: setEnd

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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);
    } 
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:37,代码来源:RangeImpl.java

示例9: setStartBefore

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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);
    }  
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:41,代码来源:RangeImpl.java

示例10: setStartAfter

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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);
    } 
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:39,代码来源:RangeImpl.java

示例11: setEndBefore

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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);
    } 
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:39,代码来源:RangeImpl.java

示例12: setEndAfter

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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);
    } 
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:39,代码来源:RangeImpl.java

示例13: selectNode

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:35,代码来源:RangeImpl.java

示例14: selectNodeContents

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
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;
    }
    
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:36,代码来源:RangeImpl.java

示例15: setDOMResult

import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
public void setDOMResult(DOMResult result) {
    fIgnoreChars = false;
    if (result != null) {
    	//MF - Renamed - Resourced
        final Node target = (Node) result.getNode();
        fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument();
        fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null;
        fStorePSVI = (fDocument instanceof PSVIDocumentImpl);
        return;
    }
    fDocument = null;
    fDocumentImpl = null;
    fStorePSVI = false;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:15,代码来源:DOMResultAugmentor.java


注:本文中的mf.org.w3c.dom.Node.getOwnerDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。