javax.xml.parsers
Class SAXParserFactory

java.lang.Object
  |
  +--javax.xml.parsers.SAXParserFactory

public abstract class SAXParserFactory
extends java.lang.Object

Responsible for creating new SAXParsers.

Normally, users will create a SAX parser as follows:


 SAXParserFactory factory = SAXParserFactory.newInstance();
 Parser parser = factory.newSAXParser();
 parser.setDocumentHandler(myDocumentHandler);
 parser.parse(myInputSource);
 

SAXParserFactory uses the system property javax.xml.parsers.SAXParserFactory to find the class to load. So you can change the parser by calling:


 System.setProperty("javax.xml.parsers.SAXParserFactory", "com.foo.myFactory");
 


Constructor Summary
SAXParserFactory()
           
 
Method Summary
abstract  boolean getFeature(java.lang.String name)
          Returns the named feature.
 boolean isNamespaceAware()
          Returns whether the parser should namespace aware
 boolean isValidating()
          Returns whether the parser should namespace aware
static SAXParserFactory newInstance()
          Returns a new SAXParserFactory instance based on the javax.xml.parsers.SAXParserFactory system property.
abstract  SAXParser newSAXParser()
          Creates a new SAXParser()
abstract  void setFeature(java.lang.String name, boolean value)
          Sets the named feature.
 void setNamespaceAware(boolean aware)
          When creating a parser, create a namespace aware parser.
 void setValidating(boolean validating)
          When creating a parser, create a validating one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXParserFactory

public SAXParserFactory()
Method Detail

newInstance

public static SAXParserFactory newInstance()
Returns a new SAXParserFactory instance based on the javax.xml.parsers.SAXParserFactory system property.
  1. System.getProperty("javax.xml.parsers.SAXParserFactory");
  2. META-INF/services/javax.xml.parsers.SAXParserFactory
  3. $JAVA_HOME/lib/jaxp.properties
  4. com.caucho.xml.parsers.XmlSAXParserFactory

getFeature

public abstract boolean getFeature(java.lang.String name)
                            throws org.xml.sax.SAXNotRecognizedException
Returns the named feature.

setFeature

public abstract void setFeature(java.lang.String name,
                                boolean value)
                         throws org.xml.sax.SAXNotRecognizedException
Sets the named feature.
Parameters:
name - the feature name.
value - the feature value

isNamespaceAware

public boolean isNamespaceAware()
Returns whether the parser should namespace aware

setNamespaceAware

public void setNamespaceAware(boolean aware)
When creating a parser, create a namespace aware parser.

isValidating

public boolean isValidating()
Returns whether the parser should namespace aware

setValidating

public void setValidating(boolean validating)
When creating a parser, create a validating one.

newSAXParser

public abstract SAXParser newSAXParser()
                                throws ParserConfigurationException,
                                       org.xml.sax.SAXException
Creates a new SAXParser()