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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to