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


Java DOMResult.FEATURE屬性代碼示例

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


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

示例1: getFeature

/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:40,代碼來源:SmartTransformerFactoryImpl.java

示例2: getFeature

/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (_featureManager != null) ?
            _featureManager.getValueAsString(name) : null;
    if (propertyValue != null) {
        return Boolean.parseBoolean(propertyValue);
    }

    // Feature not supported
    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:53,代碼來源:TransformerFactoryImpl.java

示例3: getFeature

/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }

    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatues **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:52,代碼來源:TransformerFactoryImpl.java


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