[sword-devel] Case sensitivity in xml tags

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Sat Feb 28 02:23:48 MST 2009

Greg Hellings wrote:
> I was speaking in IRC with Troy and others, and since all of those
> comparisons were for XML tags or module names, they actually don't
> have to be case insensitive, since XML is case sensitive for its tag
> names, etc.    On the other hand, the module name shouldn't be done
> with stricmp/strcasecmp anyway, since it needs to be properly UTF-8
> aware (and, theoretically, so should the XML comparison).  He
> suggested to use something like toUpper(SWBuf(str)) == "MYUTF8STRING"
> which would get rid of the entire reliance on the system-specific
> case-insensitive comparison function and could be used for either the
> XML tags or the Module names.  But yes, using stricmp from the SWORD
> headers would be a replacement that does exactly the same as what we
> do at the moment.

Is it guaranteed that the XML in the modules is always lower (upper) 
case, or does e.g.sword::XMLTag::getName() always return a lower (upper) 
case string ? If not, we need to have case sensitive comparison. Unless 
I have misunderstood something.

For example, we use "strcasecmp(tag.getName(), "foreign")". It works 
with case sensitive comparison only if the tag name "foreign" is always 
lower case in all modules.

--Eeli Kaikkonen

More information about the sword-devel mailing list