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


Java Node.ELEMENT_NODE属性代码示例

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


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

示例1: makeIdMap

/**
 * Method removed when ref removed from configuration, only used for menu... separator, languages
 */
@Deprecated
public static void makeIdMap(Node pElement, Map<String, CwfDataIf> pIdMap) {
    if (pElement.getNodeType() == Node.ELEMENT_NODE) {
        String tTagName = ((Element) pElement).getTagName();
        String tId = ((Element) pElement).getAttribute("id");
        if (!tId.isEmpty() && tTagName.equals(TAG_MENUITEM)) {
            CwfDataIf tData = CwfDataFactory.create();
            tData.setProperty(ATTR_TAG_NAME, TAG_MENUITEM);
            for (int i = 0; i < pElement.getAttributes().getLength(); i++) {
                Attr tAttr = (Attr) pElement.getAttributes().item(i);
                tData.setProperty(tAttr.getName(), tAttr.getValue());
            }
            pIdMap.put(tId, tData);

        }
        NodeList tNodes = pElement.getChildNodes();
        for (int i = 0; i < tNodes.getLength(); i++) {
            makeIdMap(tNodes.item(i), pIdMap);
        }
    }
}
 
开发者ID:cinnober,项目名称:ciguan,代码行数:24,代码来源:AsUtil.java

示例2: parseIgnoreColumnByRegex

private void parseIgnoreColumnByRegex(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String pattern = attributes.getProperty("pattern"); //$NON-NLS-1$

    IgnoredColumnPattern icPattern = new IgnoredColumnPattern(pattern);

    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 ("except".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseException(icPattern, childNode);
        }
    }

    tc.addIgnoredColumnPattern(icPattern);
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:21,代码来源:MyBatisGeneratorConfigurationParser.java

示例3: dispatchingEventToSubtree

/**
 * Dispatches event to the target node's descendents recursively
 *
 * @param n node to dispatch to
 * @param e event to be sent to that node and its subtree
 */
protected void dispatchingEventToSubtree(Node n, Event e) {
    if (n==null)
            return;

    // ***** Recursive implementation. This is excessively expensive,
    // and should be replaced in conjunction with optimization
    // mentioned above.
    ((NodeImpl) n).dispatchEvent(e);
    if (n.getNodeType() == Node.ELEMENT_NODE) {
        NamedNodeMap a = n.getAttributes();
        for (int i = a.getLength() - 1; i >= 0; --i)
            dispatchingEventToSubtree(a.item(i), e);
    }
    dispatchingEventToSubtree(n.getFirstChild(), e);
    dispatchingEventToSubtree(n.getNextSibling(), e);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:DocumentImpl.java

示例4: parseCartList

private void parseCartList(String xml){
	cartList = new ArrayList<String>();
	//get the factory
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	try {
		DocumentBuilder db = dbf.newDocumentBuilder();
		domCL = db.parse(new InputSource(new StringReader(xml)));
		domCL.getDocumentElement().normalize();
		
		NodeList nList = domCL.getElementsByTagName("item");
	    for (int temp = 0; temp < nList.getLength(); temp++) {
	        Node nNode = nList.item(temp);
	        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
	        	Element eElement = (Element) nNode; 
	        	//put cart items in list
	        	String accum = ""+eElement.getElementsByTagName("type").item(0).getTextContent() + " / " +
	        			eElement.getElementsByTagName("make").item(0).getTextContent() + " / " +
	        			eElement.getElementsByTagName("model").item(0).getTextContent()+ " / " +
	        			eElement.getElementsByTagName("price").item(0).getTextContent(); 
	        	cartList.add(accum);
	         }
	    }
	    //catch total price and item returned from server
	    totalPrice=domCL.getElementsByTagName("totalcost").item(0).getTextContent();
	    totalItem=domCL.getElementsByTagName("totalitem").item(0).getTextContent();
	    
	}catch(ParserConfigurationException pce) {			pce.printStackTrace();
	}catch(SAXException se) {							se.printStackTrace();
	}catch(IOException ioe) {							ioe.printStackTrace();
	}catch (Exception e){								e.printStackTrace();
	}
}
 
开发者ID:anirban99,项目名称:Shopping-Cart-using-Web-Services,代码行数:32,代码来源:MyClientRest.java

示例5: parseIbatorConfiguration

public Configuration parseIbatorConfiguration(Element rootNode)
        throws XMLParserException {

    Configuration configuration = new Configuration();

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

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

        if ("properties".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperties(configuration, childNode);
        } else if ("classPathEntry".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseClassPathEntry(configuration, childNode);
        } else if ("ibatorContext".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseIbatorContext(configuration, childNode);
        }
    }

    return configuration;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:24,代码来源:IbatorConfigurationParser.java

