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


Java Element.getChildren方法代码示例

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


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

示例1: addJarsToClassLoader

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Recursively search the given element for JAR entries and add these jars to
 * the GateClassLoader
 * 
 * @param jdomElt
 *          JDOM element representing a creole.xml file
 */
@SuppressWarnings("unchecked")
private void addJarsToClassLoader(GateClassLoader gcl, Element jdomElt)
    throws MalformedURLException {
  if("JAR".equals(jdomElt.getName())) {
    URL url = new URL(plugin.getBaseURL(), jdomElt.getTextTrim());
    try {
      java.io.InputStream s = url.openStream();
      s.close();
      gcl.addURL(url);
    } catch(IOException e) {
      log.debug("Unable to add JAR "
          + url
          + " specified in creole file "
          + " to class loader, hopefully the required classes are already on the classpath.");
    }
  } else {
    for(Element child : (List<Element>)jdomElt.getChildren()) {
      addJarsToClassLoader(gcl, child);
    }
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:29,代码来源:CreoleAnnotationHandler.java

示例2: loadState

import org.jdom.Element; //导入方法依赖的package包/类
@Override
public void loadState(final Element state) {
    synchronized (lock) {
        queue.clear();

        for (Element element : state.getChildren(TAG_ENTITY)) {
            final String actionName = element.getAttributeValue(ATTR_ACTION);
            final String dateStr = element.getAttributeValue(ATTR_DATE);
            final String parameters = element.getAttributeValue(ATTR_NAME);

            if (actionName != null && dateStr != null) {
                try {
                    final ACTIONS action = ACTIONS.valueOf(actionName);
                    queue.add(new Entity(action, parameters, dateStr));
                } catch (IllegalArgumentException ignored) {
                }
            }
        }
        lock.notifyAll();
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:DefaultStatsCollector.java

示例3: parse

import org.jdom.Element; //导入方法依赖的package包/类
public Module parse(Element dcRoot) {
    boolean foundSomething = false;
    SampleModule fm = new SampleModuleImpl();

    Element e = dcRoot.getChild("bar", SAMPLE_NS);
    if (e != null) {
        foundSomething = true;
        fm.setBar(e.getText());
    }

    List eList = dcRoot.getChildren("foo", SAMPLE_NS);
    if (eList.size() > 0) {
        foundSomething = true;
        fm.setFoos(parseFoos(eList));
    }
    e = dcRoot.getChild("date", SAMPLE_NS);
    if (e != null) {
        foundSomething = true;
        fm.setDate(DateParser.parseDate(e.getText()));
    }
    return (foundSomething) ? fm : null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:SampleModuleParser.java

示例4: getChildMap

import org.jdom.Element; //导入方法依赖的package包/类
public static <K, V> Map<K, V> getChildMap(Element element, String name, boolean optional) throws StudyUnrecognizedFormatException {
  Element mapParent = getChildWithName(element, name, optional);
  if (mapParent != null) {
    Element map = mapParent.getChild(MAP);
    if (map != null) {
      HashMap result = new HashMap();
      for (Element entry : map.getChildren()) {
        Object key = entry.getAttribute(KEY) == null ? entry.getChild(KEY).getChildren().get(0) : entry.getAttributeValue(KEY);
        Object value = entry.getAttribute(VALUE) == null ? entry.getChild(VALUE).getChildren().get(0) : entry.getAttributeValue(VALUE);
        result.put(key, value);
      }
      return result;
    }
  }
  return Collections.emptyMap();
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:17,代码来源:StudySerializationUtils.java

示例5: parseChannel

import org.jdom.Element; //导入方法依赖的package包/类
protected WireFeed parseChannel(Element rssRoot)  {
    Channel channel = (Channel) super.parseChannel(rssRoot);
    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

    List eCats = eChannel.getChildren("category",getRSSNamespace());
    channel.setCategories(parseCategories(eCats));

    Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
    if (eTtl!=null) {
        Integer ttlValue = new Integer(eTtl.getText());
        if (ttlValue != null) {
            channel.setTtl(ttlValue.intValue());
        }
    }

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:RSS094Parser.java

示例6: addImagePlanning

import org.jdom.Element; //导入方法依赖的package包/类
public static void addImagePlanning(String dbname, File planningFile) throws Exception {
    // create xml reader
    SAXBuilder builder = new SAXBuilder();
    Document doc;
    doc = builder.build(planningFile);
    Element atts = doc.getRootElement();
    // check format first
    if (atts.getName().equalsIgnoreCase("imageplanning")) {
        // connect to database
        Connection conn = DriverManager.getConnection("jdbc:h2:~/.sumo/" + dbname + ";AUTO_SERVER=TRUE", "sa", "");
        Statement stat = conn.createStatement();
        String sql = "create table if not exists IMAGEPLAN (IMAGE VARCHAR(255), URL VARCHAR(1024), STARTDATE VARCHAR(255), ENDDATE VARCHAR(255), AREA VARCHAR(1024), ACTION VARCHAR(2048))";
        stat.execute(sql);
        // clear table before filling it in
        stat.execute("DELETE FROM IMAGEPLAN");
        // scan through images
        for (Object o : atts.getChildren("Image")) {
            Element element = (Element) o;
            // create sql statement
            sql = "INSERT INTO IMAGEPLAN VALUES('" + element.getChildText("name") + "', '" + element.getChildText("url") + "', '" + element.getChildText("startDate") + "', '" + element.getChildText("endDate") + "', '" + element.getChildText("area") + "', '" + element.getChildText("action") + "');";
            stat.execute(sql);
        }
        stat.close();
        conn.close();
    } else {
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                JOptionPane.showMessageDialog(null, "Format not supported", "Error", JOptionPane.ERROR_MESSAGE);
            }
        });
    }

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:H2Fetcher.java

示例7: doesNamespaceHavePermissions

import org.jdom.Element; //导入方法依赖的package包/类
private boolean doesNamespaceHavePermissions(Element procElement, String namespace) {
    if (namespace == null || namespace.length() == 0) {
        return false;
    }

    List<Element> nspaces = (List<Element>) procElement.getChildren("namespace");
    for (Element nsElem : nspaces) {
        if (namespace.equalsIgnoreCase(nsElem.getAttributeValue("name"))) {
            return true; // the namespace is in the list, so it has at least one permission
        }
    }
    return false;
}
 
开发者ID:Hitachi-Data-Systems,项目名称:Open-DM,代码行数:14,代码来源:Hcp3AuthNamespaceAdapter.java

示例8: isVersioningEnabled

import org.jdom.Element; //导入方法依赖的package包/类
private boolean isVersioningEnabled(Element procElement, String namespace) {
    if (namespace == null || namespace.length() == 0) {
        return false;
    }

    List<Element> nspaces = (List<Element>) procElement.getChildren("namespace");
    for (Element nsElem : nspaces) {
        if (namespace.equalsIgnoreCase(nsElem.getAttributeValue("name"))) {
            return Boolean.valueOf(nsElem.getAttributeValue("versioningEnabled"));
        }
    }
    return false;
}
 
开发者ID:Hitachi-Data-Systems,项目名称:Open-DM,代码行数:14,代码来源:Hcp3AuthNamespaceAdapter.java

示例9: findResourceElements

import org.jdom.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void findResourceElements(Map<String, Element> map, Element elt) {
  if(elt.getName().equals("RESOURCE")) {
    String className = elt.getChildTextTrim("CLASS");
    if(className != null) {
      map.put(className, elt);
    }
  } else {
    for(Element child : (List<Element>)elt.getChildren()) {
      findResourceElements(map, child);
    }
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:14,代码来源:CreoleAnnotationHandler.java

示例10: processAnnotations

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Process annotations for the given element. If the element is a RESOURCE it
 * is processed, otherwise the method calls itself recursively for all the
 * children of the given element.
 * 
 * @param element
 *          the element to process.
 */
@SuppressWarnings("unchecked")
private void processAnnotations(Element element) throws GateException {
  if("RESOURCE".equals(element.getName())) {
    processAnnotationsForResource(element);
  } else {
    for(Element child : (List<Element>)element.getChildren()) {
      processAnnotations(child);
    }
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:19,代码来源:CreoleAnnotationHandler.java

示例11: readFrom

import org.jdom.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void readFrom(Element rootElement)
   /* Is passed an Element by TC, and is expected to load it into the in memory settings object.
    * Old settings should be overwritten.
    */
   {
   	Loggers.SERVER.debug("readFrom :: " + rootElement.toString());
   	CopyOnWriteArrayList<MsTeamsNotificationConfig> configs = new CopyOnWriteArrayList<MsTeamsNotificationConfig>();
   	
   	if (rootElement.getAttribute(ENABLED) != null){
   		this.msTeamsNotificationsEnabled = Boolean.parseBoolean(rootElement.getAttributeValue(ENABLED));
   	}
   	
	List<Element> namedChildren = rootElement.getChildren("msteamsNotification");
       if(namedChildren.isEmpty())
       {
           this.msteamsNotificationsConfigs = null;
       } else {
		for(Element e :  namedChildren)
        {
			MsTeamsNotificationConfig whConfig = new MsTeamsNotificationConfig(e);
			Loggers.SERVER.debug(e.toString());
			configs.add(whConfig);
			Loggers.SERVER.debug(NAME + ":readFrom :: enabled " + String.valueOf(whConfig.getEnabled()));
        }
		this.msteamsNotificationsConfigs = configs;
   	}
   }
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:30,代码来源:MsTeamsNotificationProjectSettings.java

示例12: readColors

import org.jdom.Element; //导入方法依赖的package包/类
private void readColors(Element element) {
    if (namedTextAttrs == null) {
        namedTextAttrs = new ArrayList<>();
    }

    final Element colorListTag = element.getChild(COLOR_LIST_TAG);
    if (colorListTag != null) {
        for (Element colorTag : colorListTag.getChildren(COLOR_TAG)) {
            namedTextAttrs.add(new NamedTextAttr(colorTag));
        }
    }
}
 
开发者ID:huoguangjin,项目名称:MultiHighlight,代码行数:13,代码来源:MultiHighlightConfig.java

示例13: test_ReadXml

import org.jdom.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void test_ReadXml() throws JDOMException, IOException {
	SAXBuilder builder = new SAXBuilder();
	//builder.setValidation(true);
	builder.setIgnoringElementContentWhitespace(true);
	
		Document doc = builder.build("src/test/resources/testdoc1.xml");
		Element root = doc.getRootElement();
		System.out.println(root.toString());
		if(root.getChild("msteamsNotifications") != null){
			Element child = root.getChild("msteamsNotifications");
			if ((child.getAttribute("enabled") != null) && (child.getAttribute("enabled").equals("true"))){
				List<Element> namedChildren = child.getChildren("msteamsNotification");
				for(Iterator<Element> i = namedChildren.iterator(); i.hasNext();)
	            {
					Element e = i.next();
					System.out.println(e.toString() + e.getAttributeValue("url"));
					//assertTrue(e.getAttributeValue("url").equals("http://something"));
					if(e.getChild("parameters") != null){
						Element eParams = e.getChild("parameters");
						List<Element> paramsList = eParams.getChildren("param");
						for(Iterator<Element> j = paramsList.iterator(); j.hasNext();)
						{
							Element eParam = j.next();
							System.out.println(eParam.toString() + eParam.getAttributeValue("name"));
							System.out.println(eParam.toString() + eParam.getAttributeValue("value"));
						}
					}
	            }
			}
		}

}
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:35,代码来源:MsTeamsNotificationSettingsTest.java

示例14: checkChannelConstraints

import org.jdom.Element; //导入方法依赖的package包/类
protected void checkChannelConstraints(Element eChannel) throws FeedException {
    checkNotNullAndLength(eChannel,"title", 1, 100);
    checkNotNullAndLength(eChannel,"description", 1, 500);
    checkNotNullAndLength(eChannel,"link", 1, 500);
    checkNotNullAndLength(eChannel,"language", 2, 5);

    checkLength(eChannel,"rating", 20, 500);
    checkLength(eChannel,"copyright", 1, 100);
    checkLength(eChannel,"pubDate", 1, 100);
    checkLength(eChannel,"lastBuildDate", 1, 100);
    checkLength(eChannel,"docs", 1, 500);
    checkLength(eChannel,"managingEditor", 1, 100);
    checkLength(eChannel,"webMaster", 1, 100);

    Element skipHours = eChannel.getChild("skipHours");
    if (skipHours!=null) {
        List hours = skipHours.getChildren();
        for (int i=0;i<hours.size();i++) {
            Element hour = (Element) hours.get(i);
            int value = Integer.parseInt(hour.getText());
            if (isHourFormat24()) {
                if (value<1 || value>24) {
                    throw new FeedException("Invalid hour value "+value+", it must be between 1 and 24");
                }
            }
            else {
                if (value<0 || value>23) {
                    throw new FeedException("Invalid hour value "+value+", it must be between 0 and 23");
                }
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:RSS091UserlandGenerator.java

示例15: getChildList

import org.jdom.Element; //导入方法依赖的package包/类
public static List<Element> getChildList(Element parent, String name, boolean optional) throws StudyUnrecognizedFormatException {
  Element listParent = getChildWithName(parent, name, optional);
  if (listParent != null) {
    Element list = listParent.getChild(LIST);
    if (list != null) {
      return list.getChildren();
    }
  }
  return Collections.emptyList();
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:StudySerializationUtils.java


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