Name: skT45625 Date: 07/17/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Server VM (build 2.0fcs-E, mixed mode)
The method com.sun.xml.tree.XmlDocumentBuilder.getIgnoringLexicalInfo
states that the default is true -- that comments, CDATA, and ignorable
whitespace are not included in the DOM Document that will be created by
the parser.
However, looking through the code, the default value is actually false:
XmlDocumentBuilder.java, line 117:
private boolean ignoringLexicalInfo = false;
Can this be fixed in the next release?
In addition, with the current javax.xml.parsers.DocumentBuilderFactory
interface, there is no way to set what is arguably a very important flag. Even
if the above mentioned bug is fixed, I still believe a couple of API methods
should be added to the class javax.xml.parsers.DocumentBuilderFactory:
DocumentBuilderFactory.setIncludeIgnorableWhiteSpace( boolean include );
DocumentBuilderFactory.setIncludeComments( boolean include );
DocumentBuilderFactory.setIncludeCDATASections( boolean include );
with default values of "false". This would help greatly with the
interoperability of other parsers using the JAXP interface classes. As
an example, the current version of the Xerces parser makes the same error above
(including ignorable whitespace be default). The only was to change the
behavior of the Xerces parser (which is also true with the Sun parser) is to
access the parser class directly rather than through the JAXP interfaces. This
seems to go against the obvious purpose of the JAXP classes, which is to
insulate the application developer from these concerns.
Sincerely,
Kevin Regan
###@###.###
(Review ID: 107242)
======================================================================