本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}