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


Java Node.ATTRIBUTE_NODE属性代码示例

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


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

示例1: hasLegalRootContainer

/**
 * Finds the root container for the given node and determines
 * if that root container is legal with respect to the
 * DOM 2 specification.  At present, that means the root
 * container must be either an attribute, a document,
 * or a document fragment.
 */
private boolean hasLegalRootContainer( Node node )
{
	if ( node==null )
		return false;

	Node rootContainer = getRootContainer( node );
	switch( rootContainer.getNodeType() )
	{
	case Node.ATTRIBUTE_NODE:
	case Node.DOCUMENT_NODE:
	case Node.DOCUMENT_FRAGMENT_NODE:
		return true;
	}
	return false;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:22,代码来源:RangeImpl.java

示例2: isLegalContainedNode

/**
 * Returns true IFF the given node can be contained by
 * a range.
 */
private boolean isLegalContainedNode( Node node )
{
	if ( node==null )
		return false;
	switch( node.getNodeType() )
	{
	case Node.DOCUMENT_NODE:
	case Node.DOCUMENT_FRAGMENT_NODE:
	case Node.ATTRIBUTE_NODE:
	case Node.ENTITY_NODE:
	case Node.NOTATION_NODE:
		return false;
	}
	return true;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:19,代码来源:RangeImpl.java

示例3: cloneNode

/** Creates a clone of the specified node. */
public int cloneNode(int nodeIndex, boolean deep) {

    // clone immediate node
    
    int nchunk = nodeIndex >> CHUNK_SHIFT;
    int nindex = nodeIndex & CHUNK_MASK;
    int nodeType = fNodeType[nchunk][nindex];
    int cloneIndex = createNode((short)nodeType);
    int cchunk = cloneIndex >> CHUNK_SHIFT;
    int cindex = cloneIndex & CHUNK_MASK;
    setChunkValue(fNodeName, fNodeName[nchunk][nindex], cchunk, cindex);
    setChunkValue(fNodeValue, fNodeValue[nchunk][nindex], cchunk, cindex);
    setChunkValue(fNodeURI, fNodeURI[nchunk][nindex], cchunk, cindex);
    int extraIndex = fNodeExtra[nchunk][nindex];
    if (extraIndex != -1) {
        if (nodeType != Node.ATTRIBUTE_NODE && nodeType != Node.TEXT_NODE) {
            extraIndex = cloneNode(extraIndex, false);
        }
        setChunkIndex(fNodeExtra, extraIndex, cchunk, cindex);
    }

    // clone and attach children
    if (deep) {
        int prevIndex = -1;
        int childIndex = getLastChild(nodeIndex, false);
        while (childIndex != -1) {
            int clonedChildIndex = cloneNode(childIndex, deep);
            insertBefore(cloneIndex, clonedChildIndex, prevIndex);
            prevIndex = clonedChildIndex;
            childIndex = getRealPrevSibling(childIndex, false);
        }
        

    }
    
    // return cloned node index
    return cloneIndex;

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

示例4: saveEnclosingAttr

/**
 * NON-DOM INTERNAL: Pre-mutation context check, in
 * preparation for later generating DOMAttrModified events.
 * Determines whether this node is within an Attr
 * @param node node to get enclosing attribute for
 */
protected void saveEnclosingAttr(NodeImpl node) {
    savedEnclosingAttr = null;
    // MUTATION PREPROCESSING AND PRE-EVENTS:
    // If we're within the scope of an Attr and DOMAttrModified 
    // was requested, we need to preserve its previous value for
    // that event.
    LCount lc = LCount.lookup(MutationEventImpl.DOM_ATTR_MODIFIED);
    if (lc.total > 0) {
        NodeImpl eventAncestor = node;
        while (true) {
            if (eventAncestor == null)
                return;
            int type = eventAncestor.getNodeType();
            if (type == Node.ATTRIBUTE_NODE) {
                EnclosingAttr retval = new EnclosingAttr();
                retval.node = (AttrImpl) eventAncestor;
                retval.oldvalue = retval.node.getNodeValue();
                savedEnclosingAttr = retval;
                return;
            }
            else if (type == Node.ENTITY_REFERENCE_NODE)
                eventAncestor = eventAncestor.parentNode();
            else if (type == Node.TEXT_NODE)
                eventAncestor = eventAncestor.parentNode();
            else
                return;
            // Any other parent means we're not in an Attr
        }
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:36,代码来源:DocumentImpl.java

示例5: lookupPrefix

/**
 * 
 * DOM Level 3 - Experimental:
 * Look up the prefix associated to the given namespace URI, starting from this node.
 * 
 * @param namespaceURI
 * @return the prefix for the namespace
 */
public String lookupPrefix(String namespaceURI){
    
    // REVISIT: When Namespaces 1.1 comes out this may not be true
    // Prefix can't be bound to null namespace
    if (namespaceURI == null) {
        return null;
    }

    short type = this.getNodeType();

    switch (type) {
    case Node.ELEMENT_NODE: {
            this.getNamespaceURI(); // to flip out children 
            return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
        }
    case Node.DOCUMENT_NODE:{
            return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
        }

    case Node.ENTITY_NODE :
    case Node.NOTATION_NODE:
    case Node.DOCUMENT_FRAGMENT_NODE:
    case Node.DOCUMENT_TYPE_NODE:
        // type is unknown
        return null;
    case Node.ATTRIBUTE_NODE:{
            if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
                return ownerNode.lookupPrefix(namespaceURI);

            }
            return null;
        }
    default:{   
            NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
            if (ancestor != null) {
                return ancestor.lookupPrefix(namespaceURI);
            }
            return null;
        }

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

示例6: surroundContents

public void surroundContents(Node newParent)
    throws DOMException, RangeException
{
    if (newParent==null) return;
    int type = newParent.getNodeType();
    
    if (fDocument.errorChecking) {
        if (fDetach) {
            throw new DOMException(
                    DOMException.INVALID_STATE_ERR, 
                    DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null));
        }
        if (type == Node.ATTRIBUTE_NODE
                || type == Node.ENTITY_NODE
                || type == Node.NOTATION_NODE
                || type == Node.DOCUMENT_TYPE_NODE
                || type == Node.DOCUMENT_NODE
                || type == Node.DOCUMENT_FRAGMENT_NODE)
        {
            throw new RangeExceptionImpl(
                    RangeException.INVALID_NODE_TYPE_ERR, 
                    DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null));
        }
    }
    
    Node realStart = fStartContainer;
    Node realEnd = fEndContainer;
    if (fStartContainer.getNodeType() == Node.TEXT_NODE) {
        realStart = fStartContainer.getParentNode();
    }
    if (fEndContainer.getNodeType() == Node.TEXT_NODE) {
        realEnd = fEndContainer.getParentNode();
    }
        
    if (realStart != realEnd) {
       	throw new RangeExceptionImpl(
		RangeException.BAD_BOUNDARYPOINTS_ERR, 
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "BAD_BOUNDARYPOINTS_ERR", null));
    }

	DocumentFragment frag = extractContents();
	insertNode(newParent);
	newParent.appendChild(frag);
	selectNode(newParent);
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:45,代码来源:RangeImpl.java

示例7: AttrImpl

/** Default Constructor */
public AttrImpl() {
    nodeType = Node.ATTRIBUTE_NODE;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:4,代码来源:AttrImpl.java

示例8: getNodeType

/**
 * A short integer indicating what type of node this is. The named
 * constants for this value are defined in the org.w3c.dom.Node interface.
 */
public short getNodeType() {
    return Node.ATTRIBUTE_NODE;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:7,代码来源:AttrImpl.java


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