Basic usage:
// Register scripture definition from XML file
if (ScriptureInfo.TryRegister("esv", "{path to the file}"))
{
    Reference myRef1;
    Reference.TryParse("jn 3:16", "esv", out myRef1);
        
    Reference myRef2;
    Reference.TryParse("gen 5:4-6:18; James 4", "esv", out myRef2);
}

Register a Scripture Definition from XML
The ScriptureInfo class stores the definition of various scriptures. This might be different versions of the the Bible or one could also define other scriptures such as the Book of Mormon or versions of the Bible containing apocryphal books, etc. Before a scripture definition XML file can be used, it must be registered with the ScriptureInfo class:

ScriptureInfo.TryRegister("esv","{path to the file}");


The scripture ID ("esv" in this case) can then be used later when parsing text references. Alternatively, a ScriptureInfo instance can be retrieved that contains a scripture definition. A null is returned if an instance is requested for an ID that has not been registered.

// register the file
ScriptureInfo.TryRegister("esv","{path to the file}");

// get instance of the registered scripture definition
ScriptureInfo si = ScriptureInfo.GetInstance("esv");

Any scripture definition only needs to be registered once within the scope of an application.

Parsing References
A text string representing a scripture reference can be parsed be passing either the scripture ID ("esv") or a ScriptureInfo object. The scripture definition must be registered before parsing can take place

// parse using ID
Reference myRef1;
Reference.TryParse("jn 3:16", "esv", out myRef1);

// parse using ScriptureInfo instance
ScriptureInfo si = ScriptureInfo.GetInstance("esv");
Reference myRef2;
Reference.TryParse("jn 3:16", si, out myRef2);

Last edited Mar 2, 2013 at 2:46 AM by skonves, version 4

Comments

No comments yet.