[sword-devel] Parsing Verse lists

Ben Morgan benpmorgan at gmail.com
Tue Jun 5 23:51:35 MST 2007


I have two questions related to Parsing verselists.

How do I detect whether the reference passed to
VerseKey::ParseVerseList is valid?
If I try the following python code I don't get an error, just the wron result:
>>> listkey = SW.VerseKey().ParseVerseList("Genesis 3:5-Foo:Bar", "", True)
>>> print listkey.getRangeText()
Genesis 3:5-Revelation of John 22:21

I can't find out how to tell if there was an error. If I try
listkey.Count(), it equals 1.
If I try listkey.GetElement(0).Error(), it says there isn't an error.
Also, listkey.Error() gives 0
If I parse a verselist from "Genesis 3:5-Revelation of John 22:21", it
says it equals my listkey.

This is quite important, as if the user types "Genesis 3:5-Geness 3:6"
(the second Genesis missing an i), they don't want to get all the text
to revelation!

Also, how do I find out when the reference has wrapped (or normalized
as I think it is called)
e.g. Matthew 29:47 being turned into Mark 2:2
For example using the following python code:
>>> listkey = vk.ParseVerseList("Genesis 5:1-333","",True)
>>> listkey.getRangeText()
'Genesis 5:1-Genesis 18:14'

I would much rather have the behaviour in JSword (an error saying
Verse should be between 1 and 32 for Genesis 5) as that is what a user
would expect to see.

God Bless,
There is no love sincerer than the love of food.
George Bernard Shaw (1856-1950)

More information about the sword-devel mailing list