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


Java Element.getChild方法代码示例

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


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

示例1: getITunesAttribute

import org.jdom.Element; //导入方法依赖的package包/类
private String getITunesAttribute(Element element, String childName, String attributeName) {
    for (Namespace ns : ITUNES_NAMESPACES) {
        Element elem = element.getChild(childName, ns);
        if (elem != null) {
            return StringUtils.trimToNull(elem.getAttributeValue(attributeName));
        }
    }
    return null;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:10,代码来源:PodcastService.java

示例2: parseImage

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Parses the root element of an RSS document looking for  image information.
 * <p/>
 * It first invokes super.parseImage and then parses and injects the following
 * properties if present: url, link, width, height and description.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document to parse for image information.
 * @return the parsed RSSImage bean.
 */
protected Image parseImage(Element rssRoot) {
    Image image = super.parseImage(rssRoot);
    if (image!=null) {
        Element eImage = getImage(rssRoot);
        Element e = eImage.getChild("width",getRSSNamespace());
        if (e!=null) {
            image.setWidth(Integer.parseInt(e.getText()));
        }
        e = eImage.getChild("height",getRSSNamespace());
        if (e!=null) {
            image.setHeight(Integer.parseInt(e.getText()));
        }
        e = eImage.getChild("description",getRSSNamespace());
        if (e!=null) {
            image.setDescription(e.getText());
        }
    }
    return image;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:RSS091UserlandParser.java

示例3: doGet

import org.jdom.Element; //导入方法依赖的package包/类
@SuppressWarnings("nls")
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
	resp.setContentType("application/x-java-jnlp-file");
	resp.setHeader("Cache-Control", "private, max-age=5, must-revalidate");
	Document locJnlpDocument = (Document) this.jnlpDocument.clone();
	Element jnlpElem = locJnlpDocument.getRootElement();
	String instUrl = institutionService.getInstitutionUrl().toString();
	jnlpElem.setAttribute("codebase", instUrl);
	Element resources = jnlpElem.getChild("resources");

	String token = userService.getGeneratedToken(Constants.APPLET_SECRET_ID, CurrentUser.getUsername());

	String tokenEncoded = Base64.encodeBase64String(token.getBytes("UTF-8")).replace("\r", "").replace("\n", "");
	resources.addContent(createJar(resourcesService.getUrl("com.tle.web.adminconsole", "adminconsole.jar")));
	resources.addContent(createProperty(Bootstrap.TOKEN_PARAMETER, tokenEncoded));
	resources.addContent(createProperty(Bootstrap.ENDPOINT_PARAMETER, instUrl));
	resources.addContent(createProperty(Bootstrap.LOCALE_PARAMETER, CurrentLocale.getLocale().toString()));
	resources.addContent(createProperty(Bootstrap.INSTITUTION_NAME_PARAMETER, CurrentInstitution.get().getName()));
	xmlOut.output(locJnlpDocument, resp.getWriter());
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:TleJnlpDownloadServlet.java

示例4: readFrom

import org.jdom.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void readFrom(Element rootElement)
/* Is passed an Element by TC, and is expected to persist it to the settings object.
 * Old settings should be overwritten.
 */
{
    if(msteamsNotificationMainConfig.getConfigFileExists()){
        // The MainConfigProcessor approach has been deprecated.
        // Instead we will use our own config file so we have better control over when it is persisted
        return;
    }
	Loggers.SERVER.info("MsTeamsNotificationMainSettings: re-reading main settings using old-style MainConfigProcessor. From now on we will use the msteams/msteams-config.xml file instead of main-config.xml");
	Loggers.SERVER.debug(NAME + ":readFrom :: " + rootElement.toString());
	MsTeamsNotificationMainConfig tempConfig = new MsTeamsNotificationMainConfig(serverPaths);
	Element msteamsNotificationsElement = rootElement.getChild("msteamsnotifications");
    tempConfig.readConfigurationFromXmlElement(msteamsNotificationsElement);
    this.msteamsNotificationMainConfig = tempConfig;
    tempConfig.save();
}
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:21,代码来源:MsTeamsNotificationMainSettings.java

示例5: parsePerson

import org.jdom.Element; //导入方法依赖的package包/类
private Person parsePerson(URL baseURI, Element ePerson) {
    Person person = new Person();
    Element e = ePerson.getChild("name",getAtomNamespace());
    if (e!=null) {
        person.setName(e.getText());
    }
    e = ePerson.getChild("uri",getAtomNamespace());
    if (e!=null) {
        person.setUri(resolveURI(baseURI, ePerson, e.getText()));
    }
    e = ePerson.getChild("email",getAtomNamespace());
    if (e!=null) {
        person.setEmail(e.getText());
    }
    return person;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:Atom10Parser.java

示例6: updateElement

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Method updateElement.
 * 
 * @param counter
 * @param shouldExist
 * @param name
 * @param parent
 * @return Element
 */
protected Element updateElement(Counter counter, Element parent, String name, boolean shouldExist)
{
    Element element =  parent.getChild(name, parent.getNamespace());
    if (element != null && shouldExist) {
        counter.increaseCount();
    }
    if (element == null && shouldExist) {
        element = factory.element(name, parent.getNamespace());
        insertAtPreferredLocation(parent, element, counter);
        counter.increaseCount();
    }
    if (!shouldExist && element != null) {
        int index = parent.indexOf(element);
        if (index > 0) {
            Content previous = parent.getContent(index - 1);
            if (previous instanceof Text) {
                Text txt = (Text)previous;
                if (txt.getTextTrim().length() == 0) {
                    parent.removeContent(txt);
                }
            }
        }
        parent.removeContent(element);
    }
    return element;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:NetbeansBuildActionJDOMWriter.java

示例7: checkLength

import org.jdom.Element; //导入方法依赖的package包/类
protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
    Element  child = parent.getChild(childName,getFeedNamespace());
    if (child != null) {
        if (minLen>0 && child.getText().length()<minLen) {
            throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length");
        }
        if (maxLen>-1 && child.getText().length()>maxLen) {
            throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length");
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:RSS090Generator.java

示例8: getChannelImageUrl

import org.jdom.Element; //导入方法依赖的package包/类
private String getChannelImageUrl(Element channelElement) {
    String result = getITunesAttribute(channelElement, "image", "href");
    if (result == null) {
        Element imageElement = channelElement.getChild("image");
        if (imageElement != null) {
            result = imageElement.getChildTextTrim("url");
        }
    }
    return result;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:11,代码来源:PodcastService.java

示例9: 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

示例10: processInheritableResourceData

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Recursive method to process the {@link CreoleResource} elements that can be
 * inherited from superclasses and interfaces (everything except the PRIVATE
 * and MAIN_VIEWER flags, the NAME and the AUTOINSTANCEs). Once data has been
 * extracted from the current class the method calls itself recursively for
 * the superclass and any implemented interfaces. For any given attribute, the
 * first value specified wins (i.e. the one on the most specific class).
 * 
 * @param clazz
 *          the class to process
 * @param element
 *          the RESOURCE element to which data should be added.
 */
private void processInheritableResourceData(Class<?> clazz, Element element) {
  CreoleResource cr = clazz.getAnnotation(CreoleResource.class);
  if(cr != null) {
    addElement(element, cr.comment(), "COMMENT");
    addElement(element, cr.helpURL(), "HELPURL");
    addElement(element, cr.interfaceName(), "INTERFACE");
    addElement(element, cr.icon(), "ICON");
    if(cr.guiType() != GuiType.NONE && element.getChild("GUI") == null) {
      Element guiElement =
          new Element("GUI").setAttribute("TYPE", cr.guiType().toString());
      element.addContent(guiElement);
      addElement(guiElement, cr.resourceDisplayed(), "RESOURCE_DISPLAYED");
    }
    addElement(element, cr.annotationTypeDisplayed(),
        "ANNOTATION_TYPE_DISPLAYED");
  }

  Class<?> superclass = clazz.getSuperclass();
  if(superclass != null) {
    processInheritableResourceData(superclass, element);
  }

  for(Class<?> intf : clazz.getInterfaces()) {
    processInheritableResourceData(intf, element);
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:40,代码来源:CreoleAnnotationHandler.java

示例11: parseItem

import org.jdom.Element; //导入方法依赖的package包/类
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    item.setExpirationDate(null);

    Element e = eItem.getChild("author",getRSSNamespace());
    if (e!=null) {
        item.setAuthor(e.getText());
    }

    e = eItem.getChild("guid",getRSSNamespace());
    if (e!=null) {
        Guid guid = new Guid();
        String att = e.getAttributeValue("isPermaLink");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            guid.setPermaLink(att.equalsIgnoreCase("true"));
        }
        guid.setValue(e.getText());
        item.setGuid(guid);
    }

    e = eItem.getChild("comments",getRSSNamespace());
    if (e!=null) {
        item.setComments(e.getText());
    }

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

示例12: test_WebookConfig

import org.jdom.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void test_WebookConfig() throws JDOMException, IOException{
	SAXBuilder builder = new SAXBuilder();
	List<MsTeamsNotificationConfig> configs = new ArrayList<MsTeamsNotificationConfig>();
	builder.setIgnoringElementContentWhitespace(true);
		Document doc = builder.build("src/test/resources/testdoc2.xml");
		Element root = doc.getRootElement();
		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();
					MsTeamsNotificationConfig whConfig = new MsTeamsNotificationConfig(e);
					configs.add(whConfig);
	            }
			}
		}

	
	for (MsTeamsNotificationConfig c : configs){
		MsTeamsNotification wh = new MsTeamsNotificationImpl();
		wh.setEnabled(c.getEnabled());
		//msteamsNotification.addParams(c.getParams());
		System.out.println(wh.isEnabled().toString());

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

示例13: parseChannel

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

    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
    Element eCloud = eChannel.getChild("cloud",getRSSNamespace());
    if (eCloud!=null) {
        Cloud cloud = new Cloud();
        String att = eCloud.getAttributeValue("domain");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setDomain(att);
        }
        att = eCloud.getAttributeValue("port");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setPort(Integer.parseInt(att));
        }
        att = eCloud.getAttributeValue("path");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setPath(att);
        }
        att = eCloud.getAttributeValue("registerProcedure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setRegisterProcedure(att);
        }
        att = eCloud.getAttributeValue("protocol");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setProtocol(att);
        }
        channel.setCloud(cloud);
    }
    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:RSS092Parser.java

示例14: readComponent

import org.jdom.Element; //导入方法依赖的package包/类
@Nullable
private static Element readComponent(@NotNull SAXBuilder parser, @NotNull String projectPath) {
  Element component = null;
  try {
    String studyProjectXML = projectPath + STUDY_PROJECT_XML_PATH;
    Document xmlDoc = parser.build(new File(studyProjectXML));
    Element root = xmlDoc.getRootElement();
    component = root.getChild("component");
  }
  catch (JDOMException | IOException ignored) {
  }

  return component;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:15,代码来源:EduBuiltInServerUtils.java

示例15: 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


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