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


Java NodeList.getLength方法代码示例

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


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

示例1: 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:bandaotixi,项目名称:generator_mybatis,代码行数:24,代码来源:IbatorConfigurationParser.java

示例2: KalturaPlayerDeliveryType

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public KalturaPlayerDeliveryType(Element node) throws KalturaApiException {
    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("id")) {
            this.id = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("label")) {
            this.label = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("flashvars")) {
            this.flashvars = ParseUtils.parseArray(KalturaKeyValue.class, aNode);
            continue;
        } else if (nodeName.equals("minVersion")) {
            this.minVersion = ParseUtils.parseString(txt);
            continue;
        } 
    }
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:22,代码来源:KalturaPlayerDeliveryType.java

示例3: parseDynamicTags

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private List<TangYuanNode> parseDynamicTags(XmlNodeWrapper node) {
	List<TangYuanNode> contents = new ArrayList<TangYuanNode>();
	NodeList children = node.getNode().getChildNodes();
	for (int i = 0; i < children.getLength(); i++) {
		XmlNodeWrapper child = node.newXMlNode(children.item(i));
		if (child.getNode().getNodeType() == Node.CDATA_SECTION_NODE || child.getNode().getNodeType() == Node.TEXT_NODE) {
			String data = child.getStringBody("");
			if (isEmpty(data)) {
				continue;
			}
			// 使用新的sqlText节点
			contents.add(new MongoTextNode(data));
			// log.info("-----------data:" + data);
		} else if (child.getNode().getNodeType() == Node.ELEMENT_NODE) {
			String nodeName = child.getNode().getNodeName();
			// log.info("-----------name:" + nodeName);
			NodeHandler handler = nodeHandlers.get(nodeName);
			if (handler == null) {
				throw new XmlParseException("Unknown element <" + nodeName + "> in SQL statement.");
			}
			handler.handleNode(child, contents);
		}
	}
	return contents;
}
 
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:26,代码来源:XMLMongoNodeBuilder.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:DomKing,项目名称:springbootWeb,代码行数:24,代码来源:MyBatisGeneratorConfigurationParser.java

示例5: KalturaSearchCondition

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public KalturaSearchCondition(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("field")) {
            this.field = ParseUtils.parseString(txt);
            continue;
        } else if (nodeName.equals("value")) {
            this.value = ParseUtils.parseString(txt);
            continue;
        } 
    }
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:17,代码来源:KalturaSearchCondition.java

示例6: addNodesInDocOrder

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
/**
 * Copy NodeList members into this nodelist, adding in
 * document order.  If a node is null, don't add it.
 *
 * @param nodelist List of nodes to be added
 * @param support The XPath runtime context.
 * @throws RuntimeException thrown if this NodeSet is not of
 * a mutable type.
 */
