diff --git a/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java b/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java index 71c769b..70542d5 100644 --- a/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java +++ b/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java @@ -69,6 +69,8 @@ public boolean getFeature(String name) switch (stdFeat) { case IS_STANDALONE: // read-only, but only during parsing return true; + case EXTERNAL_GENERAL_ENTITIES: + return ((Boolean) mStaxFactory.getProperty(ReaderConfig.EXPAND_GENERAL_ENTITIES)).booleanValue(); default: } } else { diff --git a/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java b/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java index cfbed04..8ba79ce 100644 --- a/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java +++ b/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java @@ -262,6 +262,8 @@ public boolean getFeature(String name) case IS_STANDALONE: // read-only, but only during parsing // !!! TBI return true; + case EXTERNAL_GENERAL_ENTITIES: + return ((Boolean) _staxFactory.getProperty(ReaderConfig.EXPAND_GENERAL_ENTITIES)).booleanValue(); default: } } else { diff --git a/src/main/java/com/fasterxml/aalto/sax/SAXUtil.java b/src/main/java/com/fasterxml/aalto/sax/SAXUtil.java index 57a77aa..be9db8f 100644 --- a/src/main/java/com/fasterxml/aalto/sax/SAXUtil.java +++ b/src/main/java/com/fasterxml/aalto/sax/SAXUtil.java @@ -71,8 +71,6 @@ public static SAXProperty findStdProperty(String featURI) public static Boolean getFixedStdFeatureValue(SAXFeature stdFeat) { switch (stdFeat) { - case EXTERNAL_GENERAL_ENTITIES: // not yet implemented - return Boolean.FALSE; case EXTERNAL_PARAMETER_ENTITIES: // not yet implemented return Boolean.FALSE; case IS_STANDALONE: // read-only, but only during parsing diff --git a/src/test/java/com/fasterxml/aalto/sax/TestSAXParserFactoryImpl.java b/src/test/java/com/fasterxml/aalto/sax/TestSAXParserFactoryImpl.java new file mode 100644 index 0000000..2c3c438 --- /dev/null +++ b/src/test/java/com/fasterxml/aalto/sax/TestSAXParserFactoryImpl.java @@ -0,0 +1,17 @@ +package com.fasterxml.aalto.sax; + +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; + +public class TestSAXParserFactoryImpl extends base.BaseTestCase { + + public void testSetGetFeatureExternalGeneralEntities() throws SAXNotRecognizedException, SAXNotSupportedException { + SAXParserFactoryImpl saxParserFactory = new SAXParserFactoryImpl(); + saxParserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); + assertFalse(saxParserFactory.getFeature("http://xml.org/sax/features/external-general-entities")); + + saxParserFactory.setFeature("http://xml.org/sax/features/external-general-entities", true); + assertTrue(saxParserFactory.getFeature("http://xml.org/sax/features/external-general-entities")); + } + +}