You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/11/19 17:11:43 UTC
DO NOT REPLY [Bug 14681] New: -
Invalid XHTML closure for empty attribute and element objects in SerializeToHTML.java
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14681>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14681
Invalid XHTML closure for empty attribute and element objects in SerializeToHTML.java
Summary: Invalid XHTML closure for empty attribute and element
objects in SerializeToHTML.java
Product: XalanJ2
Version: 2.4
Platform: All
OS/Version: Linux
Status: NEW
Severity: Blocker
Priority: Other
Component: org.apache.xalan.serialize
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: atolbert@edsyndicate.com
The elements in SerializerToHTML.java that are of type ElemDesc.EMPTY are not
currently being closed correctly according to xhtml. The elements of type
ElemDesc.EMPTY are currently being closed with a '>' which should be " />" in
order to be xhtml compliant.Also, the element attributes in
SerializerToHTML.java of type ElemDesc.ATTREMPTY in order to be xhtml compliant
should not simply have attributes like CHECKED without something like
CHECKED="true".
This problem presented itself when I was researching why I was losing
my �special characters� (ie. ⁜ and the like). Any special character was
converted to a �?�. Do to the fact that the javax.xml.transform.dom.DOMResult
does not support character encoding I was forced to look for alternative, which
I found in javax.xml.transform.stream.StreamResult. The problem stated above
then presented itself as I have a situation where I have source xml transformed
to xhtml and then in some cases I have to re-transform the xhtml, which is now
not xhtml but html and results in an org.xml.sax.SAXParseException.
I don�t know if this is the appropriate place to make the change, or if an
entirely new xhtml type serializer should be added to the already existing xml,
html and text types available.
If at all possible I would like to see this change make it into the head of the
xalan codebase, so that I am not running a custom version of the source.
Thanks and here is the code snid-bit that I changed to output valid xhtml.
SerializerToHTML.java EMPTY change -- line number 741
if (!elemDesc.is(ElemDesc.EMPTY))
{
this.accum('>');
// As per Dave/Paul recommendation 12/06/2000
// if (shouldIndent)
// indent(m_currentIndent);
this.accum('<');
this.accum('/');
this.accum(name);
this.accum('>');
}
else
{
// Aaron Tolbert atolbert@edsyndicate.com -- 11/18/2002
// Valid XHTML needs empty tag to be properly closed.
this.accum(" />");
//this.accum('>');
}
SerializerToHTML.java ATTREMPTY change -- line number 790
if (((value.length() == 0) || value.equalsIgnoreCase(name))
&& elemDesc.isAttrFlagSet(name, ElemDesc.ATTREMPTY))
{
// Aaron Tolbert atolbert@edsyndicate.com -- 11/18/2002
// Valid XHTML attributes need to have key="value".
this.accum(name);
this.accum("=\"true\"");
//this.accum(name);
}
else
{
this.accum(name);
this.accum('=');
this.accum('\"');
if (elemDesc.isAttrFlagSet(name, ElemDesc.ATTRURL))
writeAttrURI(value, m_specialEscapeURLs);
else
writeAttrString(value, this.m_encoding);
this.accum('\"');
}