FileDocCategorySizeDatePackage
SAXParserFactoryImpl.javaAPI DocJava SE 6 API6495Tue Jun 10 00:22:48 BST 2008com.sun.org.apache.xerces.internal.jaxp

SAXParserFactoryImpl

public class SAXParserFactoryImpl extends SAXParserFactory
This is the implementation specific class for the javax.xml.parsers.SAXParserFactory. This is the platform default implementation for the platform.
author
Rajiv Mordani
author
Edwin Goei
version
$Id: SAXParserFactoryImpl.java,v 1.4 2005/09/26 14:46:10 sunithareddy Exp $

Fields Summary
private static final String
VALIDATION_FEATURE
Feature identifier: validation.
private static final String
NAMESPACES_FEATURE
Feature identifier: namespaces.
private static final String
XINCLUDE_FEATURE
Feature identifier: XInclude processing
private Hashtable
features
private Schema
grammar
private boolean
isXIncludeAware
private boolean
fSecureProcess
State of the secure processing feature, initially false
Constructors Summary
Methods Summary
public booleangetFeature(java.lang.String name)
returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

        if (name == null) {
            throw new NullPointerException();
        }
        if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return fSecureProcess;
        }
        // Check for valid name by creating a dummy XMLReader to get
        // feature value
        return newSAXParserImpl().getXMLReader().getFeature(name);
    
private booleangetFromFeatures(java.lang.String name)

         if (features == null){
            return false;
         }
         else {
             Object value = features.get(name);
             return (value == null) ? false : Boolean.valueOf(value.toString()).booleanValue();
         }
    
public javax.xml.validation.SchemagetSchema()

        return grammar;
    
public booleanisNamespaceAware()

        return getFromFeatures(NAMESPACES_FEATURE);
    
public booleanisValidating()

         return getFromFeatures(VALIDATION_FEATURE);
    
public booleanisXIncludeAware()

        return getFromFeatures(XINCLUDE_FEATURE);
    
public javax.xml.parsers.SAXParsernewSAXParser()
Creates a new instance of SAXParser using the currently configured factory parameters.

return
javax.xml.parsers.SAXParser


                       
      
         
    
        SAXParser saxParserImpl;
        try {
            saxParserImpl = new SAXParserImpl(this, features, fSecureProcess);
        } catch (SAXException se) {
            // Translate to ParserConfigurationException
            throw new ParserConfigurationException(se.getMessage());
        }
	return saxParserImpl;
    
private com.sun.org.apache.xerces.internal.jaxp.SAXParserImplnewSAXParserImpl()
Common code for translating exceptions

        SAXParserImpl saxParserImpl;
        try {
            saxParserImpl = new SAXParserImpl(this, features);
        } catch (SAXNotSupportedException e) {
            throw e;
        } catch (SAXNotRecognizedException e) {
            throw e;
        } catch (SAXException se) {
            throw new ParserConfigurationException(se.getMessage());
        }
        return saxParserImpl;
    
private voidputInFeatures(java.lang.String name, boolean value)

         if (features == null) {
            features = new Hashtable();
        }
        features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
    
public voidsetFeature(java.lang.String name, boolean value)
Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.

        if (name == null) {
            throw new NullPointerException();
        }
        // If this is the secure processing feature, save it then return.
        if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            fSecureProcess = value;
            return;
        }
        
        // XXX This is ugly.  We have to collect the features and then
        // later create an XMLReader to verify the features.
        putInFeatures(name, value);
        // Test the feature by possibly throwing SAX exceptions
        try {
            newSAXParserImpl();
        } catch (SAXNotSupportedException e) {
            features.remove(name);
            throw e;
        } catch (SAXNotRecognizedException e) {
            features.remove(name);
            throw e;
        }
    
public voidsetNamespaceAware(boolean awareness)

       putInFeatures(NAMESPACES_FEATURE, awareness);
    
public voidsetSchema(javax.xml.validation.Schema grammar)

        this.grammar = grammar;
    
public voidsetValidating(boolean validating)

        putInFeatures(VALIDATION_FEATURE, validating);
    
public voidsetXIncludeAware(boolean state)

        putInFeatures(XINCLUDE_FEATURE, state);