maiolum.xml
Class XMLBibleFragment

java.lang.Object
  extended bymaiolum.xml.XMLBibleFragment
All Implemented Interfaces:
BibleFragment, ChildrenAware

public class XMLBibleFragment
extends java.lang.Object
implements BibleFragment, ChildrenAware

This class is an XML implementation of BibleFragment. It internally holds textual data in XML format - using org.w3c.dom.Element class. Furthermore, it allows to load XML data from File or from file defined by String pathname.


Field Summary
private  Edition edition
           
private  java.lang.String id
           
private  BibleFragment parent
           
private  java.lang.String title
           
private  FragmentType type
           
private  org.w3c.dom.Node xmlData
           
 
Constructor Summary
XMLBibleFragment()
           
XMLBibleFragment(java.io.File f)
           
XMLBibleFragment(java.lang.String filename)
           
 
Method Summary
 FragmentData getData()
          Returns actual fragment contents, be it normal String, XML Node or other user specified type.
 Edition getEdition()
          Returns the unit descriptive meta-information (e.g. language, year of issue etc) of this fragment.
 BibleFragment getChildByID(java.lang.String id)
          Returns child BibleFragment that has given ID.
 java.lang.String getID()
          Returns a String representing this fragment's identifier.
 BibleFragment getParent()
          Returns the parent text fragment - typically parent to verse is chapter, parent to chapter is book, which are actually BibleFragments, too.
 java.lang.String getTitle()
           
 FragmentType getType()
          Returns this fragment“s type - whether it is chapter, book or other user-defined textual unit.
 org.w3c.dom.Node getXMLData()
           
 void setEdition(Edition edition)
          Allows to set the appropriate Edition for this fragment.
 void setID(java.lang.String id)
          Sets this fragment's ID to id.
 void setParent(BibleFragment parent)
          Sets the parent text fragment to parent.
 void setTitle(java.lang.String title)
           
 void setType(FragmentType type)
          Sets this fragment's type.
 void setXMLData(java.io.File f)
           
 void setXMLData(org.w3c.dom.Node xmlData)
           
 void setXMLData(java.lang.String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

private BibleFragment parent

type

private FragmentType type

id

private java.lang.String id

title

private java.lang.String title

edition

private Edition edition

xmlData

private org.w3c.dom.Node xmlData
Constructor Detail

XMLBibleFragment

public XMLBibleFragment()

XMLBibleFragment

public XMLBibleFragment(java.io.File f)
                 throws ParseException

XMLBibleFragment

public XMLBibleFragment(java.lang.String filename)
                 throws ParseException
Method Detail

getParent

public BibleFragment getParent()
Description copied from interface: BibleFragment
Returns the parent text fragment - typically parent to verse is chapter, parent to chapter is book, which are actually BibleFragments, too. Parent text fragment can be null

Specified by:
getParent in interface BibleFragment

setParent

public void setParent(BibleFragment parent)
Description copied from interface: BibleFragment
Sets the parent text fragment to parent.

Specified by:
setParent in interface BibleFragment

getType

public FragmentType getType()
Description copied from interface: BibleFragment
Returns this fragment“s type - whether it is chapter, book or other user-defined textual unit.

Specified by:
getType in interface BibleFragment

setType

public void setType(FragmentType type)
Description copied from interface: BibleFragment
Sets this fragment's type.

Specified by:
setType in interface BibleFragment

getID

public java.lang.String getID()
Description copied from interface: BibleFragment
Returns a String representing this fragment's identifier. This can be used e. g. as ID attribute in XML.

Specified by:
getID in interface BibleFragment

setID

public void setID(java.lang.String id)
Description copied from interface: BibleFragment
Sets this fragment's ID to id. The ID should not be null.

Specified by:
setID in interface BibleFragment

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String title)

setEdition

public void setEdition(Edition edition)
Description copied from interface: BibleFragment
Allows to set the appropriate Edition for this fragment.

Specified by:
setEdition in interface BibleFragment

getEdition

public Edition getEdition()
Description copied from interface: BibleFragment
Returns the unit descriptive meta-information (e.g. language, year of issue etc) of this fragment.

Specified by:
getEdition in interface BibleFragment

getXMLData

public org.w3c.dom.Node getXMLData()

setXMLData

public void setXMLData(org.w3c.dom.Node xmlData)

setXMLData

public void setXMLData(java.lang.String filename)
                throws ParseException
Throws:
ParseException

setXMLData

public void setXMLData(java.io.File f)
                throws ParseException
Throws:
ParseException

getChildByID

public BibleFragment getChildByID(java.lang.String id)
Returns child BibleFragment that has given ID. This XML implementation returns new BibleFragment, whose XML data contain node matching XPath expression //*[@number=idValue] in case of Chapter (since child nodes are supposed to be Verses (...) and expression //*[@id=idValue] in other cases.

Specified by:
getChildByID in interface ChildrenAware

getData

public FragmentData getData()
Description copied from interface: BibleFragment
Returns actual fragment contents, be it normal String, XML Node or other user specified type.

Specified by:
getData in interface BibleFragment
Returns: