Skip to content

Commit

Permalink
Merge pull request #245 from projecthydra/5.x-ngxml
Browse files Browse the repository at this point in the history
Set content from the ngxml document, and update the stored datastream_co...
  • Loading branch information
jcoyne committed Oct 8, 2013
2 parents 5dc023a + cdf99ef commit 7645e14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/active_fedora/nokogiri_datastream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def datastream_content
@datastream_content ||= Nokogiri::XML(super).to_xml {|config| config.no_declaration}.strip
end

def content
to_xml
end

def content=(new_content)
if inline?
# inline datastreams may be transformed by fedora 3, so we test for equivalence instead of equality
Expand Down Expand Up @@ -428,6 +432,13 @@ def serialize!
def xml_loaded
instance_variable_defined? :@ng_xml
end

def reset_profile_attributes
super
if xml_loaded
@datastream_content = Nokogiri::XML(to_xml).to_xml {|config| config.no_declaration}.strip
end
end

end
end
Expand Down

0 comments on commit 7645e14

Please sign in to comment.