[jsword-devel] jdom removal

Martin Denham mjdenham at gmail.com
Tue Sep 4 04:42:14 MST 2012


Douglas, here is a quick overview of And Bible's approach:

And Bible gets the raw content of a page from the book by using
OsisInputStream<https://github.com/mjdenham/and-bible/blob/master/AndBible/src/net/bible/service/format/OSISInputStream.java>,
and feeds it into an
OsisToHtmlSaxHandler<https://github.com/mjdenham/and-bible/blob/master/AndBible/src/net/bible/service/format/osistohtml/OsisToHtmlSaxHandler.java>that
converts OSIS tags to HTML and any other changes required.
 Controlling logic is in
SwordContentFacade<https://github.com/mjdenham/and-bible/blob/master/AndBible/src/net/bible/service/sword/SwordContentFacade.java>
in
the readHtmlTextOptimizedZTextOsis(Book book, Key key) method.

To improve performance there is no DOM tree created in the above process.
 All xml manipulation is done in the SAX handler or helper classes.  This
approach might be a bit lightweight for a general framework like JSword but
worked well for And Bible's requirements.

And Bible does not use the optimised approach for non-OSIS documents for
which the XXXFilter classes, e.g. GBFFilter, in JSword are required to
convert the XXX format to OSIS tags.  And Bible's approach could be
extended to chain together SAX Filters to incorporate the code in XXXFilter
classes.

I have never used StAX but have been googling to find if Woodstox is
supported on Android and can find nothing - anybody?

Chris, most JSword users seem to use xslt so that would need to be
supported but doesn't xslt merely require an InputSource rather than a full
DOM tree.

Martin

On 4 September 2012 10:26, Chris Burrell <chris at burrell.me.uk> wrote:

> To put in a argument for the other side, I use quite a few xslts to
> transform the XML to HTML directly. I have a few highly-paremeterized
>  stylesheets to allow for lots of cool displays. Given I'm developing
> mainly a webapp in a browser, running the XSL on the server and outputting
> straight HTML is a big win for us.
>
> Chris
>
>
> On 4 September 2012 10:15, Joe Walker <joe at eireneh.com> wrote:
>
>>
>> Sigh - I think the document model in JSword is one of the things I most
>> consistently got wrong. If I remember correctly we started with a standard
>> API, then JAXB then JDOM.
>> At the time XML seemed like The Future, however there seems to be more
>> and more that argues against that vision for JSword:
>> - Android display works around the JSword API to avoid XML
>> - Swing uses the horribly broken JEditorPane (?) and its display is
>> probably the worse for it
>> - Even using XML for JSword on the web, which should be a sweet spot, has
>> (had?) problems like getting reliable XSLT in browsers.
>>
>> We're going to need some sort of document object model, and given the
>> existence of OSIS, some sort of ability to serialise it to XML makes some
>> sense, but perhaps we should consider an object model that is somewhat
>> closer to the storage model than the display model.
>>
>> Joe.
>>
>> On 3 Sep 2012, at 22:20, DM Smith <dmsmith at crosswire.org> wrote:
>>
>> Looks like from your notes that there is more opportunity than just
>> replacing JDOM, but rather not building a DOM at all. Maybe you and Douglas
>> can collaborate?
>>
>> In Him,
>> DM
>>
>> On Sep 3, 2012, at 11:25 AM, Martin Denham <mjdenham at gmail.com> wrote:
>>
>> It would be good to remove JDOM.  When working on the first versions of
>> And Bible I had to bypass the JDOM DOM creation to improve performance on
>> low powered Android devices, but my simple workaround only worked for
>> simple, well structured OSIS bibles.
>>
>> I made a few rough notes<http://code.google.com/p/and-bible/wiki/AmendmentsToJSwordForAndroid> on
>> it at the time.
>>
>> I don't think Android includes a StAX library, but it does include a
>> similar efficient XML Pull library and it would probably be possible to
>> include a StAX library with And Bible.  I could do some investigation and
>> experiments if this approach was seriously under consideration.
>>
>> Martin
>>
>> On 3 September 2012 15:35, Douglas Campos <qmx at qmx.me> wrote:
>>
>>> Howdy!
>>>
>>> I was talking with DM wrt removing jdom and using org.w3c.* APIs instead
>>> (more portable, less deps), and he asked me to post it here :)
>>>
>>> Any objections? (I'm assuming I'll fix BD too)
>>>
>>> Blessings,
>>> -- qmx
>>>
>>>
>>> _______________________________________________
>>> jsword-devel mailing list
>>> jsword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>>
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20120904/b773a3da/attachment-0001.html>


More information about the jsword-devel mailing list