Support "trim" attribute at the element. It is an optional attribute and is defaulted to true (i.e. trimmable).

This commit is contained in:
Elaine Tan 2013-11-14 12:39:44 +08:00
parent d421ce00e2
commit b9c3f19c84
1 changed files with 6 additions and 2 deletions

View File

@ -301,8 +301,12 @@ public class PackInHandler extends DefaultHandler {
{ {
if (e.contents.toString().length() != e.contents.toString().trim().length()) if (e.contents.toString().length() != e.contents.toString().trim().length())
{ {
String s = e.contents.toString().trim(); String trim = e.attributes.getValue("trim");
e.contents = new StringBuffer(s); if (!(trim != null && trim.equals("false")))
{
String s = e.contents.toString().trim();
e.contents = new StringBuffer(s);
}
} }
} }
if (stack.isEmpty()) if (stack.isEmpty())