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

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

protected static class SecureGenericXMLFactory.SecureDocumentBuilderFactory
extends javax.xml.parsers.DocumentBuilderFactory

Wraps an existing DocumentBuilderFactory and ensures that any returned DocumentBuilder instances are secure.


Constructor Summary
protected SecureGenericXMLFactory.SecureDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
          Constructs a new SecureDocumentBuilderFactory instance that delegates most functionality to an existing instance, but overrides where needed to protect against XXE attacks.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 boolean getFeature(java.lang.String name)
           
 javax.xml.validation.Schema getSchema()
           
 boolean isCoalescing()
           
 boolean isExpandEntityReferences()
           
 boolean isIgnoringComments()
           
 boolean isIgnoringElementContentWhitespace()
           
 boolean isIncludeAware()
           
 boolean isNamespaceAware()
           
 boolean isValidating()
           
 javax.xml.parsers.DocumentBuilder newDocumentBuilder()
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setCoalescing(boolean coalescing)
           
 void setExpandEntityReferences(boolean expandEntityRef)
           
 void setFeature(java.lang.String name, boolean value)
           
 void setIgnoringComments(boolean ignoreComments)
           
 void setIgnoringElementContentWhitespace(boolean whitespace)
           
 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.DocumentBuilderFactory
isXIncludeAware, newInstance, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecureGenericXMLFactory.SecureDocumentBuilderFactory

protected SecureGenericXMLFactory.SecureDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
Constructs a new SecureDocumentBuilderFactory instance that delegates most functionality to an existing instance, but overrides where needed to protect against XXE attacks.

Parameters:
factory - the existing DocumentBuilderFactory that should be secured.
Method Detail

newDocumentBuilder

public javax.xml.parsers.DocumentBuilder newDocumentBuilder()
                                                     throws javax.xml.parsers.ParserConfigurationException
Specified by:
newDocumentBuilder in class javax.xml.parsers.DocumentBuilderFactory
Throws:
javax.xml.parsers.ParserConfigurationException

setNamespaceAware

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

setValidating

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

setIgnoringElementContentWhitespace

public void setIgnoringElementContentWhitespace(boolean whitespace)
Overrides:
setIgnoringElementContentWhitespace in class javax.xml.parsers.DocumentBuilderFactory

setExpandEntityReferences

public void setExpandEntityReferences(boolean expandEntityRef)
Overrides:
setExpandEntityReferences in class javax.xml.parsers.DocumentBuilderFactory

setIgnoringComments

public void setIgnoringComments(boolean ignoreComments)
Overrides:
setIgnoringComments in class javax.xml.parsers.DocumentBuilderFactory

setCoalescing

public void setCoalescing(boolean coalescing)
Overrides:
setCoalescing in class javax.xml.parsers.DocumentBuilderFactory

isNamespaceAware

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

isValidating

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

isIgnoringElementContentWhitespace

public boolean isIgnoringElementContentWhitespace()
Overrides:
isIgnoringElementContentWhitespace in class javax.xml.parsers.DocumentBuilderFactory

isExpandEntityReferences

public boolean isExpandEntityReferences()
Overrides:
isExpandEntityReferences in class javax.xml.parsers.DocumentBuilderFactory

isIgnoringComments

public boolean isIgnoringComments()
Overrides:
isIgnoringComments in class javax.xml.parsers.DocumentBuilderFactory

isCoalescing

public boolean isCoalescing()
Overrides:
isCoalescing in class javax.xml.parsers.DocumentBuilderFactory

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
                  throws java.lang.IllegalArgumentException
Specified by:
setAttribute in class javax.xml.parsers.DocumentBuilderFactory
Throws:
java.lang.IllegalArgumentException

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Specified by:
getAttribute in class javax.xml.parsers.DocumentBuilderFactory
Throws:
java.lang.IllegalArgumentException

setFeature

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

getFeature

public boolean getFeature(java.lang.String name)
                   throws javax.xml.parsers.ParserConfigurationException
Specified by:
getFeature in class javax.xml.parsers.DocumentBuilderFactory
Throws:
javax.xml.parsers.ParserConfigurationException

getSchema

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

setSchema

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

setXIncludeAware

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

isIncludeAware

public boolean isIncludeAware()
                       throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException