本文整理汇总了Java中javax.xml.transform.dom.DOMSource.FEATURE属性的典型用法代码示例。如果您正苦于以下问题:Java DOMSource.FEATURE属性的具体用法?Java DOMSource.FEATURE怎么用?Java DOMSource.FEATURE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.xml.transform.dom.DOMSource
的用法示例。
在下文中一共展示了DOMSource.FEATURE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getSourceFeature
@DataProvider(name = "source-feature")
public Object[][] getSourceFeature() {
return new Object[][] {
{ StreamSource.FEATURE },
{ SAXSource.FEATURE },
{ DOMSource.FEATURE },
{ DOMSource.FEATURE } };
}
示例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;
}
示例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;
}