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

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