class ActiveFedora::Datastream

def last_modified_in_repository

ie 2008-10-17T00:17:18.194Z
returns a datetime in the standard W3C DateTime Format.
def last_modified_in_repository
  # A hack to get around the fact that you can't call getDatastreamHistory 
  # or API-M getDatasreams on Fedora 3.0 REST API  
  # grabs the CREATED attribute off of the last foxml:datastreamVersion 
  # within the appropriate datastream node in the objectXML
  if self.pid != nil
    object_xml = Fedora::FedoraObject.object_xml(self.pid).gsub("\n     ","")
    datastream_xml = REXML::Document.new(object_xml).root.elements["foxml:datastream[@ID='#{self.dsid}']"]
    
    puts datastream_xml.length
    if datastream_xml.length > 3
      datastream_xml.elements.each do |el|
        puts el.inspect
      end
    end
    
    datastream_xml.elements[datastream_xml.length - 2].attributes["CREATED"]
  else
    return nil
  end
end