[jsword-svn] r1932 - in trunk/jsword/src/main/java/org/crosswire/jsword/book: . basic filter/gbf filter/thml sword

dmsmith at crosswire.org dmsmith at crosswire.org
Mon Feb 23 20:12:33 MST 2009


Author: dmsmith
Date: 2009-02-23 20:12:33 -0700 (Mon, 23 Feb 2009)
New Revision: 1932

Added:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbbrTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/QTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/STag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SkipTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/VerseTag.java
Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AnonymousTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BigTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SubTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/DataEntry.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java
Log:
improved ThML handling

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -140,6 +140,11 @@
     public static final String SEG_JUSTIFYRIGHT = "text-align: right;"; //$NON-NLS-1$
 
     /**
+     * Constant to help narrow down what we use seg for. In this case the justify right tag
+     */
+    public static final String SEG_JUSTIFYLEFT = "text-align: left;"; //$NON-NLS-1$
+
+    /**
      * Constant to help narrow down what we use seg for. In this case the thml center tag
      */
     public static final String SEG_CENTER = "text-align: center;"; //$NON-NLS-1$
@@ -242,6 +247,7 @@
     public static final String CELL_ALIGN_START = "start"; //$NON-NLS-1$
     public static final String CELL_ALIGN_END = "end"; //$NON-NLS-1$
 
+    public static final String OSIS_ELEMENT_ABBR = "abbr"; //$NON-NLS-1$
     public static final String OSIS_ELEMENT_TITLE = "title"; //$NON-NLS-1$
     public static final String OSIS_ELEMENT_TABLE = "table"; //$NON-NLS-1$
     public static final String OSIS_ELEMENT_SPEECH = "speech"; //$NON-NLS-1$
@@ -286,6 +292,7 @@
     public static final String OSIS_ATTR_REF = "osisRef"; //$NON-NLS-1$
     public static final String OSIS_ATTR_LEVEL = "level"; //$NON-NLS-1$
     public static final String ATTRIBUTE_SPEAKER_WHO = "who"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_Q_WHO = "who"; //$NON-NLS-1$
     public static final String ATTRIBUTE_W_MORPH = "morph"; //$NON-NLS-1$
     public static final String ATTRIBUTE_OSISTEXT_OSISIDWORK = "osisIDWork"; //$NON-NLS-1$
     // OSIS defines the lang attribute as the one from the xml namespace
@@ -331,13 +338,21 @@
     public static class OSISFactory
     {
         /**
-         *
-         */
-        public Element createSeg()
-        {
-            return new Element(OSIS_ELEMENT_SEG);
-        }
+        *
+        */
+       public Element createAbbr()
+       {
+           return new Element(OSIS_ELEMENT_ABBR);
+       }
 
+       /**
+       *
+       */
+      public Element createSeg()
+      {
+          return new Element(OSIS_ELEMENT_SEG);
+      }
+
         /**
          *
          */

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -154,24 +154,32 @@
         Iterator sit = OSISUtil.getFragment(bdata.getOsisFragment()).iterator();
         while (sit.hasNext())
         {
-            Element div = (Element) sit.next();
-
-            // For all of the Verses in the section
-            for (Iterator vit = div.getContent().iterator(); vit.hasNext(); )
+            Object nextElem = sit.next();
+            if (nextElem instanceof Element)
             {
-                Object data = vit.next();
-                if (data instanceof Element)
-                {
-                    Element overse = (Element) data;
-                    String text = OSISUtil.getPlainText(overse);
+                Element div = (Element) nextElem;
 
-                    setRawText(key, text);
-                }
-                else
+                // For all of the Verses in the section
+                for (Iterator vit = div.getContent().iterator(); vit.hasNext(); )
                 {
-                    log.error("Ignoring non OSIS/Verse content of DIV."); //$NON-NLS-1$
+                    Object data = vit.next();
+                    if (data instanceof Element)
+                    {
+                        Element overse = (Element) data;
+                        String text = OSISUtil.getPlainText(overse);
+    
+                        setRawText(key, text);
+                    }
+                    else
+                    {
+                        log.error("Ignoring non OSIS/Verse content of DIV."); //$NON-NLS-1$
+                    }
                 }
             }
+            else
+            {
+                log.error("Ignoring non OSIS/Verse content of DIV."); //$NON-NLS-1$
+            }
         }
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -92,12 +92,9 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element hi = OSIS_FACTORY.createHI();
-            hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_BOLD);
-
-            Element current = (Element) stack.get(0);
-            current.addContent(hi);
-            stack.addFirst(hi);
+            Element ele = OSIS_FACTORY.createHI();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_BOLD);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -116,22 +113,19 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element seg = OSIS_FACTORY.createReference();
+            Element ele = OSIS_FACTORY.createReference();
 
             String refstr = getName().substring(2);
             try
             {
                 Passage ref = (Passage) KEY_FACTORY.getKey(refstr);
-                seg.setAttribute(OSISUtil.OSIS_ATTR_REF, ref.getOsisRef());
+                ele.setAttribute(OSISUtil.OSIS_ATTR_REF, ref.getOsisRef());
             }
             catch (NoSuchKeyException ex)
             {
                 DataPolice.report("unable to parse reference: " + refstr); //$NON-NLS-1$
             }
