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


Java Node.getNodeType方法代码示例

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


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

示例1: parseConnectionFactory

import org.w3c.dom.Node; //导入方法依赖的package包/类
protected void parseConnectionFactory(Context context, Node node) {
    ConnectionFactoryConfiguration connectionFactoryConfiguration = new ConnectionFactoryConfiguration();

    context.setConnectionFactoryConfiguration(connectionFactoryConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    if (stringHasValue(type)) {
        connectionFactoryConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(connectionFactoryConfiguration, childNode);
        }
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:26,代码来源:MyBatisGeneratorConfigurationParser.java

示例2: lengthUnknownElement

import org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Method lengthUnknownElement
 * NOTE possibly buggy.
 * @return the number of the UnknownElement tags
 */
public int lengthUnknownElement() {
    int res = 0;
    NodeList nl = this.constructionElement.getChildNodes();

    for (int i = 0; i < nl.getLength(); i++) {
        Node current = nl.item(i);

        /**
         * $todo$ using this method, we don't see unknown Elements
         *  from Signature NS; revisit
         */
        if ((current.getNodeType() == Node.ELEMENT_NODE)
            && current.getNamespaceURI().equals(Constants.SignatureSpecNS)) {
            res++;
        }
    }

    return res;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:KeyInfo.java

示例3: getStrFromNode

import org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Method getStrFromNode
 *
 * @param xpathnode
 * @return the string for the node.
 */
public static String getStrFromNode(Node xpathnode) {
    if (xpathnode.getNodeType() == Node.TEXT_NODE) {
        // we iterate over all siblings of the context node because eventually,
        // the text is "polluted" with pi's or comments
        StringBuilder sb = new StringBuilder();

        for (Node currentSibling = xpathnode.getParentNode().getFirstChild();
            currentSibling != null;
            currentSibling = currentSibling.getNextSibling()) {
            if (currentSibling.getNodeType() == Node.TEXT_NODE) {
                sb.append(((Text) currentSibling).getData());
            }
        }

        return sb.toString();
    } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
        return ((Attr) xpathnode).getNodeValue();
    } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
        return ((ProcessingInstruction) xpathnode).getNodeValue();
    }

    return null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:30,代码来源:XMLUtils.java

示例4: getLastChildElementNS

import org.w3c.dom.Node; //导入方法依赖的package包/类
/** Finds and returns the last child node with the given qualified name. */
public static Element getLastChildElementNS(Node parent,
        String[][] elemNames) {

    // search for node
    Node child = parent.getLastChild();
    while (child != null) {
        if (child.getNodeType() == Node.ELEMENT_NODE) {
            for (int i = 0; i < elemNames.length; i++) {
                String uri = child.getNamespaceURI();
                if (uri != null && uri.equals(elemNames[i][0]) &&
                        child.getLocalName().equals(elemNames[i][1])) {
                    return (Element)child;
                }
            }
        }
        child = child.getPreviousSibling();
    }

    // not found
    return null;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:DOMUtil.java

示例5: next

import org.w3c.dom.Node; //导入方法依赖的package包/类
public int next() throws XMLStreamException {
    while(true) {
        int r = _next();
        switch (r) {
        case CHARACTERS:
            // if we are currently at text node, make sure that this is a meaningful text node.
            Node prev = _current.getPreviousSibling();
            if(prev!=null && prev.getNodeType()==Node.TEXT_NODE)
                continue;   // nope. this is just a continuation of previous text that should be invisible

            Text t = (Text)_current;
            wholeText = t.getWholeText();
            if(wholeText.length()==0)
                continue;   // nope. this is empty text.
            return CHARACTERS;
        case START_ELEMENT:
            splitAttributes();
            return START_ELEMENT;
        default:
            return r;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:DOMStreamReader.java

示例6: getLastChild

import org.w3c.dom.Node; //导入方法依赖的package包/类
/** Internal function.
 *  Return the last child Node, from the input node
 *  after applying filter, whatToshow.
 *  The current node is not consulted or set.
 */
Node getLastChild(Node node) {

    if (node == null) return null;

    if ( !fEntityReferenceExpansion
         && node.getNodeType() == Node.ENTITY_REFERENCE_NODE)
        return null;

    Node newNode = node.getLastChild();
    if (newNode == null)  return null;

    int accept = acceptNode(newNode);

    if (accept == NodeFilter.FILTER_ACCEPT)
        return newNode;
    else
    if (accept == NodeFilter.FILTER_SKIP
        && newNode.hasChildNodes())
    {
        Node lChild = getLastChild(newNode);
        if (lChild == null) {
            return getPreviousSibling(newNode, node);
        }
        return lChild;
    }
    else
    //if (accept == NodeFilter.REJECT_NODE)
    {
        return getPreviousSibling(newNode, node);
    }


}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:TreeWalkerImpl.java

示例7: getChild

import org.w3c.dom.Node; //导入方法依赖的package包/类
/** Get the first direct child with a given type
 */
public static Node getChild( Node parent, int type ) {
    Node n=parent.getFirstChild();
    while( n!=null && type != n.getNodeType() ) {
        n=n.getNextSibling();
    }
    if( n==null ) return null;
    return n;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:11,代码来源:DomUtil.java

示例8: getPrivateKeyFromStaticResolvers

import org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Searches the library wide KeyResolvers for Private keys
 *
 * @return the private key contained in this KeyInfo
 * @throws KeyResolverException
 */
PrivateKey getPrivateKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);

        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null)      {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                // not using StorageResolvers at the moment
                // since they cannot return private keys
                PrivateKey pk =
                    keyResolver.engineLookupAndResolvePrivateKey(
                        (Element) currentChild, uri, null
                    );

                if (pk != null) {
                    return pk;
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:KeyInfo.java

示例9: getValueForNode

import org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Retrieves the text value from a node's child text node.
 */
static String getValueForNode(Node node, String defaultValue)
{
	String value = null;
	if( node != null )
	{
		switch( node.getNodeType() )
		{
			case Node.ELEMENT_NODE: {
				Node textNode = node.getFirstChild();
				if( textNode != null )
				{
					value = textNode.getNodeValue();
				}
				break;
			}

			case Node.ATTRIBUTE_NODE: {
				value = node.getNodeValue();
				break;
			}

			default:
				break;
		}
	}

	if( value == null )
	{
		return defaultValue;
	}
	else
	{
		return value;
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:39,代码来源:DOMHelper.java

示例10: getVictimCoordinateZ

import org.w3c.dom.Node; //导入方法依赖的package包/类
private String getVictimCoordinateZ(Element info, String tagcoordinate, String tagdimension){
      String valuez = "";        
NodeList coordinateNmElmntLst = info.getElementsByTagName(tagcoordinate);
Node coordinateNode = coordinateNmElmntLst.item(0);
if (coordinateNode.getNodeType() == Node.ELEMENT_NODE){
 Element coorInfo = (Element) coordinateNode;			  			  
 //Obtain information about y coordinate for the current victim 
 NodeList zNmElmntLst = coorInfo.getElementsByTagName(tagdimension);
 Element zNmElmnt = (Element) zNmElmntLst.item(0);
 NodeList zNm = zNmElmnt.getChildNodes();					  
 valuez = ((Node)zNm.item(0)).getNodeValue();				  
}
return valuez;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:15,代码来源:ReadXMLTestSequence.java

示例11: getChild

import org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Get the first direct child with a given type
 */
public static Node getChild(Node parent, int type) {
	Node n = parent.getFirstChild();
	while (n != null && type != n.getNodeType()) {
		n = n.getNextSibling();
	}
	if (n == null)
		return null;
	return n;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:13,代码来源:DomUtil.java

示例12: _ProcessNode

import org.w3c.dom.Node; //导入方法依赖的package包/类
private static void _ProcessNode(Node n, int level) throws Exception {
    n.getAttributes();
    n.getChildNodes();

    // At this point, for JVM 1.6 and Xerces <= 1.3.1,
    // Test-XML.xml::mytest:Y's attribute is (already) bad.

    switch (n.getNodeType()) {

        case Node.TEXT_NODE:
            String str = n.getNodeValue().trim();

            /* ...Only print non-empty strings... */
            if (str.length() > 0) {
                String valStr = n.getNodeValue();

                _Println(valStr, level);
            }
            break;

        case Node.COMMENT_NODE:
            break;

        default: {
            String nodeNameStr = n.getNodeName();

            _Println(nodeNameStr + " (" + n.getClass() + "):", level);

            /* ...Print children... */
            _ProcessChildren(n, level);

            /* ...Print optional node attributes... */
            _PrintAttributes(n, level);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:Bug6760982.java

示例13: enabled

import org.w3c.dom.Node; //导入方法依赖的package包/类
public Enumeration enabled(GrammarEnvironment ctx) {
    Enumeration en = ctx.getDocumentChildren();
    while (en.hasMoreElements()) {
        Node next = (Node) en.nextElement();
        if (next.getNodeType() == next.DOCUMENT_TYPE_NODE) {
            return org.openide.util.Enumerations.singleton (next);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:DTDGrammarQueryProvider.java

示例14: configure

import org.w3c.dom.Node; //导入方法依赖的package包/类
/**
 * Performs custom configuration for this database object.
 */
public void configure(Element element) throws Exception {
    super.configure(element);
    
    String version = element.getAttribute("version");
    
    if (version == null) {
        String s = XMLUtils.prettyPrintDOM(element);
        EngineException ee = new EngineException("Unable to find version number for the database object \"" + getName() + "\".\nXML data: " + s);
        throw ee;
    }

    if (VersionUtils.compare(version, "1.2.2") <= 0) {
        NodeList properties = element.getElementsByTagName("property");

        Element propValue = (Element) XMLUtils.findNodeByAttributeValue(properties, "name", "removeFields");

        Node xmlNode = null;
        NodeList nl = propValue.getChildNodes();
        int len_nl = nl.getLength();
        Boolean bRemoveFields = null;
        for (int j = 0 ; j < len_nl ; j++) {
            xmlNode = nl.item(j);
            if (xmlNode.getNodeType() == Node.ELEMENT_NODE) {
                bRemoveFields = (Boolean) XMLUtils.readObjectFromXml((Element) xmlNode);
                continue;
            }
        }

        setSelectionType((bRemoveFields == null) ? "[^(field)]" : (bRemoveFields.booleanValue() ? "" : "[^(field)]"));

        hasChanged = true;
        Engine.logBeans.warn("[RemoveBlocks] The object \"" + getName() + "\" has been updated to version 1.2.3");
    }
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:38,代码来源:RemoveBlocks.java

示例15: getNext

import org.w3c.dom.Node; //导入方法依赖的package包/类
/** Get the next sibling with the same name and type
 */
public static Node getNext( Node current ) {
    String name=current.getNodeName();
    int type=current.getNodeType();
    return getNext( current, name, type);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:DomUtil.java


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