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


Java SAXTransformerFactory.FEATURE属性代码示例

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


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

示例1: getFeature

/**
 * Look up the value of a feature.
 * <p>The feature name is any fully-qualified URI.  It is
 * possible for an TransformerFactory to recognize a feature name but
 * to be unable to return its value; this is especially true
 * in the case of an adapter for a SAX1 Parser, which has
 * no way of knowing whether the underlying parser is
 * validating, for example.</p>
 *
 * @param name The feature name, which is a fully-qualified URI.
 * @return The current state of the feature (true or false).
 */
public boolean getFeature(String name) {
	
  // feature name cannot be null
  if (name == null) 
  {
  	throw new NullPointerException(
          XSLMessages.createMessage(
          XSLTErrorResources.ER_GET_FEATURE_NULL_NAME, null));    
  }
 	
  // Try first with identity comparison, which 
  // will be faster.
  if ((DOMResult.FEATURE == name) || (DOMSource.FEATURE == name)
          || (SAXResult.FEATURE == name) || (SAXSource.FEATURE == name)
          || (StreamResult.FEATURE == name)
          || (StreamSource.FEATURE == name)
          || (SAXTransformerFactory.FEATURE == name)
          || (SAXTransformerFactory.FEATURE_XMLFILTER == name))
    return true;
  else if ((DOMResult.FEATURE.equals(name))
           || (DOMSource.FEATURE.equals(name))
           || (SAXResult.FEATURE.equals(name))
           || (SAXSource.FEATURE.equals(name))
           || (StreamResult.FEATURE.equals(name))
           || (StreamSource.FEATURE.equals(name))
           || (SAXTransformerFactory.FEATURE.equals(name))
           || (SAXTransformerFactory.FEATURE_XMLFILTER.equals(name)))
    return true;	      
  // secure processing?
  else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING))
    return m_isSecureProcessing;
  else      
    // unknown feature
    return false;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:47,代码来源:TransformerFactoryImpl.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
 */
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;
    }

    // Feature not supported
    return false;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:45,代码来源: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;
        }
    }
    // 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

示例4: 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.sax.SAXTransformerFactory.FEATURE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。