xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrej Završnik (JIRA) <j...@apache.org>
Subject [jira] [Created] (XALANJ-2566) OutputFormat option for XMLSerializer for empty element rendering (self closing tag rendering)
Date Wed, 12 Dec 2012 13:17:21 GMT
Andrej Završnik created XALANJ-2566:
---------------------------------------

             Summary: OutputFormat option for XMLSerializer for empty element rendering (self
closing tag rendering)
                 Key: XALANJ-2566
                 URL: https://issues.apache.org/jira/browse/XALANJ-2566
             Project: XalanJ2
          Issue Type: Improvement
      Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects.
 Anybody can view the issue.)
          Components: Serialization
            Reporter: Andrej Završnik
            Assignee: Steven J. Hathaway


Additional option needed for XMLSerializer provided with OutputFormat to render empty tags
as
self closing: <tag /> and other not:<other></other>

Some self closing tags are not allowed in HTML5, so they must be rendered differently.
Currently this is not possible with XMLSerializer.

List of desired self closing tags could be provided as string list:

OutputFormat format = new OutputFormat(...);
format.selfClosingTags(new String[]{"one", "two", "three"});

In the protected void serializeElement(Element elem) method the empty tag rendering could
be extended to check how to render empty tags:

// customization of closing elements rendering for HTML5
if (isSelfClosingElement(elem))
{
	_printer.printText("/>");
}
else
{
	_printer.printText("></");
	_printer.printText(elem.getTagName());
	_printer.printText(">");
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org


Mime
View raw message