[jdom-interest] Verifier.checkXMLName() - small performance improvement.

Rolf Lear rlear at algorithmics.com
Mon Apr 14 04:06:41 PDT 2003


The following provides a slight, but easy performance gain in this method.

Existing code:
...
for (int i=0, len = name.length(); i<len; i++) {
...


Replace with:
for (int i=1, len = name.length(); i<len; i++) {


Reason:

The first character is already confirmed to be an "isXMLNameStartCharacter",
which is a pure subset of the "isXMLNameCharacter" every other letter is
checked against.

Thus, the first letter of every Element and Attribute name is verified
twice.

Rolf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030414/5742ccca/attachment.htm


More information about the jdom-interest mailing list