|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmaiolum.BibleFragmentFactory
maiolum.xml.XMLBibleFragmentFactory
This is an implementation of AbstractBibleFactory to work with files containing XML data. XML is then represented via DOM nodes, elements and documents.
Instance of the class must be instantiated with either String or File referencing valid file containing XML data.
All overriden methods return XMLBibleFragment objects.
| Field Summary | |
private org.w3c.dom.Node |
entireDocument
Node containing whole document read from file. |
private static org.apache.log4j.Logger |
logger
|
| Constructor Summary | |
XMLBibleFragmentFactory(java.io.File f)
|
|
XMLBibleFragmentFactory(java.lang.String filename)
|
|
| Method Summary | |
protected void |
finalize()
|
private XMLBibleFragment |
getFirstMatch(java.lang.String xpath)
Returns XMLFragment, which XML data match given XPath. |
BibleFragment |
getNextSibling(BibleFragment fragment)
Returns next XMLBibleFragment to the given fragment
in the document order. |
BibleFragment |
getNextSibling(java.lang.String id)
Returns next XMLBibleFragment to the fragment given by ID in the document order. |
private java.lang.String |
getNodeNameByID(java.lang.String id)
Returns name of Node, that has given ID. |
BibleFragment |
getPreviousSibling(BibleFragment fragment)
Returns first preceding BibleFragment relative to given BibleFragment in document order. |
BibleFragment |
getPreviousSibling(java.lang.String id)
Returns first preceding BibleFragment relative to given BibleFragment specified by its ID in document order. |
BibleFragment |
newBibleFragment()
Returns new fragment containing whole parsed document. |
XMLBibleFragment |
newBibleFragment(org.w3c.dom.Document doc,
java.lang.String id)
Returns new BibleFragment (in this case XMLBibleFragment) which has an ID attribute value of id,
while reading data from the given Node. |
BibleFragment |
newBibleFragment(java.lang.String id)
Finds within the parsed document an element with given ID and returns its contents as new fragment. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private org.w3c.dom.Node entireDocument
private static org.apache.log4j.Logger logger
| Constructor Detail |
public XMLBibleFragmentFactory(java.io.File f)
throws ParseException
public XMLBibleFragmentFactory(java.lang.String filename)
throws ParseException
| Method Detail |
public BibleFragment newBibleFragment()
throws ParseException
ParseException
public BibleFragment newBibleFragment(java.lang.String id)
throws java.lang.Exception
null is returned.
null
when the parent document does not contain element with given ID-
java.lang.Exception
public XMLBibleFragment newBibleFragment(org.w3c.dom.Document doc,
java.lang.String id)
throws java.lang.Exception
id,
while reading data from the given Node.
null, when no element with required ID exists
java.lang.Exception
public BibleFragment getNextSibling(BibleFragment fragment)
throws java.lang.Exception
fragment
in the document order.
getNextSibling in class BibleFragmentFactorynull when no such element exists.
java.lang.Exception
public BibleFragment getNextSibling(java.lang.String id)
throws java.lang.Exception
null when no such element exists.
java.lang.Exception
public BibleFragment getPreviousSibling(BibleFragment fragment)
throws java.lang.Exception
BibleFragment in document order.
getPreviousSibling in class BibleFragmentFactoryjava.lang.Exception
public BibleFragment getPreviousSibling(java.lang.String id)
throws java.lang.Exception
null when no element with given exists, or there
is no valid previous element.
java.lang.Exception
private XMLBibleFragment getFirstMatch(java.lang.String xpath)
throws java.lang.Exception
The document is matched to the given xpath and from the nodes that are matched, is taken only first. This first node is then taken for the root of XMLdata of returned XMLBibleFragment.
null is returned when no nodes match the
given XPath.
java.lang.Exception
private java.lang.String getNodeNameByID(java.lang.String id)
throws java.lang.Exception
String
"chapter".
java.lang.Exceptionprotected void finalize()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||