src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
Print this page
*** 20,40 ****
/*
* $Id: XMLReaderManager.java,v 1.2.4.1 2005/09/15 08:16:02 suresh_emailid Exp $
*/
package com.sun.org.apache.xml.internal.utils;
! import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import java.util.HashMap;
!
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
!
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
- import org.xml.sax.SAXException;
/**
* Creates XMLReader objects and caches them for re-use.
* This class follows the singleton pattern.
*/
--- 20,40 ----
/*
* $Id: XMLReaderManager.java,v 1.2.4.1 2005/09/15 08:16:02 suresh_emailid Exp $
*/
package com.sun.org.apache.xml.internal.utils;
! import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+ import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.util.HashMap;
! import javax.xml.XMLConstants;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
! import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
/**
* Creates XMLReader objects and caches them for re-use.
* This class follows the singleton pattern.
*/
*** 62,71 ****
--- 62,76 ----
*/
private HashMap m_inUse;
private boolean m_useServicesMechanism = true;
/**
+ * protocols allowed for external DTD references in source file and/or stylesheet.
+ */
+ private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+
+ /**
* Hidden constructor
*/
private XMLReaderManager() {
}
*** 129,138 ****
--- 134,144 ----
}
}
try {
reader.setFeature(NAMESPACES_FEATURE, true);
reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false);
+ reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
} catch (SAXException se) {
// Try to carry on if we've got a parser that
// doesn't know about namespace prefixes.
}
} catch (ParserConfigurationException ex) {
*** 179,184 ****
--- 185,208 ----
*/
public void setServicesMechnism(boolean flag) {
m_useServicesMechanism = flag;
}
+ /**
+ * Get property value
+ */
+ public String getProperty(String name) {
+ if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
+ return _accessExternalDTD;
+ }
+ return null;
+ }
+
+ /**
+ * Set property.
+ */
+ public void setProperty(String name, String value) {
+ if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
+ _accessExternalDTD = (String)value;
+ }
+ }
}