From d78ceb825841a74be3e684709c06d38a2883a124 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 23 Dec 2007 23:59:46 +0000 Subject: [PATCH] Fix incompatibilities with REXML 3.1.7 --- Filters/VLMusicXMLType.reader | 1 + Filters/VLMusicXMLType.writer | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Filters/VLMusicXMLType.reader b/Filters/VLMusicXMLType.reader index 49f3e14..63cc4de 100755 --- a/Filters/VLMusicXMLType.reader +++ b/Filters/VLMusicXMLType.reader @@ -299,6 +299,7 @@ class MusicXMLListener # # Interesting text nodes have @kind set # + @text.strip! if @kind case @kind when 'textProp' diff --git a/Filters/VLMusicXMLType.writer b/Filters/VLMusicXMLType.writer index cc5e57d..834acd6 100755 --- a/Filters/VLMusicXMLType.writer +++ b/Filters/VLMusicXMLType.writer @@ -434,13 +434,22 @@ def _score return score end +NEW_REXML = REXML::VERSION > "3.1.7" + xml = REXML::Document.new xml.add REXML::XMLDecl.new('1.0', 'UTF-8') xml.add REXML::DocType.new(['score-partwise', 'PUBLIC', '"-//Recordare//DTD MusicXML 1.1 Partwise//EN"', - '"http://www.musicxml.org/dtds/partwise.dtd"']) + NEW_REXML ? 'http://www.musicxml.org/dtds/partwise.dtd' : + '"http://www.musicxml.org/dtds/partwise.dtd"']) 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: # mode:ruby