Summary
Add a method to SAX ContentHandler to handle the XML Declaration event.
Problem
The SAX ContentHandler defines callback methods for SAX Parsers to send content information such as elements, characters and etc. back to the application. However, it omitted the XML Declaration, using it only for the SAX Parser to make its own configurations. This is a problem for applications that wish to read the declaration for configuring readers or writers, and preserving the declaration of the source.
Solution
Add a callback method to SAX ContentHandler to handle the XML Declaration event.
Specification
org.xml.sax
public interface ContentHandler
/**
* Receives notification of the XML declaration.
*
* @implSpec
* The default implementation in the SAX API is to do nothing.
*
* @param version the version string as in the input document, null if not
* specified
* @param encoding the encoding string as in the input document, null if not
* specified
* @param standalone the standalone string as in the input document, null if
* not specified
*
* @throws SAXException if the application wants to report an error or
* interrupt the parsing process
*/
default void declaration(String version, String encoding, String standalone)
throws SAXException
{
//no op
}
- csr of
-
JDK-8230814 Enable SAX ContentHandler to handle XML Declaration
-
- Resolved
-