當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。