當前位置: 首頁>>代碼示例>>Java>>正文


Java Element.isTextOnly方法代碼示例

本文整理匯總了Java中org.dom4j.Element.isTextOnly方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.isTextOnly方法的具體用法?Java Element.isTextOnly怎麽用?Java Element.isTextOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.dom4j.Element的用法示例。


在下文中一共展示了Element.isTextOnly方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFloat

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 * @param xpath XPath , pointing to a XML element
 * @return a float XML value
 * @throws XMLException
 */
@PublicAtsApi
public float getFloat(
                       String xpath ) throws XMLException {

    Object object = get(xpath);

    Element root = ((XmlText) object).root;

    if (root.isTextOnly()) {

        object = root.getText().trim();

    } else {

        object = "";

    }

    try {
        return Float.parseFloat( ((String) object).trim());
    } catch (NumberFormatException nfe) {
        throw new XMLException("'" + xpath + "' does not point to a float value:\n"
                               + object.toString());
    }
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:31,代碼來源:XmlText.java

示例2: getInt

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 * @param xpath XPath , pointing to a XML element
 * @return an Integer XML value
 * @throws XMLException
 */
@PublicAtsApi
public int getInt(
                   String xpath ) throws XMLException {

    Object object = get(xpath);

    Element root = ((XmlText) object).root;

    if (root.isTextOnly()) {

        object = root.getText().trim();

    } else {

        object = "";

    }

    try {
        return Integer.parseInt( ((String) object).trim());
    } catch (NumberFormatException nfe) {
        throw new XMLException("'" + xpath + "' does not point to an int value:\n" + object.toString());
    }
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:30,代碼來源:XmlText.java

示例3: getBoolean

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 * @param xpath XPath , pointing to a XML element
 * @return a boolean XML value
 * @throws XMLException
 */
@PublicAtsApi
public boolean getBoolean(
                           String xpath ) throws XMLException {

    Object object = get(xpath);

    Element root = ((XmlText) object).root;

    if (root.isTextOnly()) {

        object = root.getText().trim();

    } else {

        object = "";

    }

    if ("true".equalsIgnoreCase((String) object)
        || "false".equalsIgnoreCase((String) object)) {
        return Boolean.parseBoolean( ((String) object).trim());
    } else {
        throw new XMLException("'" + xpath + "' does not point to an boolean value:\n"
                               + object.toString());
    }
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:32,代碼來源:XmlText.java

示例4: getString

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 * @param xpath XPath , pointing to a XML element
 * @return a String XML value
 * @throws XMLException
 */
@PublicAtsApi
public String getString(
                         String xpath ) throws XMLException {

    Object object = get(xpath);

    Element root = ((XmlText) object).root;

    if (root.isTextOnly()) {

        object = root.getText().trim();

    } else {

        throw new XMLException("'" + xpath + "' does not point to a String value:\n"
                               + object.toString());

    }

    return (String) object;
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:27,代碼來源:XmlText.java


注:本文中的org.dom4j.Element.isTextOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。