HMLObjectImpl#toDocument() issue
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
The HTMLObjectImple#toDocument() method is setting custom
OutpuOptions. Where I thought we had gotten rid of the issue with default
removal of HTML Span id's. It does this now..
public String toDocument() {
// Create formatter if needed (no synchronization necessary)
if (fFormatter == null) {
OutputOptions options = new OutputOptions();
options.setDropHtmlSpanIds(true);
fFormatter = new DOMFormatter(options);
}
return fFormatter.toString(this);
}
I think it should do this...
public String toDocument() {
// Create formatter if needed (no synchronization necessary)
if (fFormatter == null) {
fFormatter = new
DOMFormatter(DOMFormatter.getDefaultOutputOptions(getDocument()));
}
return fFormatter.toString(this);
}
We removed default quirks like this from OutputOptions for good
reason. Overriding that in arbitrary places causes unexpected
behavior. Quirks should normally be explicitly defined by the developer
except under extraordinary circumstances.
Note that the default output options for both he HTMLFormatter and
XMLFormatter simply return a generic OutputOptions object with no
modifications. As such, currently, simply doing new DOMformatter() would
do the same thing. However, if we use the default output options for
either formatter, just doing new DOMFormatter() would miss the change, so
getting the default output options is probably still a good idea. Given
this, XMLObjectImpl#toDocument() should probably be changed to pass in
default output options as well.
Thoughts? Anyone opposed to this?
Jake