public void addNodesInDocOrder(NodeList nodelist, XPathContext support)
{

  if (!m_mutable)
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");

  int nChildren = nodelist.getLength();

  for (int i = 0; i < nChildren; i++)
  {
    Node node = nodelist.item(i);

    if (null != node)
    {
      addNodeInDocOrder(node, support);
    }
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:NodeSet.java

示例7: readNavPoint

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private static  int readNavPoint(Node nav, XPath tocPath, Map<String,Object> bookdat, int total) throws XPathExpressionException {

        NodeList list = (NodeList)tocPath.evaluate("navPoint", nav, XPathConstants.NODESET);
        for (int i = 0; i < list.getLength(); i++) {
            Node node = list.item(i);
            String label = tocPath.evaluate("navLabel/text/text()", node);
            String content = tocPath.evaluate("content/@src", node);
            bookdat.put(TOC_LABEL +total, label);
            bookdat.put(TOC_CONTENT +total, content);
            //Log.d("EPB", "toc: " + label + " " + content + " " + total);
            total++;
            total = readNavPoint(node, tocPath, bookdat, total);
        }
        return total;
    }
 
开发者ID:quaap,项目名称:BookyMcBookface,代码行数:16,代码来源:EpubBook.java

示例8: parseArray

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> ArrayList<T> parseArray(Class<T> clz, Node aNode) throws KalturaApiException{
	ArrayList<T> tmpList = new ArrayList<T>();
	NodeList subNodeList = aNode.getChildNodes();
	for (int j = 0; j < subNodeList.getLength(); j++) {
		Node arrayNode = subNodeList.item(j);
		tmpList.add((T) KalturaObjectFactory.create((Element) arrayNode, clz));
	}
	return tmpList;
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:11,代码来源:ParseUtils.java

示例9: KalturaAccessControlAction

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public KalturaAccessControlAction(Element node) throws KalturaApiException {
    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("type")) {
            this.type = KalturaAccessControlActionType.get(ParseUtils.parseString(txt));
            continue;
        } 
    }
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:13,代码来源:KalturaAccessControlAction.java

示例10: serializeToByteArray

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
/**
 * Returns a <code>byte[]</code> representation of the specified
 * <code>NodeList</code>.
 *
 * @param content the <code>NodeList</code> to serialize.
 * @return the <code>byte[]</code> representation of the serialized
 *   <code>NodeList</code>.
 * @throws Exception
 */
public byte[] serializeToByteArray(NodeList content) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    canon.setWriter(baos);
    canon.notReset();
    for (int i = 0; i < content.getLength(); i++) {
        canon.canonicalizeSubtree(content.item(i));
    }
    return baos.toByteArray();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:AbstractSerializer.java

示例11: collectStringListElements

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private List<String> collectStringListElements(
        final Element unit,
        final XPath xpath,
        final String elementName
) throws XPathExpressionException {
    final NodeList nodes = (NodeList) xpath.evaluate(elementName, unit, NODESET);
    final List<String> strings = new ArrayList<>();
    for (int i = 0; i < nodes.getLength(); i++) {
        strings.add(nodes.item(i).getTextContent());
    }
    return strings;
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:13,代码来源:PersistenceUnitDiscovery.java

示例12: handleChildren

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
private static void handleChildren(NodeList nodes, StringBuilder layoutXml) {
    if (nodes == null)
        return;
    int len = nodes.getLength();
    for (int i = 0; i < len; i++) {
        Node node = nodes.item(i);
        if (node.getNodeType() != Node.ELEMENT_NODE)
            continue;
        handleNode(node, "", layoutXml);
    }
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:12,代码来源:XmlConverter.java

示例13: deserializeId

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
/**
 * Deserializes the id element of the SOAP header to a String.
 *
 * @param header SOAP header to be deserialized
 * @return id represented as a String
 */
protected final String deserializeId(final SOAPHeader header) {
    LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_ID);
    String id = null;
    NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_ID);
    if (list.getLength() == 1) {
        id = list.item(0).getTextContent();
        LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_ID);
    }
    return id;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:17,代码来源:AbstractHeaderDeserializer.java

示例14: getLemmas

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
public Map<String, List<Lemma>> getLemmas() {

        Map<String, List<Lemma>> lemmas = new HashMap<String, List<Lemma>>();
        Element root = lemmaDoc.getDocumentElement();
        NodeList l = root.getElementsByTagName("lemmas");
        Element e = (Element) l.item(0);

        NodeList ll = e.getChildNodes();

        for (int i = 0; i < ll.getLength(); i++) {
            Node n = ll.item(i);
            // according to the DTD, the XML chidlren
            // of tag is lemma
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                Element el = (Element) n;
                if (el.getTagName().equals("lemma")) {
                    String name = el.getAttribute("name");
                    String cat = el.getAttribute("cat");
                    Lemma lemma = new Lemma(name, cat);
                    lemma.setAnchors(getAnchors(el));

                    List<Lemma> llemma = lemmas.get(lemma.getName());
                    if (llemma == null) {
                        llemma = new LinkedList<Lemma>();
                    }
                    llemma.add(lemma);
                    lemmas.put(lemma.getName(), llemma);
                }
            }
        }
        return lemmas;
    }
 
开发者ID:spetitjean,项目名称:TuLiPA-frames,代码行数:33,代码来源:XMLLemmaReader.java

示例15: testTaskIdXML

import org.w3c.dom.NodeList; //导入方法依赖的package包/类
@Test
public void testTaskIdXML() throws JSONException, Exception {
  WebResource r = resource();
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);
    for (Task task : jobsMap.get(id).getTasks().values()) {

      String tid = MRApps.toString(task.getID());
      ClientResponse response = r.path("ws").path("v1").path("history")
          .path("mapreduce").path("jobs").path(jobId).path("tasks").path(tid)
          .accept(MediaType.APPLICATION_XML).get(ClientResponse.class);

      assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
      String xml = response.getEntity(String.class);
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      InputSource is = new InputSource();
      is.setCharacterStream(new StringReader(xml));
      Document dom = db.parse(is);
      NodeList nodes = dom.getElementsByTagName("task");
      for (int i = 0; i < nodes.getLength(); i++) {
        Element element = (Element) nodes.item(i);
        verifyHsSingleTaskXML(element, task);
      }
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestHsWebServicesTasks.java


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