FileDocCategorySizeDatePackage
SAXParserFactoryImpl.javaAPI DocAndroid 1.5 API3737Wed May 06 22:41:06 BST 2009org.apache.harmony.xml.parsers

SAXParserFactoryImpl

public class SAXParserFactoryImpl extends SAXParserFactory
Provides a straightforward SAXParserFactory implementation based on Expat. The class is used internally only, thus only notable members that are not already in the abstract superclass are documented.

Fields Summary
private static final String
NAMESPACES
private static final String
VALIDATION
private Map
features
Constructors Summary
Methods Summary
public booleangetFeature(java.lang.String name)


    
          
        if (name == null) {
            throw new NullPointerException();
        }
        
        if (!name.startsWith("http://xml.org/sax/features/")) {
            throw new SAXNotRecognizedException(name);
        }
        
        return Boolean.TRUE.equals(features.get(name));
    
public booleanisNamespaceAware()

        try {
            return getFeature(NAMESPACES);
        } catch (SAXNotRecognizedException ex) {
            throw new AssertionError(ex);
        }
    
public booleanisValidating()

        try {
            return getFeature(VALIDATION);
        } catch (SAXNotRecognizedException ex) {
            throw new AssertionError(ex);
        }
    
public javax.xml.parsers.SAXParsernewSAXParser()

        if (isValidating()) {
            throw new ParserConfigurationException(
                    "No validating SAXParser implementation available");
        }
        
        try {
            return new SAXParserImpl(features);
        } catch (Exception ex) {
            throw new ParserConfigurationException(ex.toString());
        }
    
public voidsetFeature(java.lang.String name, boolean value)

        if (name == null) {
            throw new NullPointerException();
        }
        
        if (!name.startsWith("http://xml.org/sax/features/")) {
            throw new SAXNotRecognizedException(name);
        }
        
        if (value) {
            features.put(name, Boolean.TRUE);
        } else {
            // This is needed to disable features that are enabled by default.
            features.put(name, Boolean.FALSE);
        }
    
public voidsetNamespaceAware(boolean value)

        try {
            setFeature(NAMESPACES, value);
        } catch (SAXNotRecognizedException ex) {
            throw new AssertionError(ex);
        }
    
public voidsetValidating(boolean value)

        try {
            setFeature(VALIDATION, value);
        } catch (SAXNotRecognizedException ex) {
            throw new AssertionError(ex);
        }