You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Jon Smirl <jo...@mediaone.net> on 2000/06/13 17:19:20 UTC

DOMString vs Java string

I'm porting some Java code over to Xerces-c and I've been using DOMString as
my string type. Is there any interest in extending DOMString with a few more
methods to make it more Java compatible?

For example, indexOf() and equalsIgnoreCase()?
Also, why is it substringData() instead of just substring()?

I don't know enough about DOMString to full understand the Unicode
implications of equalsIgnoreCase().

Jon Smirl
jonsmirl@mediaone.net



Re: DOMString vs Java string

Posted by Jon Smirl <jo...@mediaone.net>.
BTW, I found all of the functions I was looking for: equalsIgnoreCase,
substring, indexOf, lastIndexOf, toLowerCase, etc. implemented in the Xalan
project in DOMStringHelper.cpp. They even implemented the compare functions
for use with <map> and DOMStringToInt.

Jon Smirl
jonsmirl@mediaone.net


Re: DOMString vs Java string

Posted by Joe Polastre <po...@jtcsv.com>.
> Also, why is it substringData() instead of just substring()?

This appears to be a consistency issue.  DOMString includes methods like
"appendData", "deleteData", and "insertData" so it makes sense that when
you're dealing with the actual content of the string (as opposed to the
DOMString object in methods like "clone") for the method name to include
"Data".

> I don't know enough about DOMString to full understand the Unicode
> implications of equalsIgnoreCase().

DOMString is a UTF-16 string (sequence of unsigned shorts as described by
the DOM standard).  So equalsIgnoreCase() would run through the two strings
and ignore the case of each character in UTF-16 encoding.

-Joe Polastre
IBM Cupertino, XML Technology Group