示例6: parsePropertyNode

/**
 * Parse a property node
 * @param rule the rule being constructed
 * @param propertyNode must be a property element node
 */
private void parsePropertyNode(Rule rule, Node propertyNode) {
    Element propertyElement = (Element) propertyNode;
    String name = propertyElement.getAttribute("name");
    String value = propertyElement.getAttribute("value");
    if (value.trim().length() == 0) {
        NodeList nodeList = propertyNode.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node node = nodeList.item(i);
            if ((node.getNodeType() == Node.ELEMENT_NODE) && (node.getNodeName().equals("value"))) {
                value = parseValueNode(node);
            }
        }
    }
    if (propertyElement.hasAttribute("pluginname")) {
        rule.addProperty("pluginname", propertyElement.getAttributeNode("pluginname").getNodeValue());
    }
    rule.addProperty(name, value);
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:23,代码来源:RuleSetFactory.java

示例7: findNode

/**
 * Find the named subnode in a node's sublist.
 * <ul>
 * <li>Ignores comments and processing instructions.
 * <li>Ignores TEXT nodes (likely to exist and contain ignorable whitespace, if not validating.
 * <li>Ignores CDATA nodes and EntityRef nodes.
 * <li>Examines element nodes to find one with the specified name.
 * </ul>
 * 
 * @param name the tag name for the element to find
 * @param node the element node to start searching from
 * @return the Node found
 */
