Fix incompatibilities with REXML 3.1.7

This commit is contained in:
Matthias Neeracher 2007-12-23 23:59:46 +00:00
parent 1da7def8bf
commit d78ceb8258
2 changed files with 12 additions and 2 deletions

View File

@ -299,6 +299,7 @@ class MusicXMLListener
# #
# Interesting text nodes have @kind set # Interesting text nodes have @kind set
# #
@text.strip!
if @kind if @kind
case @kind case @kind
when 'textProp' when 'textProp'

View File

@ -434,13 +434,22 @@ def _score
return score return score
end end
NEW_REXML = REXML::VERSION > "3.1.7"
xml = REXML::Document.new xml = REXML::Document.new
xml.add REXML::XMLDecl.new('1.0', 'UTF-8') xml.add REXML::XMLDecl.new('1.0', 'UTF-8')
xml.add REXML::DocType.new(['score-partwise', 'PUBLIC', xml.add REXML::DocType.new(['score-partwise', 'PUBLIC',
'"-//Recordare//DTD MusicXML 1.1 Partwise//EN"', '"-//Recordare//DTD MusicXML 1.1 Partwise//EN"',
NEW_REXML ? 'http://www.musicxml.org/dtds/partwise.dtd' :
'"http://www.musicxml.org/dtds/partwise.dtd"']) '"http://www.musicxml.org/dtds/partwise.dtd"'])
xml.add_element(_score) xml.add_element(_score)
xml.write($stdout, 0) if NEW_REXML
formatter = REXML::Formatters::Pretty.new(2)
formatter.compact = true
formatter.write(xml, $stdout)
else
xml.write($stdout, 0)
end
# Local Variables: # Local Variables:
# mode:ruby # mode:ruby