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


Java NodeList.item方法代码示例

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


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

示例1: mergeStandardTextNode

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private void mergeStandardTextNode(Node node)
    throws IIOInvalidTreeException {
    // Convert to comments.  For the moment ignore the encoding issue.
    // Ignore keywords, language, and encoding (for the moment).
    // If compression tag is present, use only entries with "none".
    NodeList children = node.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node child = children.item(i);
        NamedNodeMap attrs = child.getAttributes();
        Node comp = attrs.getNamedItem("compression");
        boolean copyIt = true;
        if (comp != null) {
            String compString = comp.getNodeValue();
            if (!compString.equals("none")) {
                copyIt = false;
            }
        }
        if (copyIt) {
            String value = attrs.getNamedItem("value").getNodeValue();
            COMMarkerSegment com = new COMMarkerSegment(value);
            insertCOMMarkerSegment(com);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:JPEGMetadata.java

示例2: extractFeatures

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public static ArrayList<Node> extractFeatures(Node n, Document D) {
    ArrayList<Node> attrs = new ArrayList<Node>();
    String type = n.getAttributes().getNamedItem("type").getNodeValue();
    NodeList features = n.getChildNodes();
    for (int i = 0; i < n.getChildNodes().getLength(); i++) {
        if (n.getChildNodes().item(i) instanceof Element) {
            features = n.getChildNodes().item(i).getChildNodes();
        }
    }
    for (int i = 0; i < features.getLength(); i++) {
        Node feature = features.item(i);
        if (feature instanceof Element) {
            String name = feature.getAttributes().getNamedItem("name")
                    .getNodeValue();
            String value = extractFeatureValue(feature);
            Node attr = D.createAttribute(type + ":" + name);
            attr.setNodeValue(value);
            attrs.add(attr);
        }
    }
    return attrs;
}
 
开发者ID:spetitjean,项目名称:TuLiPA-frames,代码行数:23,代码来源:ViewTreeBuilder.java

示例3: toString

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
/**
 * Return the string value of a Node
 *
 * @param n The Node.
 * @return The string value of the Node
 */
protected static String toString(Node n)
{
  if (n instanceof DTMNodeProxy)
       return ((DTMNodeProxy)n).getStringValue();
  else
  {
    String value = n.getNodeValue();
    if (value == null)
    {
      NodeList nodelist = n.getChildNodes();
      StringBuffer buf = new StringBuffer();
      for (int i = 0; i < nodelist.getLength(); i++)
      {
        Node childNode = nodelist.item(i);
        buf.append(toString(childNode));
      }
      return buf.toString();
    }
    else
      return value;
  }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ExsltBase.java

示例4: parsePlugin

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private void parsePlugin(Context context, Node node) {
    PluginConfiguration pluginConfiguration = new PluginConfiguration();

    context.addPluginConfiguration(pluginConfiguration);

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

    pluginConfiguration.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(pluginConfiguration, childNode);
        }
    }
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:24,代码来源:MyBatisGeneratorConfigurationParser.java

示例5: parseJavaModelGenerator

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

    context
            .setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);

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

    javaModelGeneratorConfiguration.setTargetPackage(targetPackage);
    javaModelGeneratorConfiguration.setTargetProject(targetProject);

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

示例6: KalturaSyndicationDistributionProfile

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public KalturaSyndicationDistributionProfile(Element node) throws KalturaApiException {
    super(node);
    NodeList childNodes = node.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node aNode = childNodes.item(i);
        String nodeName = aNode.getNodeName();
        String txt = aNode.getTextContent();
        if (nodeName.equals("xsl")) {
            this.xsl = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("feedId")) {
            this.feedId = ParseUtils.parseString(txt);
            continue;
        } 
    }
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:17,代码来源:KalturaSyndicationDistributionProfile.java

示例7: parseIbatorPlugin

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private void parseIbatorPlugin(Context context, Node node) {
    PluginConfiguration pluginConfiguration = new PluginConfiguration();

    context.addPluginConfiguration(pluginConfiguration);

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

    pluginConfiguration.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(pluginConfiguration, childNode);
        }
    }
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:24,代码来源:IbatorConfigurationParser.java

示例8: cellParsing

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
protected static void cellParsing(XPath xPath, Table table, Node tableHead, String rowType)
		throws XPathExpressionException, NumberFormatException, DOMException {
	if (tableHead != null) {
		NodeList trHeadNodes = (NodeList) xPath.compile("tr").evaluate(tableHead, XPathConstants.NODESET);
		for (int y = 0; y < trHeadNodes.getLength(); y++) {
			Row row = new Row();
			row.setType(rowType);
			table.getRow().add(row);
			NodeList cellNodes = (NodeList) xPath.compile("th|td").evaluate(trHeadNodes.item(y), XPathConstants.NODESET);
			for (int w = 0; w < cellNodes.getLength(); w++) {
				Cell cell = new Cell();
				row.getCell().add(cell);
				Node cellNode = cellNodes.item(w);
				if (cellNode != null && cellNode.getAttributes() != null) {
					if (cellNode.getAttributes().getNamedItem("colspan") != null) {
						cell.setColspan(Integer.parseInt(cellNode.getAttributes().getNamedItem("colspan").getNodeValue()));
					} else {
						cell.setColspan(1);
					}
					if (cellNode.getAttributes().getNamedItem("rowspan") != null) {
						cell.setRowspan(Integer.parseInt(cellNode.getAttributes().getNamedItem("rowspan").getNodeValue()));
					} else {
						cell.setRowspan(1);
					}
					ParContent parContent = new ParContent();
					parContent.setType("tableCell");
					cell.getParContent().add(parContent);
					Body.parsingParContent(cellNode, parContent);
				} 
				
			}
			
		}
	}
}
 
