FileDocCategorySizeDatePackage
ParserFeatureSetterFactory.javaAPI DocApache Tomcat 6.0.142539Fri Jul 20 04:20:36 BST 2007org.apache.tomcat.util.digester

ParserFeatureSetterFactory

public class ParserFeatureSetterFactory extends Object
Creates a SAXParser based on the underlying parser. Allows logical properties depending on logical parser versions to be set.
since
1.6

Fields Summary
private static boolean
isXercesUsed
true is Xerces is used.
Constructors Summary
Methods Summary
public static javax.xml.parsers.SAXParsernewSAXParser(java.util.Properties properties)
Create a new SAXParser

param
properties (logical) properties to be set on parser
return
a SAXParser configured based on the underlying parser implementation.

        try{
            // Use reflection to avoid a build dependency with Xerces.
            Class versionClass = 
                            Class.forName("org.apache.xerces.impl.Version");
            isXercesUsed = true;
        } catch (Exception ex){
            isXercesUsed = false;
        }
    

        if (isXercesUsed){
            return XercesParser.newSAXParser(properties);
        } else {
            return GenericParser.newSAXParser(properties);
        }