<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>So, I wonder had a simple object model been available at the time, which would have been easier:</div><div>1. Create a SAX stream converter to change from OSIS/SAX to HTML/SAX</div><div>2. Create an object model converter to change from a simple lightweight OSIS model to an HTML DOM [1]</div><div><br></div><div>My guess is that 2 would be easier to write and maintain, but that 1 would win in using less memory.</div><div>Does this sound reasonable?</div><div>Even if this is true, having done the hard work of 1, we don't have a strong case for 2 to help And Bible.</div><div><br></div><div>Joe.</div><div><br></div><div>[1] I'm not even sure that you can manipulate an HTML DOM in Java in Android, but I'm sure there must be some method of passing data to a WebView and then manipulating it.</div><div><br></div><div><div>On 10 Sep 2012, at 12:22, Martin Denham <<a href="mailto:mjdenham@gmail.com">mjdenham@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Joe,<div><br></div><div>And Bible does use html. The main ui control which displays module text is a WebView which is essentially a cut-down version of Chrome. So 2. (a lightweight object model) might not be required.</div>
<div><br></div><div>And Bible had performance and memory problems at the start so I tried to:</div><div><ol><li>replace the DOM with a verse-by-verse InputStream/Source to relieve the app of multiple instances of a whole page being created in different formats - to reduce memory use</li>
<li>use SAX instead of xslt, moving any required xml manipulation code here from DOM handlers - to improve speed</li></ol><div>The Streaming in 1. was only partially successful as I could not stream the whole process and I only got as far as handling ztext osis modules..</div>
</div>
<div>The SAX 2. seemed to work pretty well. The OSIS2HtmlSaxHandler still isn't as mature as the xslt I have seen but apart from being faster allows me to stay working in Java.</div><div>The above and other small performance fixes allowed And Bible to be usable on my old G1.</div>
<div><br></div><div>I could expand what I did although I haven't made any major changes to that code for a couple of years. However, my approach was bottom-up and it could benefit from a top-down design based approach by somebody more familiar with JSword.</div>
<div><br></div><div>Best regards</div><div>Martin</div><div><br><div class="gmail_quote">On 9 September 2012 08:50, Joe Walker <span dir="ltr"><<a href="mailto:joe@eireneh.com" target="_blank">joe@eireneh.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>I've not looked at the AndBible source, but I was under the impression that you were not using HTML as a view layer. If it's true that no-one uses anything but HTML as a view layer then there isn't much call for 2.</div>
<div><br></div><div>My logic behind 2 was - If your display is very simple, then the rendering process goes - Read from disk, extract text from markup, word-wrap and apply other trivial bits of formatting, draw to screen.</div>
<div><br></div><div>Compare the process with SAX/OSIS->HTML: Read from disk, parse to create event stream, inside XSTL engine, create internal DOM, apply transform from XSTL stylesheet to create another external DOM, pass to HTML engine which constructs render tree from second DOM and reads CSS stylesheet to create a CSS object model, which informs the layout engine how to draw the render tree, draw to screen.</div>
<div><br></div><div>I'm emotionally attached to AndBible having contributed to it in some small way, but for me what makes it *much* better than YouVersion is speed. I have a hope of keeping up with a speaker and a chain of references with AndBible and not with YouVersion.</div>
<span><font color="#888888"><div><br></div><div>Joe.</div></font></span><div><div><br></div><br><div><div>On 8 Sep 2012, at 22:56, Martin Denham <<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>> wrote:</div>
<br><blockquote type="cite">So 1. would be an optimized version of what now exists which sounds good.<div><br></div><div>But 2. would be a new interface, wouldn't it. I can't think when it would be used. Might it not just add complexity.</div>
<div><br></div><div>Martin<br><br><div class="gmail_quote">On 5 September 2012 17:41, Joe Walker <span dir="ltr"><<a href="mailto:joe@eireneh.com" target="_blank">joe@eireneh.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>So I think I was arguing that there should be 2 ways to get data out [1]:</div><div>1. OSIS/SAX or (OSIS/StAX)</div><div>2. A lightweight object model</div><div><br></div>
<div>The advantage of 1 is that it serialises to HTML well, and is lean on memory. It would be the job of the stream consumer to decide how to use up memory. The advantage of 2 would be simple fast access without any XML overhead.</div>
<div>I would imagine that anyone using HTML as a layout system would pipe the SAX into an XSLT parser, and that anyone doing layout themselves would use the lightweight object model.</div><div><br></div><div>Joe.</div><div>
<br></div><div>[1] Actually I'm not sure that I'd got as far as saying how I thought it should be, more that I'd consistently got it wrong ;-)</div><div><div><br></div><br><div><div>On 4 Sep 2012, at 15:32, DM Smith <<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>> wrote:</div>
<br><blockquote type="cite"><div style="word-wrap:break-word">I don't see it that way. I like the transformation to OSIS as an intermediate form and then to HTML.<div><br></div><div>The only problems I see are the creation of the DOM as objects. If SAX or StAX could be the interface, then we'd be able to have a lighter process.<div>
<br></div><div>DM</div><div><br><div><div>On Sep 4, 2012, at 5:15 AM, Joe Walker <<a href="mailto:joe@eireneh.com" target="_blank">joe@eireneh.com</a>> wrote:</div><br><blockquote type="cite"><div style="word-wrap:break-word">
<div><br></div><div>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.</div><div>At the time XML seemed like The Future, however there seems to be more and more that argues against that vision for JSword:</div>
<div>- Android display works around the JSword API to avoid XML</div><div>- Swing uses the horribly broken JEditorPane (?) and its display is probably the worse for it</div><div>- Even using XML for JSword on the web, which should be a sweet spot, has (had?) problems like getting reliable XSLT in browsers.</div>
<div><br></div><div>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.</div>
<div><br></div><div>Joe.</div><br><div><div>On 3 Sep 2012, at 22:20, DM Smith <<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>> wrote:</div><br><blockquote type="cite"><div style="word-wrap:break-word">
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?<div><br></div><div>In Him,</div><div><span style="white-space:pre-wrap">        </span>DM</div>
<div><br><div><div>On Sep 3, 2012, at 11:25 AM, Martin Denham <<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>> wrote:</div><br><blockquote type="cite">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.<div>
<br></div><div>I made a <a href="http://code.google.com/p/and-bible/wiki/AmendmentsToJSwordForAndroid" target="_blank">few rough notes</a> on it at the time.</div><div><br></div><div>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.</div>
<div><br></div><div>Martin</div><br><div class="gmail_quote">On 3 September 2012 15:35, Douglas Campos <span dir="ltr"><<a href="mailto:qmx@qmx.me" target="_blank">qmx@qmx.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Howdy!<br>
<br>
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 :)<br>
<br>
Any objections? (I'm assuming I'll fix BD too)<br>
<br>
Blessings,<br>
-- qmx<br>
<br>
<br>
_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br>
_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div></div>_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div>_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div></div></div>_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div></div><br>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div></div><br>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org">jsword-devel@crosswire.org</a><br>http://www.crosswire.org/mailman/listinfo/jsword-devel<br></blockquote></div><br></body></html>