[sword-devel] GenBook key issues

Manfred Bergmann bergmannmd at web.de
Fri Jun 6 05:29:44 MST 2008


I'm testing a little with some GenBooks and trying to fix issues.
All GenBooks work pretty good in MacSword except Institues and Heretics.

For Heretics I found that addressing two keys work, that is:
"I. Introductory Remarks..." and
"VIII. The Mildness of the Yellow Press"

All others fail. I noticed that all of them end with a space  
character. The two that work do not.
In Institutes many keys end with space character but some do not and  
addressing them doesn't work either.

What are the experiences for these GenBooks for other front end  

Below is the method that tries to address the key and pull out the text:
Why does this actually not work with TreeKeyIdx? When using this  
subclass, error is always set.
The ref string that comes in here is the string that is retrieved by  
calling TreeKeyIdx::getText(). The full path.


- (NSString *)htmlForRef:(NSString *)ref {
     NSString *ret = @"";

     // lock
     [moduleLock lock];

     const char *refStr = NULL;
     // encoding depends on module encoding
     if([self isUnicode]) {
         refStr = [ref cStringUsingEncoding:NSUTF8StringEncoding];
     } else {
         refStr = [ref cStringUsingEncoding:NSISOLatin1StringEncoding];

     //sword::TreeKeyIdx *key = new sword::TreeKeyIdx(refStr);
     sword::SWKey *key = new sword::SWKey(refStr);
     char err = key->Error();
     if(key) {
         delete key;

     char *bytes = (char *)module->RenderText();
     [moduleLock unlock];

     ret = [NSString stringWithUTF8String:bytes];

     return ret;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.crosswire.org/pipermail/sword-devel/attachments/20080606/83ea7aa2/attachment.html 

More information about the sword-devel mailing list