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


Java Element.getText方法代码示例

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


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

示例1: setMetadataXML

import org.jdom.Element; //导入方法依赖的package包/类
/**
* 	
* @param atts
* @param attribute
* @param metadata
* @param namespace
* @param type
* @return
*/
protected Object setMetadataXML(Element atts, String attribute, String metadata, Namespace namespace, Class<?> type) {
  	Element o=atts.getChild(attribute, namespace);
  	String value=null;
  	Object val=null;
      if((atts != null) && (o != null)){
      	value=o.getText();
      	if(type==String.class){
      		val=value;
      		setMetadata(metadata,(String)value);
      	}else if(type==Integer.class){
      		val=Integer.parseInt(value);
      		setMetadata(metadata, val);
      	}else if(type==Double.class){
      		val=Double.parseDouble(value);
      		setMetadata(metadata, val);
      	}else if(type==Float.class){
      		val=Float.parseFloat(value);
      		setMetadata(metadata, val);
      	}	
      }
      return val;
  }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:32,代码来源:SUMOMetadata.java

示例2: parseContent

import org.jdom.Element; //导入方法依赖的package包/类
private Content parseContent(Element e) {
    String value = null;
    String src = e.getAttributeValue("src");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    String type = e.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    type = (type!=null) ? type : Content.TEXT;
    if (type.equals(Content.TEXT)) {
        // do nothing XML Parser took care of this
        value = e.getText();
    }
    else if (type.equals(Content.HTML)) {
        value = e.getText();
    }
    else if (type.equals(Content.XHTML)) {
        XMLOutputter outputter = new XMLOutputter();
        List eContent = e.getContent();
        Iterator i = eContent.iterator();
        while (i.hasNext()) {
            org.jdom.Content c = (org.jdom.Content) i.next();
            if (c instanceof Element) {
                Element eC = (Element) c;
                if (eC.getNamespace().equals(getAtomNamespace())) {
                    ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                }
            }
        }
        value = outputter.outputString(eContent);
    }
           
    Content content = new Content();
    content.setSrc(src);
    content.setType(type);
    content.setValue(value);
    return content;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:Atom10Parser.java

示例3: parseContent

import org.jdom.Element; //导入方法依赖的package包/类
private Content parseContent(Element e) {
    String value = null;
    String type = e.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    type = (type!=null) ? type : "text/plain";
    String mode = e.getAttributeValue("mode");//getAtomNamespace())); DONT KNOW WHY DOESN'T WORK
    if (mode == null) {
        mode = Content.XML; // default to xml content
    }
    if (mode.equals(Content.ESCAPED)) {
        // do nothing XML Parser took care of this
        value = e.getText();
    }
    else
    if (mode.equals(Content.BASE64)) {
            value = Base64.decode(e.getText());
    }
    else
    if (mode.equals(Content.XML)) {
        XMLOutputter outputter = new XMLOutputter();
        List eContent = e.getContent();
        Iterator i = eContent.iterator();
        while (i.hasNext()) {
            org.jdom.Content c = (org.jdom.Content) i.next();
            if (c instanceof Element) {
                Element eC = (Element) c;
                if (eC.getNamespace().equals(getAtomNamespace())) {
                    ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                }
            }
        }
        value = outputter.outputString(eContent);
    }

    Content content = new Content();
    content.setType(type);
    content.setMode(mode);
    content.setValue(value);
    return content;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:40,代码来源:Atom03Parser.java

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

示例5: readExternal

import org.jdom.Element; //导入方法依赖的package包/类
@Override
public void readExternal(final Element element) throws InvalidDataException {
    super.readExternal(element);

    final Element fileElement = element.getChild("file");
    if (fileElement != null) {
        this.runFilePath = fileElement.getText();
    }
}
 
开发者ID:ceddy4395,项目名称:Goal-Intellij-Plugin,代码行数:10,代码来源:GoalDebugConfiguration.java


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