On Wed, 21 Nov 2007 13:39:58 +0900, Martin Durai <martin / angleritech.com>  rote:

> Thank you carl, iam very new to this language
>
> sorry carl could you help with this code fully
>
> for( int i = namespaceEnd -1; i >= 0; i--) {
>                 if( prefix.equals( namespacePrefix[ i ] ) ) {
>                     return namespaceUri[ i ];
>                 }
>
>
> thank you in advance
>

You might consider using an array of namespace objects instead of parallel  rrays

class Namespace
   attr_reader :prefix, :uri
   def initialize(prefix, uri)
     @prefix = prefix
     @uri = uri
   end
end

namespaces = [ Namespace.new("prefix", "uri"), ...]

then your code becomes something like:

matching_namespace = namespaces.find {|namespace| namespace.prefix ==  refix)
return matching_namespace ? matching_namespace.uri : nil