def encodeXML( text, doNPChars = false )
      encodingStrings { |key,value| text.gsub!( key, value ) if text }
      text.gsub!( /([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()# ])/ ) { |c| escapeXML( $1 ) } if text and doNPChars
      text
   end
def encodeXML( text, doNPChars = false )
      encodingStrings { |key,value| text.gsub!( key, value ) if text }
      text.gsub!( /([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()# ])/ ) { |c| escapeXML( $1 ) } if text and doNPChars
      text
   end
Modify the given string for use as a XML field value.