本文整理汇总了Java中com.sun.org.apache.xerces.internal.utils.ObjectFactory.findProviderClass方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectFactory.findProviderClass方法的具体用法?Java ObjectFactory.findProviderClass怎么用?Java ObjectFactory.findProviderClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.utils.ObjectFactory
的用法示例。
在下文中一共展示了ObjectFactory.findProviderClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
* DOM Level 3 WD - Experimental.
*/
public Object getFeature(String feature, String version) {
if (singleton.hasFeature(feature, version)) {
if ((feature.equalsIgnoreCase("+XPath"))) {
try {
Class xpathClass = ObjectFactory.findProviderClass(
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
return xpathClass.newInstance();
}
}
} catch (Exception e) {
return null;
}
} else {
return singleton;
}
}
return null;
}
示例2: setDocumentClassName
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
* This method allows the programmer to decide which document
* factory to use when constructing the DOM tree. However, doing
* so will lose the functionality of the default factory. Also,
* a document class other than the default will lose the ability
* to defer node expansion on the DOM tree produced.
*
* @param documentClassName The fully qualified class name of the
* document factory to use when constructing
* the DOM tree.
*
* @see #getDocumentClassName
* @see #DEFAULT_DOCUMENT_CLASS_NAME
*/
protected void setDocumentClassName (String documentClassName) {
// normalize class name
if (documentClassName == null) {
documentClassName = DEFAULT_DOCUMENT_CLASS_NAME;
}
if (!documentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME) &&
!documentClassName.equals(PSVI_DOCUMENT_CLASS_NAME)) {
// verify that this class exists and is of the right type
try {
Class _class = ObjectFactory.findProviderClass (documentClassName, true);
//if (!_class.isAssignableFrom(Document.class)) {
if (!Document.class.isAssignableFrom (_class)) {
throw new IllegalArgumentException (
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"InvalidDocumentClassName", new Object [] {documentClassName}));
}
}
catch (ClassNotFoundException e) {
throw new IllegalArgumentException (
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"MissingDocumentClassName", new Object [] {documentClassName}));
}
}
// set document class name
fDocumentClassName = documentClassName;
if (!documentClassName.equals (DEFAULT_DOCUMENT_CLASS_NAME)) {
fDeferNodeExpansion = false;
}
}
示例3: getFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
* @since DOM Level 3
*/
public Object getFeature(String feature, String version) {
boolean anyVersion = version == null || version.length() == 0;
// if a plus sign "+" is prepended to any feature name, implementations
// are considered in which the specified feature may not be directly
// castable DOMImplementation.getFeature(feature, version). Without a
// plus, only features whose interfaces are directly castable are
// considered.
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
// If an XPathEvaluator was created previously
// return it otherwise create a new one.
if (fXPathEvaluator != null) {
return fXPathEvaluator;
}
try {
Class xpathClass = ObjectFactory.findProviderClass (
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
Constructor xpathClassConstr =
xpathClass.getConstructor(new Class[] { Document.class });
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
fXPathEvaluator = xpathClassConstr.newInstance(new Object[] { this });
return fXPathEvaluator;
}
}
return null;
} catch (Exception e) {
return null;
}
}
return super.getFeature(feature, version);
}
示例4: hasFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
* Test if the DOM implementation supports a specific "feature" --
* currently meaning language and level thereof.
*
* @param feature The package name of the feature to test.
* In Level 1, supported values are "HTML" and "XML" (case-insensitive).
* At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.
*
* @param version The version number of the feature being tested.
* This is interpreted as "Version of the DOM API supported for the
* specified Feature", and in Level 1 should be "1.0"
*
* @return true iff this implementation is compatable with the specified
* feature and version.
*/
public boolean hasFeature(String feature, String version) {
boolean anyVersion = version == null || version.length() == 0;
// check if Xalan implementation is around and if yes report true for supporting
// XPath API
// if a plus sign "+" is prepended to any feature name, implementations
// are considered in which the specified feature may not be directly
// castable DOMImplementation.getFeature(feature, version). Without a
// plus, only features whose interfaces are directly castable are considered.
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
try {
Class xpathClass = ObjectFactory.findProviderClass(
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
return true;
}
}
} catch (Exception e) {
return false;
}
return true;
}
if (feature.startsWith("+")) {
feature = feature.substring(1);
}
return (
feature.equalsIgnoreCase("Core")
&& (anyVersion
|| version.equals("1.0")
|| version.equals("2.0")
|| version.equals("3.0")))
|| (feature.equalsIgnoreCase("XML")
&& (anyVersion
|| version.equals("1.0")
|| version.equals("2.0")
|| version.equals("3.0")))
|| (feature.equalsIgnoreCase("LS")
&& (anyVersion || version.equals("3.0")));
}
示例5: getFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
* @since DOM Level 3
*/
public Object getFeature(String feature, String version) {
boolean anyVersion = version == null || version.length() == 0;
// if a plus sign "+" is prepended to any feature name, implementations
// are considered in which the specified feature may not be directly
// castable DOMImplementation.getFeature(feature, version). Without a
// plus, only features whose interfaces are directly castable are
// considered.
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
// If an XPathEvaluator was created previously
// return it otherwise create a new one.
if (fXPathEvaluator != null) {
return fXPathEvaluator;
}
try {
Class xpathClass = ObjectFactory.findProviderClass (
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
Constructor xpathClassConstr =
xpathClass.getConstructor(new Class[] { Document.class });
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
fXPathEvaluator = xpathClassConstr.newInstance(new Object[] { this });
return fXPathEvaluator;
}
}
return null;
} catch (Exception e) {
return null;
}
}
return super.getFeature(feature, version);
}