It is impossible to allow external access to external DTDs either by setting property in the case of SAX Parser (1) or by setting specific attribute in the case of the DocumentBuilder if If XInclude markup is allowed (3) and found in the document instance. Although System Property (4) works perfectly in both cases.
1) parser.setProperty(ACCESS_EXTERNAL_DTD, "file");
2) factory.setAttribute(ACCESS_EXTERNAL_DTD, "file");
3) factory.setXIncludeAware(true);
4) System.setProperty(SP_ACCESS_EXTERNAL_DTD, "file");
I think that it should be allowed to use parser properites/attributtes to set up external access in the case of XInclude.
What do you think?
Enclosed you will find code and data files to reproduce this issue:
> java -Djava.endorsed.dirs=/files/devel/jaxp1.5/endorsed org.kleo.ExternalAccessTest
(SAX) JAXP Property - fail: Error attempting to parse XML file (href='simple.xml').
(SAX) SystemProperty- ok: javax.xml.accessExternalDTD (file)
[Fatal Error] test2.xml:3:32: External DTD: Failed to read external DTD '', because 'file' access is not allowed.
[Fatal Error] simple.xml:12:41: Error attempting to parse XML file (href='test2.xml').
[Fatal Error] roottest.xml:4:22: Error attempting to parse XML file (href='simple.xml').
(DOM) JAXP Property - fail: Error attempting to parse XML file (href='simple.xml').
(DOM) SystemProperty- ok: javax.xml.accessExternalDTD (file)
1) parser.setProperty(ACCESS_EXTERNAL_DTD, "file");
2) factory.setAttribute(ACCESS_EXTERNAL_DTD, "file");
3) factory.setXIncludeAware(true);
4) System.setProperty(SP_ACCESS_EXTERNAL_DTD, "file");
I think that it should be allowed to use parser properites/attributtes to set up external access in the case of XInclude.
What do you think?
Enclosed you will find code and data files to reproduce this issue:
> java -Djava.endorsed.dirs=/files/devel/jaxp1.5/endorsed org.kleo.ExternalAccessTest
(SAX) JAXP Property - fail: Error attempting to parse XML file (href='simple.xml').
(SAX) SystemProperty- ok: javax.xml.accessExternalDTD (file)
[Fatal Error] test2.xml:3:32: External DTD: Failed to read external DTD '', because 'file' access is not allowed.
[Fatal Error] simple.xml:12:41: Error attempting to parse XML file (href='test2.xml').
[Fatal Error] roottest.xml:4:22: Error attempting to parse XML file (href='simple.xml').
(DOM) JAXP Property - fail: Error attempting to parse XML file (href='simple.xml').
(DOM) SystemProperty- ok: javax.xml.accessExternalDTD (file)