public static Node findNode(String name, Node node) {
  // get all child nodes
  NodeList list = node.getChildNodes();

  for (int i = 0; i < list.getLength(); i++) {
    // get child node
    Node childNode = list.item(i);

    if (childNode.getNodeType() == Node.ELEMENT_NODE) {
      Element element = (Element) childNode;
      if (element.hasAttributes()) {
        if (element.hasAttribute("id") && element.getAttribute("id") != null
            && !element.getAttribute("id").isEmpty() && element.getAttribute("id").equals(name)) {
          return element;
        } else if (element.hasAttribute("name") && element.getAttribute("name") != null
            && !element.getAttribute("name").isEmpty()
            && element.getAttribute("name").equals(name)) {
          return element;
        }
      }
    }
    // visit child node
    Node temp = findNode(name, childNode);
    if (temp != null)
      return temp;
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:41,代码来源:XMLDOMHelper.java

示例8: parseJavaClientGenerator

private void parseJavaClientGenerator(Context context, Node node) {
    JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = new JavaClientGeneratorConfiguration();

    context.setJavaClientGeneratorConfiguration(javaClientGeneratorConfiguration);

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

    javaClientGeneratorConfiguration.setConfigurationType(type);
    javaClientGeneratorConfiguration.setTargetPackage(targetPackage);
    javaClientGeneratorConfiguration.setTargetProject(targetProject);
    javaClientGeneratorConfiguration
            .setImplementationPackage(implementationPackage);

    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(javaClientGeneratorConfiguration, childNode);
        }
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:31,代码来源:MyBatisGeneratorConfigurationParser.java

示例9: getElements

private static List<Node> getElements(Node node, String elementName) {
	List<Node> list = new LinkedList<Node>();
	NodeList nodeList = node.getChildNodes();
	for (int i = 0; i < nodeList.getLength(); i++)
		if (nodeList.item(i).getNodeName().equals(elementName)
				&& nodeList.item(i).getNodeType() == Node.ELEMENT_NODE)
			list.add(nodeList.item(i));
	return list;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:XML_Menu.java

示例10: getPublicKeyFromInternalResolvers

/**
 * Searches the per-KeyInfo KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromInternalResolvers() throws KeyResolverException {
    for (KeyResolverSpi keyResolver : internalKeyResolvers) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
        }
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null)      {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:KeyInfo.java

示例11: checkManagerPassword

/**
 * 检测tomcat后台管理员角色密码是否安全
 */
private void checkManagerPassword(String tomcatBaseDir, List<EventInfo> infos) {
    File userFile = new File(tomcatBaseDir + File.separator + "conf/tomcat-users.xml");
    if (!(userFile.exists() && userFile.canRead())) {
        LOGGER.warn(getJsonFormattedMessage(TOMCAT_CHECK_ERROR_LOG_CHANNEL,
                "can not load file conf/tomcat-users.xml"));
        return;
    }

    Element userElement = getXmlFileRootElement(userFile);
    if (userElement != null) {
        NodeList userNodeList = userElement.getElementsByTagName("user");
        if (userNodeList != null) {
            for (int i = 0; i < userNodeList.getLength(); i++) {
                Node userNode = userNodeList.item(i);
                if (userNode.getNodeType() == Node.ELEMENT_NODE) {
                    Element user = (Element) userNode;
                    String rolesAttribute = user.getAttribute("roles");
                    String[] roles = rolesAttribute == null ? null : rolesAttribute.split(",");
                    if (roles != null && roles.length > 0) {
                        List<String> managerList = Arrays.asList(TOMCAT_MANAGER_ROLES);
                        for (int j = 0; j < roles.length; j++) {
                            if (managerList.contains(roles[j].trim())) {
                                List<String> weakWords = Arrays.asList(WEAK_WORDS);
                                String userName = user.getAttribute("username");
                                String password = user.getAttribute("password");
                                if (weakWords.contains(userName) && weakWords.contains(password)) {
                                    infos.add(new SecurityPolicyInfo(Type.MANAGER_PASSWORD, "tomcat后台管理角色存在弱用户名和弱密码.", true));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:39,代码来源:TomcatSecurityChecker.java

示例12: parseJdbcConnection

protected void parseJdbcConnection(Context context, Node node) {
    JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();

    context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);

    Properties attributes = parseAttributes(node);
    String driverClass = attributes.getProperty("driverClass"); //$NON-NLS-1$
    String connectionURL = attributes.getProperty("connectionURL"); //$NON-NLS-1$
    String userId = attributes.getProperty("userId"); //$NON-NLS-1$
    String password = attributes.getProperty("password"); //$NON-NLS-1$

    jdbcConnectionConfiguration.setDriverClass(driverClass);
    jdbcConnectionConfiguration.setConnectionURL(connectionURL);

    if (stringHasValue(userId)) {
        jdbcConnectionConfiguration.setUserId(userId);
    }

    if (stringHasValue(password)) {
        jdbcConnectionConfiguration.setPassword(password);
    }

    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(jdbcConnectionConfiguration, childNode);
        }
    }
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:35,代码来源:MyBatisGeneratorConfigurationParser.java

示例13: getRobotCoordinateZ

private String getRobotCoordinateZ(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 z coordinate for the current robot 
 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,代码行数:14,代码来源:ReadXMLTestRobots.java

示例14: next

@Override
public Document next() {
    Node reviewNode = reviewList.item(reviewPosition);
    if (reviewNode.getNodeType() == Node.ELEMENT_NODE) {
        Element elem = (Element) reviewNode;
        return buildDocument(elem);

    } else {
        return null;
    }
}
 
开发者ID:uhh-lt,项目名称:GermEval2017-Baseline,代码行数:11,代码来源:XMLReader.java

示例15: lookupNode

@SuppressWarnings("null")
private Node lookupNode(final Node parent, String nodeName, final int index, final boolean create)
{
	Node foundNode = null;

	int nNumFound = 0;
	final Document doc = parent.getOwnerDocument();

	final boolean isAttribute = nodeName.startsWith(ATTR);
	nodeName = DOMHelper.stripAttribute(nodeName);
	if( isAttribute )
	{
		foundNode = ((Element) parent).getAttributeNode(nodeName);
	}
	else
	{
		nodeName = DOMHelper.stripNamespace(nodeName);
		final boolean matchAny = nodeName.equals(WILD);

		final NodeList children = parent.getChildNodes();
		for( int i = 0; i < children.getLength() && foundNode == null; i++ )
		{
			final Node child = children.item(i);
			if( child.getNodeType() == Node.ELEMENT_NODE )
			{
				final String childName = DOMHelper.stripNamespace(child.getNodeName());
				if( matchAny || nodeName.equals(childName) )
				{
					if( nNumFound != index )
					{
						nNumFound++;
					}
					else
					{
						foundNode = child;
						break;
					}
				}
			}
		}
	}

	if( foundNode == null && create == true )
	{
		// If the Index is 0 and we didn't find a node or if the number
		// found (which is not zero based) equals the index (which is)
		// then this is the same as saying index is one more that the
		// number of nodes that exist then add a new child node.
		if( index == 0 || nNumFound == index )
		{
			if( isAttribute )
			{
				((Element) parent).setAttribute(nodeName, BLANK);
				foundNode = ((Element) parent).getAttributeNode(nodeName);
			}
			else
			{
				foundNode = doc.createElement(nodeName);
				parent.appendChild(foundNode);
			}
		}
		else
		{
			// An illegal index has been used - throw an error
			String szError = new String("Error creating node ");
			szError += nodeName;
			szError += " with an index of ";
			szError += index;
			throw new RuntimeException(szError);
		}
	}
	return foundNode;
}
 
开发者ID:equella,项目名称:Equella,代码行数:73,代码来源:PropBagEx.java


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