Hi all, Currently in libsword apps, referenses to genbook nodes need to be written in form osisRef="BookId:rootnode/branchnode/leafnode". This is wrong, because OSIS xml scheme does not allow '/' character in osisRefs. Instead, osisRef should be in form, osisRef="BookId:rootnode.branchnode.leafnode". Also http://www.crosswire.org/wiki/OSIS_Genbooks suggest the latter form.
See also discussion on https://github.com/crosswire/jsword/pull/98 Attached is the patch to fix this issue. I tested this with Xiphos and it seems to work fine. Thanks, Best regards, Tuomas ps. just a little humble suggestion, *please* move to github. It would be a lot more convenient and easier to get involved to development via pullrequests than this way.
diff --git a/src/keys/treekey.cpp b/src/keys/treekey.cpp index a466da6..fd82ff5 100644 --- a/src/keys/treekey.cpp +++ b/src/keys/treekey.cpp @@ -53,7 +53,7 @@ void TreeKey::assureKeyPath(const char *keyBuffer) { root(); // TODO: change to NOT use strtok. strtok is dangerous. - SWBuf tok = strtok(keybuf, "/"); + SWBuf tok = strtok(keybuf, "."); tok.trim(); while (tok.size()) { bool foundkey = false; @@ -88,7 +88,7 @@ void TreeKey::assureKeyPath(const char *keyBuffer) { // std::cout << getLocalName() << " : " << tok << std::endl; #endif - tok = strtok(0, "/"); + tok = strtok(0, "."); tok.trim(); } diff --git a/src/keys/treekeyidx.cpp b/src/keys/treekeyidx.cpp index 5164277..08c5eeb 100644 --- a/src/keys/treekeyidx.cpp +++ b/src/keys/treekeyidx.cpp @@ -514,7 +514,7 @@ void TreeKeyIdx::saveTreeNode(TreeNode *node) { void TreeKeyIdx::setText(const char *ikey) { char *buf = 0; stdstr(&buf, ikey); - SWBuf leaf = strtok(buf, "/"); + SWBuf leaf = strtok(buf, "."); leaf.trim(); root(); while ((leaf.size()) && (!popError())) { @@ -527,7 +527,7 @@ void TreeKeyIdx::setText(const char *ikey) { break; } } - leaf = strtok(0, "/"); + leaf = strtok(0, "."); leaf.trim(); if (!ok) { if (inChild) { // if we didn't find a matching child node, default to first child @@ -617,10 +617,12 @@ const char *TreeKeyIdx::getText() const { static SWBuf fullPath; fullPath = currentNode.name; parent.parent = currentNode.parent; - while (parent.parent > -1) { + while (parent.parent > 0) { getTreeNodeFromIdxOffset(parent.parent, &parent); - fullPath = ((SWBuf)parent.name) + (SWBuf) "/" + fullPath; + fullPath = ((SWBuf)parent.name) + (SWBuf) "." + fullPath; } + getTreeNodeFromIdxOffset(parent.parent, &parent); + fullPath = ((SWBuf)parent.name) + (SWBuf) fullPath; // we've snapped; clear our unsnapped text holder unsnappedKeyText = ""; return fullPath.c_str();
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page