class ActiveFedora::Base

def self.deserialize(doc) #:nodoc:

:nodoc:
def self.deserialize(doc) #:nodoc:
  pid = doc.elements['/foxml:digitalObject'].attributes['PID']
  
  proto = self.new(:pid=>pid, :new_object=>false)
  proto.datastreams.each do |name,ds|
    doc.elements.each("//foxml:datastream[@ID='#{name}']") do |el|
      # datastreams remain marked as new if the foxml doesn't have an entry for that datastream
      ds.new_object = false
      proto.datastreams[name]=ds.class.from_xml(ds, el)
    end
  end
  proto.inner_object.new_object = false
  return proto
end