use the correct definition of whitespace (XML instead of Java)
We use the defintion according to the W3C recommendation
(http://www.w3.org/TR/REC-xml/#NT-S) instead of the Java definition
(Character.isWhitespace()).
Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/XML.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/XML.java
index 25967a9..31f3828 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/XML.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/XML.java
@@ -44,7 +44,7 @@
return c == 0x20 || c == 0x9 || c == 0xD || c == 0xA;
}
- public static Pattern XML_WHITESPACE_PATTERN = Pattern.compile("[\\u0020\\u0009\\u000d\\u000a]");
+ public static final Pattern XML_WHITESPACE_PATTERN = Pattern.compile("[\\u0020\\u0009\\u000d\\u000a]");
/**
* Replace runs of XML whitespace (see {@link #isWhitespace}) with a single space. Newlines in the input should be
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/CharSequenceSplitter.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/CharSequenceSplitter.java
index 4068de3..d96f9d3 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/CharSequenceSplitter.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/CharSequenceSplitter.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.vex.core.internal.boxes;
+import org.eclipse.vex.core.XML;
import org.eclipse.vex.core.internal.core.Graphics;
/**
@@ -104,7 +105,7 @@
}
private boolean isSplittingCharacter(final int position) {
- return Character.isWhitespace(charAt(position));
+ return XML.isWhitespace(charAt(position));
}
}
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/core/TextUtils.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/core/TextUtils.java
index 0a4f4a1..0ac3710 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/core/TextUtils.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/core/TextUtils.java
@@ -12,6 +12,8 @@
import java.util.regex.Pattern;
+import org.eclipse.vex.core.XML;
+
public class TextUtils {
private static final Pattern ANY_LINE_BREAKS = Pattern.compile("(\r\n|\r|\n)");
@@ -19,7 +21,7 @@
public static int countWhitespaceAtStart(final String text) {
int whitespaceCount = 0;
while (whitespaceCount < text.length()) {
- if (Character.isWhitespace(text.charAt(whitespaceCount))) {
+ if (XML.isWhitespace(text.charAt(whitespaceCount))) {
whitespaceCount += 1;
} else {
break;
@@ -32,7 +34,7 @@
int whitespaceCount = 0;
while (whitespaceCount < text.length()) {
final int i = text.length() - 1 - whitespaceCount;
- if (Character.isWhitespace(text.charAt(i))) {
+ if (XML.isWhitespace(text.charAt(i))) {
whitespaceCount += 1;
} else {
break;