Added an equals(String) method to the XMLString interface.  This allows the
caller to compare an XMLString to a Java String without forcing the XMLString
to be converted to a String.

In this particular class (XString), modified equals(XMLString) to take advantage
of the new XMLString.equals(String).  If the argument for the comparison
contains a java.lang.String, then comparing that with the String held by this
XString is likely the fastest way to perform the comparison; otherwise, we give
the argument the chance to compare itself natively with the String contained by
this XString.

Part of patch for XALANJ-1243.  Reviewed by Brian Minchau (minchau@ca.ibm.com).

diff --git a/src/org/apache/xpath/objects/XString.java b/src/org/apache/xpath/objects/XString.java
index 064cfb1..c607066 100644
--- a/src/org/apache/xpath/objects/XString.java
+++ b/src/org/apache/xpath/objects/XString.java
@@ -320,6 +320,22 @@
   }
 
   /**
+   * Compares this string to the specified <code>String</code>.
+   * The result is <code>true</code> if and only if the argument is not
+   * <code>null</code> and is a <code>String</code> object that represents
+   * the same sequence of characters as this object.
+   *
+   * @param   obj2   the object to compare this <code>String</code> against.
+   * @return  <code>true</code> if the <code>String</code>s are equal;
+   *          <code>false</code> otherwise.
+   * @see     java.lang.String#compareTo(java.lang.String)
+   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
+   */
+  public boolean equals(String obj2) {
+    return str().equals(obj2);
+  }
+
+  /**
    * Compares this string to the specified object.
    * The result is <code>true</code> if and only if the argument is not
    * <code>null</code> and is a <code>String</code> object that represents
@@ -334,11 +350,14 @@
    */
   public boolean equals(XMLString obj2)
   {
-
-    if (!obj2.hasString())
-      return obj2.equals(this);
-    else
-      return str().equals(obj2.toString());
+    if (obj2 != null) {
+      if (!obj2.hasString()) {
+        return obj2.equals(str());
+      } else {
+        return str().equals(obj2.toString());
+      }
+    }
+    return false;
   }
 
   /**