开发者ID:Vitaliy-1,项目名称:JATS2LaTeX,代码行数:36,代码来源:TableFunctions.java

示例9: KalturaAnnotationBaseFilter

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public KalturaAnnotationBaseFilter(Element node) throws KalturaApiException {
    super(node);
    NodeList childNodes = node.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node aNode = childNodes.item(i);
        String nodeName = aNode.getNodeName();
        String txt = aNode.getTextContent();
        if (nodeName.equals("parentIdEqual")) {
            this.parentIdEqual = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("parentIdIn")) {
            this.parentIdIn = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("textLike")) {
            this.textLike = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("textMultiLikeOr")) {
            this.textMultiLikeOr = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("textMultiLikeAnd")) {
            this.textMultiLikeAnd = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("endTimeGreaterThanOrEqual")) {
            this.endTimeGreaterThanOrEqual = ParseUtils.parseInt(txt);
            continue;
        } else if (nodeName.equals("endTimeLessThanOrEqual")) {
            this.endTimeLessThanOrEqual = ParseUtils.parseInt(txt);
            continue;
        } else if (nodeName.equals("durationGreaterThanOrEqual")) {
            this.durationGreaterThanOrEqual = ParseUtils.parseInt(txt);
            continue;
        } else if (nodeName.equals("durationLessThanOrEqual")) {
            this.durationLessThanOrEqual = ParseUtils.parseInt(txt);
            continue;
        } 
    }
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:38,代码来源:KalturaAnnotationBaseFilter.java

示例10: readElement

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public String readElement(Element element, String elementName) {
	NodeList childNodes = element.getElementsByTagName(elementName);
	if (childNodes != null && childNodes.getLength() > 0) {
		Element elementBendpoint = (Element) childNodes.item(0);
		return elementBendpoint.getTextContent();
	}
	return "";
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:9,代码来源:W3cParser.java

示例11: parsePriorityNode

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
/**
 * Parse a priority node
 * @param rule the rule being constructed
 * @param priorityNode must be a priority element
 */
private void parsePriorityNode(Rule rule, Node priorityNode) {
    StringBuffer buffer = new StringBuffer();
    NodeList nodeList = priorityNode.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node node = nodeList.item(i);
        if (node.getNodeType() == Node.TEXT_NODE) {
            buffer.append(node.getNodeValue());
        }
    }
    rule.setPriority(new Integer(buffer.toString().trim()).intValue());
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:17,代码来源:RuleSetFactory.java

示例12: KalturaFieldMatchCondition

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public KalturaFieldMatchCondition(Element node) throws KalturaApiException {
    super(node);
    NodeList childNodes = node.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node aNode = childNodes.item(i);
        String nodeName = aNode.getNodeName();
        if (nodeName.equals("field")) {
            this.field = ParseUtils.parseObject(KalturaStringField.class, aNode);
            continue;
        } 
    }
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:13,代码来源:KalturaFieldMatchCondition.java

示例13: parseGroup

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private Group parseGroup(final Element element) {
    final Group.Builder builder = new Group.Builder()
            .identifier(element.getAttribute(IDENTIFIER_ATTR))
            .name(element.getAttribute(NAME_ATTR));

    NodeList groupUsers = element.getElementsByTagName(GROUP_USER_ELEMENT);
    for (int i=0; i < groupUsers.getLength(); i++) {
        Element groupUserNode = (Element) groupUsers.item(i);
        builder.addUser(groupUserNode.getAttribute(IDENTIFIER_ATTR));
    }

    return builder.build();
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:14,代码来源:AbstractPolicyBasedAuthorizer.java

示例14: Synonym

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
protected Synonym(Element element) {
	logger.debug("Constructor - entry");

	NodeList nodeList = element.getChildNodes();
	for (int n = 0; n < nodeList.getLength(); n++) {
		Node node = nodeList.item(n);
		if (node.getNodeType() == Node.ELEMENT_NODE) {
			Element childElement = (Element) node;
		    if ("RELATION_METADATA".equals(childElement.getNodeName())) {
		    	setRelationMetadata(new RelationMetadata(childElement));
		    } else {
		    	logger.trace("Unrecognized child node: '" + childElement.getNodeName() + "'");
		    }
		} else if (node.getNodeType() == Node.TEXT_NODE) {
			this.setValue(node.getNodeValue());
		}
	}

	NamedNodeMap namedNodeMap = element.getAttributes();
	if (namedNodeMap != null) {
		for (int a = 0; a < namedNodeMap.getLength(); a++) {
			Attr attributeNode = (Attr) namedNodeMap.item(a);
			if ("ID".equals(attributeNode.getName())) {
				setId(attributeNode.getValue());
			} else {
				logger.trace("Unrecognized attribute: '" + attributeNode.getName() + "' (" + this.getClass().getName() + ")");
			}
		}
	}


	logger.debug("Constructor - exit");
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:34,代码来源:Synonym.java

示例15: getValue

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
@Override
public String getValue() {
    final NodeList childNodes = currentElement.getChildNodes();
    textBuffer.setLength(0);
    final int length = childNodes.getLength();
    for (int i = 0; i < length; i++) {
        final Node childNode = childNodes.item(i);
        if (childNode instanceof Text) {
            final Text text = (Text)childNode;
            textBuffer.append(text.getData());
        }
    }
    return textBuffer.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:DomReader.java


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