-
-            Element current = (Element) stack.get(0);
-            current.addContent(seg);
-            stack.addFirst(seg);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -154,17 +148,19 @@
         public void updateOsisStack(LinkedList stack)
         {
 
+            Element p = OSIS_FACTORY.createLB();
             if (stack.size() == 0)
             {
-                Element p = OSIS_FACTORY.createLB();
                 stack.addFirst(p);
-                // log.warn("failing to add to element on empty stack");
             }
             else
             {
-                Element p = OSIS_FACTORY.createP();
-                Element ele = (Element) stack.get(0);
-                ele.addContent(p);
+                Content top = (Content) stack.get(0);
+                if (top instanceof Element)
+                {
+                    Element current = (Element) top;
+                    current.addContent(p);
+                }
             }
         }
     }
@@ -187,12 +183,9 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element current = (Element) stack.get(0);
-            Element note = OSIS_FACTORY.createNote();
-            note.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.NOTETYPE_STUDY);
-
-            current.addContent(note);
-            stack.addFirst(note);
+            Element ele = OSIS_FACTORY.createNote();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.NOTETYPE_STUDY);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -221,8 +214,12 @@
 
                 if (note.getContentSize() < 1)
                 {
-                    Element ele = (Element) stack.get(0);
-                    ele.removeContent(note);
+                    Content top = (Content) stack.get(0);
+                    if (top instanceof Element)
+                    {
+                        Element ele = (Element) top;
+                        ele.removeContent(note);
+                    }
                 }
             }
             else
@@ -250,11 +247,7 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element title = OSIS_FACTORY.createTitle();
-
-            Element current = (Element) stack.get(0);
-            current.addContent(title);
-            stack.addFirst(title);
+            GBFTags.updateOsisStack(stack, OSIS_FACTORY.createTitle());
         }
     }
 
@@ -297,12 +290,9 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element hi = OSIS_FACTORY.createHI();
-            hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_ITALIC);
-
-            Element current = (Element) stack.get(0);
-            current.addContent(hi);
-            stack.addFirst(hi);
+            Element ele = OSIS_FACTORY.createHI();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_ITALIC);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -324,13 +314,10 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            // LATER(joe): is div the right thing?
-            Element seg = OSIS_FACTORY.createSeg();
-            seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.SEG_JUSTIFYRIGHT);
-
-            Element current = (Element) stack.get(0);
-            current.addContent(seg);
-            stack.addFirst(seg);
+            // LATER(joe): is seg the right thing?
+            Element ele = OSIS_FACTORY.createSeg();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.SEG_JUSTIFYRIGHT);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -352,6 +339,9 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
+            Element ele = OSIS_FACTORY.createSeg();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.SEG_JUSTIFYLEFT);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -373,11 +363,7 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element q = OSIS_FACTORY.createQ();
-
-            Element current = (Element) stack.get(0);
-            current.addContent(q);
-            stack.addFirst(q);
+            GBFTags.updateOsisStack(stack, OSIS_FACTORY.createQ());
         }
     }
 
@@ -408,8 +394,12 @@
             else
             {
                 Element p = OSIS_FACTORY.createP();
-                Element ele = (Element) stack.get(0);
-                ele.addContent(p);
+                Content top = (Content) stack.get(0);
+                if (top instanceof Element)
+                {
+                    Element current = (Element) top;
+                    current.addContent(p);
+                }
             }
         }
     }
@@ -432,12 +422,7 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            // LATER(joe): is speech the right thing?
-            Element speech = OSIS_FACTORY.createLG();
-
-            Element current = (Element) stack.get(0);
-            current.addContent(speech);
-            stack.addFirst(speech);
+            GBFTags.updateOsisStack(stack, OSIS_FACTORY.createLG());
         }
     }
 
@@ -459,11 +444,7 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element title = OSIS_FACTORY.createTitle();
-
-            Element current = (Element) stack.get(0);
-            current.addContent(title);
-            stack.addFirst(title);
+            GBFTags.updateOsisStack(stack, OSIS_FACTORY.createTitle());
         }
     }
 
