com.google.gdata.util.common.xml.parsing
Class SecureGenericXMLFactory.SecureSAXParserFactory

java.lang.Object
  extended by javax.xml.parsers.SAXParserFactory
      extended by com.google.gdata.util.common.xml.parsing.SecureGenericXMLFactory.SecureSAXParserFactory
Enclosing class:
SecureGenericXMLFactory

protected static class SecureGenericXMLFactory.SecureSAXParserFactory
extends javax.xml.parsers.SAXParserFactory

Wraps an existing SAXParserFactory and ensures that any returned SAXParser instances are secure.


Constructor Summary
protected SecureGenericXMLFactory.SecureSAXParserFactory(javax.xml.parsers.SAXParserFactory factory)
          Constructs a new SecureSAXParserFactory instance that delegates most functionality to an existing instance, but overrides where needed to protect against XXE attacks.
 
Method Summary
 boolean getFeature(java.lang.String name)
           
 javax.xml.validation.Schema getSchema()
           
 boolean isNamespaceAware()
           
 boolean isValidating()
           
 boolean isXIncludeAware()
           
 javax.xml.parsers.SAXParser newSAXParser()
           
 void setFeature(java.lang.String name, boolean value)
           
 void setNamespaceAware(boolean awareness)
           
 void setSchema(javax.xml.validation.Schema schema)
           
 void setValidating(boolean validating)
           
 void setXIncludeAware(boolean state)
           
 
Methods inherited from class javax.xml.parsers.SAXParserFactory
newInstance, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecureGenericXMLFactory.SecureSAXParserFactory

protected SecureGenericXMLFactory.SecureSAXParserFactory(javax.xml.parsers.SAXParserFactory factory)
                                                  throws javax.xml.parsers.ParserConfigurationException,
                                                         org.xml.sax.SAXException
Constructs a new SecureSAXParserFactory instance that delegates most functionality to an existing instance, but overrides where needed to protect against XXE attacks.

Parameters:
factory - the existing SAXParserFactory that should be secured.
Throws:
javax.xml.parsers.ParserConfigurationException - on configuration errors.
org.xml.sax.SAXException - on configuration failures.
Method Detail

newSAXParser

public javax.xml.parsers.SAXParser newSAXParser()
                                         throws javax.xml.parsers.ParserConfigurationException,
                                                org.xml.sax.SAXException
Specified by:
newSAXParser in class javax.xml.parsers.SAXParserFactory
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

setNamespaceAware

public void setNamespaceAware(boolean awareness)
Overrides:
setNamespaceAware in class javax.xml.parsers.SAXParserFactory

setValidating

public void setValidating(boolean validating)
Overrides:
setValidating in class javax.xml.parsers.SAXParserFactory

isNamespaceAware

public boolean isNamespaceAware()
Overrides:
isNamespaceAware in class javax.xml.parsers.SAXParserFactory

isValidating

public boolean isValidating()
Overrides:
isValidating in class javax.xml.parsers.SAXParserFactory

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws javax.xml.parsers.ParserConfigurationException,
                       org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Specified by:
setFeature in class javax.xml.parsers.SAXParserFactory
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getFeature

public boolean getFeature(java.lang.String name)
                   throws javax.xml.parsers.ParserConfigurationException,
                          org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Specified by:
getFeature in class javax.xml.parsers.SAXParserFactory
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getSchema

public javax.xml.validation.Schema getSchema()
                                      throws java.lang.UnsupportedOperationException
Overrides:
getSchema in class javax.xml.parsers.SAXParserFactory
Throws:
java.lang.UnsupportedOperationException

setSchema

public void setSchema(javax.xml.validation.Schema schema)
               throws java.lang.UnsupportedOperationException
Overrides:
setSchema in class javax.xml.parsers.SAXParserFactory
Throws:
java.lang.UnsupportedOperationException

setXIncludeAware

public void setXIncludeAware(boolean state)
                      throws java.lang.UnsupportedOperationException
Overrides:
setXIncludeAware in class javax.xml.parsers.SAXParserFactory
Throws:
java.lang.UnsupportedOperationException

isXIncludeAware

public boolean isXIncludeAware()
                        throws java.lang.UnsupportedOperationException
Overrides:
isXIncludeAware in class javax.xml.parsers.SAXParserFactory
Throws:
java.lang.UnsupportedOperationException