[jsword-svn] r1939 - trunk/jsword/src/main/java/org/crosswire/jsword/book
dmsmith at crosswire.org
dmsmith at crosswire.org
Sat Mar 21 09:09:14 MST 2009
Author: dmsmith
Date: 2009-03-21 09:09:14 -0700 (Sat, 21 Mar 2009)
New Revision: 1939
Modified:
trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
Log:
Fixed a bug getting canonical text out of an empty element, e.g. <p/>
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java 2009-03-21 16:06:18 UTC (rev 1938)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java 2009-03-21 16:09:14 UTC (rev 1939)
@@ -850,10 +850,11 @@
else if (data instanceof Text)
{
// make sure that adjacent text elements are separated by whitespace
+ // Empty elements also produce whitespace.
// TODO(dms): verify that the xml parser does not split words containing entities.
int lastIndex = buffer.length() - 1;
String text = ((Text) data).getText();
- if (lastIndex >= 0 && !Character.isWhitespace(buffer.charAt(lastIndex)) && !Character.isWhitespace(text.charAt(0)))
+ if (lastIndex >= 0 && !Character.isWhitespace(buffer.charAt(lastIndex)) && (text.length() == 0 || !Character.isWhitespace(text.charAt(0))))
{
buffer.append(' ');
}
More information about the jsword-svn
mailing list