docs: public static String encodeXML( final String    str )
      {
          if ( str == null )
          {
              return null;
          }
  
          StringCharacterIterator    iterator = new StringCharacterIterator( str );
          StringBuilder              result   = new StringBuilder();
          char                       c;
  
          for( c  = iterator.current();
               c != CharacterIterator.DONE;
               c  = iterator.next() )
          {
              if ( c == '>' )
              {
                  result.append( "&gt;" );
              }
              else if ( c == '<' )
              {
                  result.append( "&lt;" );
              }
              else if ( c == '&' )
              {
                  result.append( "&amp;" );
              }
              else if ( c == '"' )
              {
                  result.append( "&quot;" );
              }
              else if ( c == '\'' )
              {
                  result.append( "&#39;" );
              }
              else
              {
                  result.append( c );
              }
          }
  
          return result.toString();
      }