Documentation

The Java™ Tutorials
Hide TOC
StAX
Trail: Java API for XML Processing (JAXP)
Lesson: JAXP 1.5 and New Properties

StAX

The specification for StAX, JSR 173, does not yet support the new properties. However, StAX in the context of JAXP does include the support of these properties. Setting the new properties is similar to SAX or DOM, but through the XMLInputFactory as follows:

XMLInputFactory xif = XMLInputFactory.newInstance();
xif.setProperty("http://javax.xml.XMLConstants/property/accessExternalDTD", "file");

The existing properties and features specified in the StAX, JSR 173 specification will take preference over the new JAXP properties. The SupportDTD property for example, when set to false, will cause a program to throw exception when an input file contains DTD before it can be parsed. For applications that uses the SupportDTD property to disable DTD therefore, the addition of the new properties shall have no effect.


Previous page: Error Handling
Next page: Conclusion