@@ -485,12 +466,9 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element speaker = OSIS_FACTORY.createSpeaker();
-            speaker.setAttribute(OSISUtil.ATTRIBUTE_SPEAKER_WHO, Msg.NAME_JESUS.toString());
-
-            Element current = (Element) stack.get(0);
-            current.addContent(speaker);
-            stack.addFirst(speaker);
+            Element ele = OSIS_FACTORY.createQ();
+            ele.setAttribute(OSISUtil.ATTRIBUTE_Q_WHO, Msg.NAME_JESUS.toString());
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -511,44 +489,48 @@
         {
             String name = getName().trim();
 
-            Element ele = (Element) stack.get(0);
-            int size = ele.getContentSize();
-            if (size == 0)
+            Content top = (Content) stack.get(0);
+            if (top instanceof Element)
             {
-                DataPolice.report("No content to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
-                return;
-            }
+                Element ele = (Element) top;
+                int size = ele.getContentSize();
+                if (size == 0)
+                {
+                    DataPolice.report("No content to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
+                    return;
+                }
 
-            int lastIndex = size - 1;
-            Content prevObj = ele.getContent(lastIndex);
-            Element word = null;
+                int lastIndex = size - 1;
+                Content prevObj = ele.getContent(lastIndex);
+                Element word = null;
 
-            if (prevObj instanceof Text)
-            {
-                word = OSIS_FACTORY.createW();
-                ele.removeContent(prevObj);
-                word.addContent(prevObj);
-                ele.addContent(word);
-            }
-            else if (prevObj instanceof Element)
-            {
-                word = (Element) prevObj;
-            }
-            else
-            {
-                DataPolice.report("No words to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
-                return;
-            }
+                if (prevObj instanceof Text)
+                {
+                    word = OSIS_FACTORY.createW();
+                    ele.removeContent(prevObj);
+                    word.addContent(prevObj);
+                    ele.addContent(word);
+                }
+                else if (prevObj instanceof Element)
+                {
+                    word = (Element) prevObj;
+                }
+                else
+                {
+                    DataPolice.report("No words to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
+                    return;
+                }
 
-            String existingMorph = word.getAttributeValue(OSISUtil.ATTRIBUTE_W_MORPH);
-            StringBuffer newMorph = new StringBuffer();
+                String existingMorph = word.getAttributeValue(OSISUtil.ATTRIBUTE_W_MORPH);
+                StringBuffer newMorph = new StringBuffer();
 
-            if (existingMorph != null && existingMorph.length() > 0)
-            {
-                newMorph.append(existingMorph).append('|');
+                if (existingMorph != null && existingMorph.length() > 0)
+                {
+                    newMorph.append(existingMorph).append('|');
+                }
+                newMorph.append(OSISUtil.MORPH_STRONGS).append(name.substring(2));
+                word.setAttribute(OSISUtil.ATTRIBUTE_W_MORPH, newMorph.toString());
             }
-            newMorph.append(OSISUtil.MORPH_STRONGS).append(name.substring(2));
-            word.setAttribute(OSISUtil.ATTRIBUTE_W_MORPH, newMorph.toString());
         }
     }
 
@@ -572,46 +554,50 @@
         {
             String name = getName().trim();
 
-            Element ele = (Element) stack.get(0);
-            int size = ele.getContentSize();
-            if (size == 0)
+            Content top = (Content) stack.get(0);
+            if (top instanceof Element)
             {
-                DataPolice.report("No content to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
-                return;
-            }
+                Element ele = (Element) top;
+                int size = ele.getContentSize();
+                if (size == 0)
+                {
+                    DataPolice.report("No content to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
+                    return;
+                }
 
-            int lastIndex = size - 1;
-            Content prevObj = ele.getContent(lastIndex);
-            Element word = null;
+                int lastIndex = size - 1;
+                Content prevObj = ele.getContent(lastIndex);
+                Element word = null;
 
-            if (prevObj instanceof Text)
-            {
-                Text textItem = (Text) prevObj;
-                word = OSIS_FACTORY.createW();
-                ele.removeContent(textItem);
-                word.addContent(textItem);
-                ele.addContent(word);
-            }
-            else if (prevObj instanceof Element)
-            {
-                word = (Element) prevObj;
-            }
-            else
-            {
-                DataPolice.report("No words to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
-                return;
-            }
+                if (prevObj instanceof Text)
+                {
+                    Text textItem = (Text) prevObj;
+                    word = OSIS_FACTORY.createW();
+                    ele.removeContent(textItem);
+                    word.addContent(textItem);
+                    ele.addContent(word);
+                }
+                else if (prevObj instanceof Element)
+                {
+                    word = (Element) prevObj;
+                }
+                else
+                {
+                    DataPolice.report("No words to attach word to: <" + name + ">."); //$NON-NLS-1$ //$NON-NLS-2$
+                    return;
+                }
 
-            String existingLemma = word.getAttributeValue(OSISUtil.ATTRIBUTE_W_LEMMA);
-            StringBuffer newLemma = new StringBuffer();
+                String existingLemma = word.getAttributeValue(OSISUtil.ATTRIBUTE_W_LEMMA);
+                StringBuffer newLemma = new StringBuffer();
 
-            if (existingLemma != null && existingLemma.length() > 0)
-            {
-                newLemma.append(existingLemma).append('|');
-            }
+                if (existingLemma != null && existingLemma.length() > 0)
+                {
+                    newLemma.append(existingLemma).append('|');
+                }
 
-            newLemma.append(OSISUtil.LEMMA_STRONGS).append(name.substring(2));
-            word.setAttribute(OSISUtil.ATTRIBUTE_W_LEMMA, newLemma.toString());
+                newLemma.append(OSISUtil.LEMMA_STRONGS).append(name.substring(2));
+                word.setAttribute(OSISUtil.ATTRIBUTE_W_LEMMA, newLemma.toString());
+            }
         }
     }
 
@@ -633,12 +619,9 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element note = OSIS_FACTORY.createNote();
-            note.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.NOTETYPE_STUDY);
-
-            Element current = (Element) stack.get(0);
-            current.addContent(note);
-            stack.addFirst(note);
+            Element ele = OSIS_FACTORY.createNote();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.NOTETYPE_STUDY);
+            GBFTags.updateOsisStack(stack, ele);
         }
     }
 
@@ -666,8 +649,12 @@
             }
             else
             {
-                Element ele = (Element) stack.get(0);
-                ele.addContent(getName());
+                Content top = (Content) stack.get(0);
+                if (top instanceof Element)
+                {
+                    Element ele = (Element) top;
+                    ele.addContent(getName());
+                }
             }
         }
     }
