[jsword-devel] Java, XML and SMP

DM Smith dmsmith at crosswire.org
Sat Apr 9 13:23:26 MST 2016

I was debugging a JSword problem with OSIS documents having SMP Unicode characters. (These are characters that have more than two bytes in UTF-8.)

The character was a “speech balloon” and was used for a note marker (i.e. n attribute value on note, <note n=“marker”>). The first occurrence it was rendered once, the second occurrence 2x and so forth. It wasn’t limited to the chapter, but the number of times the character was seen since starting the app.

I traced it the embedded Xalan XML parser embedded in Java. The trouble is that the embedded version is quite old. Even in Java 8. Replacing it with the latest from Apache (also did Xerces) and other dependencies fixed the problem.

This was found in STEP and Bible Desktop, which use Java from Oracle. It may or may not be a problem in Android.

Here is what the Apache Xalan FAQ says to override the embedded version:
> To use a newer version of Xalan-Java and override the one packaged with the JDK:
> use the Endorsed Standards Override Mechanism <http://java.sun.com/j2se/1.4.2/docs/guide/standards/>. Place the xalan.jar, serializer.jar, xercesImpl.jar and xml-apis.jar in the <java-home>\lib\endorsed directory, where <java-home> is where the runtime software is installed.
Here is the page that discusses the Endorsed Standards Override Mechanism:

Note: Project Jigsaw will provide a different mechanism in Java 9.

There are a couple of ways to do this depending on whether you are embedding Java in your “app”, using a web server or using Java provided by the end user.

In the last case, you put the 4 jars mentioned above into the same directory as your other jars and add to the command line the following flag:

Hope this helps.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20160409/216a3dac/attachment.html>

More information about the jsword-devel mailing list