org.crosswire.jsword.examples
Class APIExamples

java.lang.Object
  extended by org.crosswire.jsword.examples.APIExamples

public class APIExamples
extends Object

All the methods in this class highlight some are of the API and how to use it.

Author:
Joe Walker [joe at eireneh dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.

Nested Class Summary
(package private) static class APIExamples.MyBookFilter
          A simple BookFilter that looks for a Bible by name.
(package private) static class APIExamples.MyBooksListener
          A simple BooksListener that actually does nothing.
 
Field Summary
private static String BIBLE_NAME
          The name of a Bible to find
 
Constructor Summary
APIExamples()
           
 
Method Summary
 Book getBook(String bookInitials)
          Get a particular installed book by initials.
 SAXEventProvider getOSIS(String bookInitials, String reference, int maxKeyCount)
          Obtain a SAX event provider for the OSIS document representation of one or more book entries.
 String getPlainText(String bookInitials, String reference)
          Get just the canonical text of one or more book entries without any markup.
 void installBook()
           
static void main(String[] args)
          Quick Demo
 void pickBible()
          This is an example of the different ways to select a Book from the selection available.
(package private)  void rankedSearch()
          An example of how to perform a ranked search.
 void readDictionary()
          While Bible and Commentary are very similar, a Dictionary is read in a slightly different way.
 String readStyledText(String bookInitials, String reference, int maxKeyCount)
          Obtain styled text (in this case HTML) for a book reference.
 void search()
          An example of how to search for various bits of data.
(package private)  void searchAndShow()
          An example of how to do a search and then get text for each range of verses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIBLE_NAME

private static final String BIBLE_NAME
The name of a Bible to find

See Also:
Constant Field Values
Constructor Detail

APIExamples

public APIExamples()
Method Detail

getBook

public Book getBook(String bookInitials)
Get a particular installed book by initials.

Parameters:
bookInitials - The book name to search for
Returns:
The found book. Null otherwise.

getPlainText

public String getPlainText(String bookInitials,
                           String reference)
                    throws BookException,
                           NoSuchKeyException
Get just the canonical text of one or more book entries without any markup.

Parameters:
bookInitials - the book to use
reference - a reference, appropriate for the book, of one or more entries
Throws:
BookException
NoSuchKeyException

getOSIS

public SAXEventProvider getOSIS(String bookInitials,
                                String reference,
                                int maxKeyCount)
                         throws BookException,
                                NoSuchKeyException
Obtain a SAX event provider for the OSIS document representation of one or more book entries.

Parameters:
bookInitials - the book to use
reference - a reference, appropriate for the book, of one or more entries
Throws:
BookException
NoSuchKeyException

readStyledText

public String readStyledText(String bookInitials,
                             String reference,
                             int maxKeyCount)
                      throws NoSuchKeyException,
                             BookException,
                             TransformerException,
                             SAXException
Obtain styled text (in this case HTML) for a book reference.

Parameters:
bookInitials - the book to use
reference - a reference, appropriate for the book, of one or more entries
Returns:
the styled text
Throws:
NoSuchKeyException
BookException
TransformerException
SAXException
See Also:
Book, SAXEventProvider

readDictionary

public void readDictionary()
                    throws BookException
While Bible and Commentary are very similar, a Dictionary is read in a slightly different way. It is also worth looking at the JavaDoc for Book that has a way of treating Bible, Commentary and Dictionary the same.

Throws:
BookException
See Also:
Book

search

public void search()
            throws BookException
An example of how to search for various bits of data.

Throws:
BookException

rankedSearch

void rankedSearch()
            throws BookException
An example of how to perform a ranked search.

Throws:
BookException

searchAndShow

void searchAndShow()
             throws BookException,
                    SAXException
An example of how to do a search and then get text for each range of verses.

Throws:
BookException
SAXException

pickBible

public void pickBible()
This is an example of the different ways to select a Book from the selection available.

See Also:
Config, Books

installBook

public void installBook()

main

public static void main(String[] args)
                 throws BookException,
                        NoSuchKeyException,
                        TransformerException,
                        SAXException
Quick Demo

Throws:
NoSuchKeyException
BookException
SAXException
TransformerException

Copyright ยจ 2003-2013