@@ -690,11 +677,7 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element title = OSIS_FACTORY.createTitle();
-
-            Element current = (Element) stack.get(0);
-            current.addContent(title);
-            stack.addFirst(title);
+            GBFTags.updateOsisStack(stack, OSIS_FACTORY.createTitle());
         }
     }
 
@@ -716,12 +699,20 @@
          */
         public void updateOsisStack(LinkedList stack)
         {
-            Element hi = OSIS_FACTORY.createHI();
-            hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_UNDERLINE);
+            Element ele = OSIS_FACTORY.createHI();
+            ele.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_UNDERLINE);
+            GBFTags.updateOsisStack(stack, ele);
+        }
+    }
 
-            Element current = (Element) stack.get(0);
-            current.addContent(hi);
-            stack.addFirst(hi);
+    /* private */ static void updateOsisStack(LinkedList stack, Content content)
+    {
+        Content top = (Content) stack.get(0);
+        if (top instanceof Element)
+        {
+            Element current = (Element) top;
+            current.addContent(content);
+            stack.addFirst(content);
         }
     }
 

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbbrTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbbrTag.java	                        (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbbrTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -0,0 +1,60 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: CenterTag.java 1466 2007-07-02 02:48:09Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.crosswire.jsword.book.OSISUtil;
+import org.jdom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * THML Tag to process the abbr element.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class AbbrTag extends AbstractTag
+{
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
+     */
+    public String getTagName()
+    {
+        return "abbr"; //$NON-NLS-1$
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
+     */
+    /* @Override */
+    public Element processTag(Element ele, Attributes attrs)
+    {
+        Element seg = OSISUtil.factory().createAbbr();
+
+        if (ele != null)
+        {
+            ele.addContent(seg);
+        }
+
+        return seg;
+    }
+}

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AnonymousTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AnonymousTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AnonymousTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -26,8 +26,7 @@
 import org.xml.sax.Attributes;
 
 /**
- * THML Tag to process the pos element.
- * (Part of speech)
+ * THML Tag to process an element that does not map to OSIS.
  *
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BigTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BigTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BigTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -26,7 +26,7 @@
 import org.xml.sax.Attributes;
 
 /**
- * THML Tag to process the center element.
+ * THML Tag to process the big element.
  *
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -26,7 +26,7 @@
 import org.xml.sax.Attributes;
 
 /**
- * THML Tag to process the blockquote element.
+ * THML Tag to process the citation element.
  *
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -76,7 +76,7 @@
 
             if (top instanceof Element) // It might be a text element
             {
-                ele = (Element) stack.getFirst();
+                ele = (Element) top;
 
                 // If the element and its descendants are to be ignored
                 // then there is a null element on the stack
@@ -111,33 +111,43 @@
         }
 
         // What we are adding to
-        Element current = (Element) stack.getFirst();
+        Content top = (Content) stack.getFirst();
 
         // If the element and its descendants are to be ignored
         // then there is a null element on the stack
-        if (current == null)
+        if (top == null)
         {
             return;
         }
 
-        int size = current.getContentSize();
+        if (top instanceof Text)
+        {
+            ((Text) top).append(text);
+            return;
+        }
 
-        // If the last element in the list is a string then we should add
-        // this string on to the end of it rather than add a new list item
-        // because (probably as an atrifact of the HTML/XSL transform we get
-        // a space inserted in the output even when 2 calls to this method
-        // split a word.
-        if (size > 0)
+        if (top instanceof Element)
         {
-            Content last = current.getContent(size - 1);
-            if (last instanceof Text)
+            Element current = (Element) top;
+
+            int size = current.getContentSize();
+
+            // If the last element in the list is a string then we should add
+            // this string on to the end of it rather than add a new list item
+            // because (probably as an artifact of the HTML/XSL transform we get
+            // a space inserted in the output even when 2 calls to this method
+            // split a word.
+            if (size > 0)
             {
-                current.removeContent(size - 1);
-                text = ((Text) last).getText() + text;
+                Content last = current.getContent(size - 1);
+                if (last instanceof Text)
+                {
+                    ((Text) last).append(text);
+                    return;
+                }
             }
+            current.addContent(new Text(text));
         }
-
-        current.addContent(new Text(text));
     }
 
     /* (non-Javadoc)
@@ -152,19 +162,23 @@
         }
         // When we are done processing an element we need to remove
         // it from the stack so that nothing more is attached to it.
-        Element finished = (Element) stack.removeFirst();
-        Tag t = getTag(localname, qname);
-
-        if (t != null)
+        Content top = (Content) stack.removeFirst();
+        if (top instanceof Element)
         {
-            t.processContent(finished);
-        }
+            Element finished = (Element) top;
+            Tag t = getTag(localname, qname);
 
-        // If it was the last element then it was the root element
-        // so save it
-        if (stack.size() == 0)
-        {
-            rootElement = finished;
+            if (t != null)
+            {
+                t.processContent(finished);
+            }
+
+            // If it was the last element then it was the root element
+            // so save it
+            if (stack.size() == 0)
+            {
+                rootElement = finished;
+            }
         }
     }
 
@@ -187,6 +201,10 @@
             if (t == null)
             {
                 log.warn("In " + book.getInitials() + "(" + key.getName() + ") unknown thml element: " + localname + " qname=" + qname); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+                // Report on it only once and make sure the content is output.
+                t = new AnonymousTag(qname);
+                TAG_MAP.put(qname, t);
                 return t;
             }
 
@@ -222,142 +240,131 @@
     private static final Map TAG_MAP = new HashMap();
 
     static {
+        /* ThML is based upon Voyager XHTML and all Voyager elements are allowed.
+         * However not all elements make sense.
+         */
         Tag[] tags = new Tag[]
         {
+            // The following are defined in Voyager xhtml 4.0
             new ATag(),
+            new AbbrTag(),
+            new AliasTag("acronym", new AbbrTag()), //$NON-NLS-1$
+            new AnonymousTag("address"), //$NON-NLS-1$
+            new SkipTag("applet"), //$NON-NLS-1$
+            new SkipTag("area"), //$NON-NLS-1$
+            new BTag(),
+            new SkipTag("base"), //$NON-NLS-1$
+            new SkipTag("basefont"), //$NON-NLS-1$
+            new IgnoreTag("bdo"), //$NON-NLS-1$
+            new BigTag(),
             new BlockquoteTag(),
+            new IgnoreTag("body"), //$NON-NLS-1$
             new BrTag(),
-            new BTag(),
-            new BigTag(),
+            new SkipTag("button"), //$NON-NLS-1$
+            new AnonymousTag("caption"), //$NON-NLS-1$
             new CenterTag(),
-            new CitationTag(),
-            new ColTag(),
+            new AnonymousTag("cite"), //$NON-NLS-1$
+            new AnonymousTag("code"), //$NON-NLS-1$
+            new SkipTag("col"), //$NON-NLS-1$
+            new SkipTag("colgroup"), //$NON-NLS-1$
+            new AliasTag("dd", new LiTag()), //$NON-NLS-1$
+            new AnonymousTag("del"), //$NON-NLS-1$
+            new AnonymousTag("dfn"), //$NON-NLS-1$
             new DivTag(),
-            new ForeignTag(),
+            new AliasTag("dl", new UlTag()), //$NON-NLS-1$
+            new AliasTag("dt", new LiTag()), //$NON-NLS-1$
+            new AliasTag("em", new ITag()), //$NON-NLS-1$
+            new IgnoreTag("fieldset"), //$NON-NLS-1$
             new FontTag(),
+            new SkipTag("form"), //$NON-NLS-1$
+            new SkipTag("frame"), //$NON-NLS-1$
+            new SkipTag("frameset"), //$NON-NLS-1$
+            new AliasTag("h1", new HTag(1)), //$NON-NLS-1$
+            new AliasTag("h2", new HTag(2)), //$NON-NLS-1$
+            new AliasTag("h3", new HTag(3)), //$NON-NLS-1$
+            new AliasTag("h4", new HTag(4)), //$NON-NLS-1$
+            new AliasTag("h5", new HTag(5)), //$NON-NLS-1$
+            new AliasTag("h6", new HTag(6)), //$NON-NLS-1$
+            new SkipTag("head"), //$NON-NLS-1$
             new HrTag(),
+            new IgnoreTag("html"), //$NON-NLS-1$
+            new IgnoreTag("frameset"), //$NON-NLS-1$
+            new ITag(),
+            new SkipTag("iframe"), //$NON-NLS-1$
             new ImgTag(),
-            new ITag(),
+            new SkipTag("input"), //$NON-NLS-1$
+            new AnonymousTag("ins"), //$NON-NLS-1$
+            new AnonymousTag("kbd"), //$NON-NLS-1$
+            new AnonymousTag("label"), //$NON-NLS-1$
+            new AnonymousTag("legend"), //$NON-NLS-1$
             new LiTag(),
-            new NoteTag(),
-            new NameTag(),
+            new SkipTag("link"), //$NON-NLS-1$
+            new SkipTag("map"), //$NON-NLS-1$
+            new SkipTag("meta"), //$NON-NLS-1$
+            new SkipTag("noscript"), //$NON-NLS-1$
+            new SkipTag("object"), //$NON-NLS-1$
             new OlTag(),
+            new SkipTag("optgroup"), //$NON-NLS-1$
+            new SkipTag("option"), //$NON-NLS-1$
             new PTag(),
-            new PbTag(),
+            new SkipTag("param"), //$NON-NLS-1$
+            new IgnoreTag("pre"), //$NON-NLS-1$
+            new QTag(),
             new RootTag(),
-            new RowTag(),
-            new ScriptureTag(),
-            new ScripRefTag(),
+            new STag(),
+            new AnonymousTag("samp"), //$NON-NLS-1$
+            new SkipTag("script"), //$NON-NLS-1$
+            new SkipTag("select"), //$NON-NLS-1$
             new SmallTag(),
+            new IgnoreTag("span"), //$NON-NLS-1$
+            new AliasTag("strong", new BTag()), //$NON-NLS-1$
+            new SkipTag("style"), //$NON-NLS-1$
             new SubTag(),
             new SupTag(),
             new SyncTag(),
             new TableTag(),
+            new IgnoreTag("tbody"), //$NON-NLS-1$
             new TdTag(),
-            new TermTag(),
+            new IgnoreTag("tfoot"), //$NON-NLS-1$
+            new SkipTag("textarea"), //$NON-NLS-1$
+            new SkipTag("title"), //$NON-NLS-1$
+            new IgnoreTag("thead"), //$NON-NLS-1$
             new ThTag(),
             new TrTag(),
             new TtTag(),
             new UTag(),
             new UlTag(),
-            new AliasTag("em", new ITag()), //$NON-NLS-1$
-            new AliasTag("strong", new BTag()), //$NON-NLS-1$
-            new AliasTag("h1", new HTag(1)), //$NON-NLS-1$
-            new AliasTag("h2", new HTag(2)), //$NON-NLS-1$
-            new AliasTag("h3", new HTag(3)), //$NON-NLS-1$
-            new AliasTag("h4", new HTag(4)), //$NON-NLS-1$
-            new AliasTag("h5", new HTag(5)), //$NON-NLS-1$
-            new AliasTag("h6", new HTag(6)), //$NON-NLS-1$
-            new AliasTag("dl", new UlTag()), //$NON-NLS-1$
-            new AliasTag("dd", new LiTag()), //$NON-NLS-1$
-            new AliasTag("dt", new LiTag()), //$NON-NLS-1$
-            new IgnoreTag("span"), //$NON-NLS-1$
-            new IgnoreTag("dir"), //$NON-NLS-1$
-            new IgnoreTag("pre"), //$NON-NLS-1$
-            // all the following are from Webster's Dict
-            // Don't know what to do with them
-            // They are not ThML!
+            new AnonymousTag("var"), //$NON-NLS-1$
+
+            // ThML adds the following to Voyager
+            // Note: hymn.mod is not here nor are additional head&DC elements
+            new AnonymousTag("added"), //$NON-NLS-1$
+            new AnonymousTag("attr"), //$NON-NLS-1$
+            new AnonymousTag("argument"), //$NON-NLS-1$
+            new CitationTag(),
+            new AnonymousTag("date"), //$NON-NLS-1$
+            new AnonymousTag("deleted"), //$NON-NLS-1$
             new AnonymousTag("def"), //$NON-NLS-1$
-            new AnonymousTag("pos"), //$NON-NLS-1$
-            new AnonymousTag("hpos"), //$NON-NLS-1$
-            new AnonymousTag("org"), //$NON-NLS-1$
-            new AnonymousTag("wf"), //$NON-NLS-1$
-            new AnonymousTag("cd"), //$NON-NLS-1$
-            new AnonymousTag("sd"), //$NON-NLS-1$
-            new AnonymousTag("tran"), //$NON-NLS-1$
-            new AnonymousTag("itran"), //$NON-NLS-1$
-            new AnonymousTag("qpers"), //$NON-NLS-1$
-            new AnonymousTag("fract"), //$NON-NLS-1$
-            new AnonymousTag("sn"), //$NON-NLS-1$
-            new AnonymousTag("singw"), //$NON-NLS-1$
-            new AnonymousTag("universbold"), //$NON-NLS-1$
-            new AnonymousTag("plw"), //$NON-NLS-1$
-            new AnonymousTag("matrix"), //$NON-NLS-1$
-            new AnonymousTag("ttitle"), //$NON-NLS-1$
-            new AnonymousTag("englishtype"), //$NON-NLS-1$
-            new AnonymousTag("figcap"), //$NON-NLS-1$
-            new AnonymousTag("extendedtype"), //$NON-NLS-1$
-            new AnonymousTag("musfig"), //$NON-NLS-1$
-            new AnonymousTag("stageof"), //$NON-NLS-1$
-            new AnonymousTag("wns"), //$NON-NLS-1$
-            new AnonymousTag("subs"), //$NON-NLS-1$
-            new AnonymousTag("sups"), //$NON-NLS-1$
-            new AnonymousTag("nonpareiltype"), //$NON-NLS-1$
-            new AnonymousTag("gothictype"), //$NON-NLS-1$
-            new AnonymousTag("sanserif"), //$NON-NLS-1$
-            new AnonymousTag("sansserif"), //$NON-NLS-1$
-            new AnonymousTag("headrow"), //$NON-NLS-1$
-            new AnonymousTag("figure"), //$NON-NLS-1$
-            new AnonymousTag("srow"), //$NON-NLS-1$
-            new AnonymousTag("longprimertype"), //$NON-NLS-1$
-            new AnonymousTag("greatprimertype"), //$NON-NLS-1$
-            new AnonymousTag("est"), //$NON-NLS-1$
-            new AnonymousTag("chname"), //$NON-NLS-1$
-            new AnonymousTag("miniontype"), //$NON-NLS-1$
-            new AnonymousTag("supr"), //$NON-NLS-1$
-            new AnonymousTag("sansserif"), //$NON-NLS-1$
-            new AnonymousTag("funct"), //$NON-NLS-1$
-            new AnonymousTag("item"), //$NON-NLS-1$
-            new AnonymousTag("mitem"), //$NON-NLS-1$
-            new AnonymousTag("mtable"), //$NON-NLS-1$
-            new AnonymousTag("figtitle"), //$NON-NLS-1$
-            new AnonymousTag("ct"), //$NON-NLS-1$
-            new AnonymousTag("defwf"), //$NON-NLS-1$
-            new AnonymousTag("umac"), //$NON-NLS-1$
-            new AnonymousTag("pearltype"), //$NON-NLS-1$
-            new AnonymousTag("vertical"), //$NON-NLS-1$
-            new AnonymousTag("title"), //$NON-NLS-1$
-            new AnonymousTag("picatype"), //$NON-NLS-1$
-            new AnonymousTag("point18"), //$NON-NLS-1$
-            new AnonymousTag("matrix2x5"), //$NON-NLS-1$
-            new AnonymousTag("oldenglishtype"), //$NON-NLS-1$
-            new AnonymousTag("oldstyletype"), //$NON-NLS-1$
-            new AnonymousTag("smpicatype"), //$NON-NLS-1$
-            new AnonymousTag("frenchelzevirtype"), //$NON-NLS-1$
-            new AnonymousTag("typewritertype"), //$NON-NLS-1$
-            new AnonymousTag("scripttype"), //$NON-NLS-1$
-            new AnonymousTag("point1"), //$NON-NLS-1$
-            new AnonymousTag("point1.5"), //$NON-NLS-1$
-            new AnonymousTag("point2"), //$NON-NLS-1$
-            new AnonymousTag("point2.5"), //$NON-NLS-1$
-            new AnonymousTag("point3"), //$NON-NLS-1$
-            new AnonymousTag("point3.5"), //$NON-NLS-1$
-            new AnonymousTag("point4"), //$NON-NLS-1$
-            new AnonymousTag("point4.5"), //$NON-NLS-1$
-            new AnonymousTag("point5"), //$NON-NLS-1$
-            new AnonymousTag("point5.5"), //$NON-NLS-1$
-            new AnonymousTag("point6"), //$NON-NLS-1$
-            new AnonymousTag("point7"), //$NON-NLS-1$
-            new AnonymousTag("point8"), //$NON-NLS-1$
-            new AnonymousTag("point9"), //$NON-NLS-1$
-            new AnonymousTag("point10"), //$NON-NLS-1$
-            new AnonymousTag("point11"), //$NON-NLS-1$
-            new AnonymousTag("point12"), //$NON-NLS-1$
-            new AnonymousTag("point14"), //$NON-NLS-1$
-            new AnonymousTag("point16"), //$NON-NLS-1$
-            new AnonymousTag("point18"), //$NON-NLS-1$
-            new AnonymousTag("point20"), //$NON-NLS-1$
-            new AnonymousTag("hw"), //$NON-NLS-1$
+            new AliasTag("div1", new DivTag(1)), //$NON-NLS-1$
+            new AliasTag("div2", new DivTag(2)), //$NON-NLS-1$
+            new AliasTag("div3", new DivTag(3)), //$NON-NLS-1$
+            new AliasTag("div4", new DivTag(4)), //$NON-NLS-1$
+            new AliasTag("div5", new DivTag(5)), //$NON-NLS-1$
+            new AliasTag("div6", new DivTag(6)), //$NON-NLS-1$
+            new ForeignTag(),
+            new AnonymousTag("index"), //$NON-NLS-1$
+            new AnonymousTag("insertIndex"), //$NON-NLS-1$
+            new AnonymousTag("glossary"), //$NON-NLS-1$
+            new NoteTag(),
+            new NameTag(),
+            new PbTag(),
+            new AnonymousTag("scripCom"), //$NON-NLS-1$
+            new AnonymousTag("scripContext"), //$NON-NLS-1$
+            new ScripRefTag(),
+            new ScriptureTag(),
+            new TermTag(),
+            new AnonymousTag("unclear"), //$NON-NLS-1$
+            new VerseTag(),
         };
         for (int i = 0; i < tags.length; i++)
         {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -34,12 +34,36 @@
  */
 public class DivTag extends AbstractTag
 {
+    /**
+     * Create an div tag
+     * @param level
+     */
+    public DivTag()
+    {
+        super();
+        this.level = 0;
+    }
+
+    /**
+     * Create an div tag of the given level
+     * @param level
+     */
+    public DivTag(int level)
+    {
+        super();
+        this.level = level;
+    }
+
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
      */
     public String getTagName()
     {
-        return "div"; //$NON-NLS-1$
+        if (level == 0)
+        {
+            return "div"; //$NON-NLS-1$
+        }
+        return "div" + level; //$NON-NLS-1$
     }
 
     /* (non-Javadoc)
@@ -77,4 +101,9 @@
 
         return div;
     }
+
+    /**
+     * The level of the division
+     */
+    private int level;
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -26,7 +26,7 @@
 import org.xml.sax.Attributes;
 
 /**
- * THML Tag to process the H1, h2, h3, h4, h5, and h6 elements.
+ * THML Tag to process the h1, h2, h3, h4, h5, and h6 elements.
  *
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.
@@ -66,7 +66,7 @@
             ele.addContent(title);
         }
 
-        return title;
+        return ele;
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -21,34 +21,33 @@
  */
 package org.crosswire.jsword.book.filter.thml;
 
+import org.jdom.Element;
 
 /**
- * THML Tag to process the content of an element but to ignore the tag itself.
+ * Process the content of an element but to ignore the tag itself.
  *
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.
- * @author Joe Walker [joe at eireneh dot com]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
  */
-public class IgnoreTag extends AbstractTag
+public class IgnoreTag extends AnonymousTag
 {
     /**
      * Simple ctor
      */
     public IgnoreTag(String name)
     {
-        this.name = name;
+        super(name);
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
+     * @see org.crosswire.jsword.book.filter.thml.AbstractTag#processContent(org.jdom.Element)
      */
-    public String getTagName()
+    public void processContent(Element ele)
     {
-        return name;
+        // Replace the parent with this element
+        Element parent = ele.getParentElement();
+        parent.removeContent(ele);
+        parent.addContent(ele.getChildren());
     }
-
-    /**
-     * The tag name that we are ignoring
-     */
-    private String name;
 }

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LTag.java	                        (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -0,0 +1,60 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: LiTag.java 1466 2007-07-02 02:48:09Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.crosswire.jsword.book.OSISUtil;
+import org.jdom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * THML Tag to process the l line element.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public class LTag extends AbstractTag
+{
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
+     */
+    public String getTagName()
+    {
+        return "li"; //$NON-NLS-1$
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
+     */
+    /* @Override */
+    public Element processTag(Element ele, Attributes attrs)
+    {
+        Element item = OSISUtil.factory().createL();
+
+        if (ele != null)
+        {
+            ele.addContent(item);
+        }
+
+        return item;
+    }
+}

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/QTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/QTag.java	                        (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/QTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -0,0 +1,60 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: BlockquoteTag.java 1466 2007-07-02 02:48:09Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.crosswire.jsword.book.OSISUtil;
+import org.jdom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * THML Tag to process the quote element.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public class QTag extends AbstractTag
+{
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
+     */
+    public String getTagName()
+    {
+        return "blockquote"; //$NON-NLS-1$
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
+     */
+    /* @Override */
+    public Element processTag(Element ele, Attributes attrs)
+    {
+        Element q = OSISUtil.factory().createQ();
+
+        if (ele != null)
+        {
+            ele.addContent(q);
+        }
+
+        return q;
+    }
+}

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/STag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/STag.java	                        (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/STag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -0,0 +1,61 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: SmallTag.java 1466 2007-07-02 02:48:09Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.crosswire.jsword.book.OSISUtil;
+import org.jdom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * THML Tag to process the strike through element.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public class STag extends AbstractTag
+{
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
+     */
+    public String getTagName()
+    {
+        return "small"; //$NON-NLS-1$
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
+     */
+    /* @Override */
+    public Element processTag(Element ele, Attributes attrs)
+    {
+        Element hi = OSISUtil.factory().createHI();
+        hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_LINETHROUGH);
+
+        if (ele != null)
+        {
+            ele.addContent(hi);
+        }
+
+        return hi;
+    }
+}

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SkipTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SkipTag.java	                        (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SkipTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -0,0 +1,52 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: IgnoreTag.java 1466 2007-07-02 02:48:09Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.jdom.Element;
+
+/**
+ * Skip the tag and it's content.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class SkipTag extends AnonymousTag
+{
+    /**
+     * Simple ctor
+     */
+    public SkipTag(String name)
+    {
+        super(name);
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.AbstractTag#processContent(org.jdom.Element)
+     */
+    public void processContent(Element ele)
+    {
+        // Remove this element and all it's children
+        Element parent = ele.getParentElement();
+        parent.removeContent(ele);
+    }
+}

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SubTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SubTag.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SubTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -26,7 +26,7 @@
 import org.xml.sax.Attributes;
 
 /**
- * THML Tag to process the bold element.
+ * THML Tag to process the subscript element.
  *
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/VerseTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/VerseTag.java	                        (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/VerseTag.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -0,0 +1,61 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: PTag.java 1466 2007-07-02 02:48:09Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.crosswire.jsword.book.OSISUtil;
+import org.jdom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * THML Tag to process the verse element.
+ * Note: the verse element surrounds poetry.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public class VerseTag extends AbstractTag
+{
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
+     */
+    public String getTagName()
+    {
+        return "verse"; //$NON-NLS-1$
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
+     */
+    /* @Override */
+    public Element processTag(Element ele, Attributes attrs)
+    {
+        Element p = OSISUtil.factory().createLG();
+
+        if (ele != null)
+        {
+            ele.addContent(p);
+        }
+
+        return p;
+    }
+}

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/DataEntry.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/DataEntry.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/DataEntry.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -109,7 +109,9 @@
     public String getLinkTarget()
     {
         // 6 represents the length of "@LINK" + 1 to skip the last separator.
-        return SwordUtil.decode(name, data, getKeyEnd() + 6, data.length - (getLinkEnd() + 1), charset).trim();
+        int linkStart = getKeyEnd() + 6;
+        int len = getLinkEnd() - linkStart + 1;
+        return SwordUtil.decode(name, data, linkStart, len, charset).trim();
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java	2009-02-22 20:21:50 UTC (rev 1931)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java	2009-02-24 03:12:33 UTC (rev 1932)
@@ -342,7 +342,10 @@
 
         // Initialize to one beyond both ends.
         int total = getCardinality();
-        int low = -1;
+        // Note: In some dictionaries, the first element is out of order and represents the title of the work.
+        // So, do the bin search from 1 to end and if not found, check the first element as a special case.
+        // If that does not match return the position found otherwise.
+        int low = 0;
         int high = total;
         int match = -1;
 




More information about the jsword-svn mailing list