瀏覽代碼

Porting to xml2js preprocessor

Andrea Condoluci 9 年之前
父節點
當前提交
4d47aac895

+ 1 - 0
Gruntfile.js

@@ -145,6 +145,7 @@ module.exports = function (grunt) {
     grunt.registerTask('all',     ['typings', 'default']);
     grunt.registerTask('default', ['lint', 'browserify', 'karma:ci']);
     grunt.registerTask('test',    ['lint', 'browserify:debug', 'karma:ci']);
+    grunt.registerTask('fasttest', ['browserify:debug', 'karma:ci']);
     grunt.registerTask('rebuild', ['clean', 'default']);
     grunt.registerTask('publish', ['clean', 'browserify:dist', 'docco']);
 

+ 2 - 5
karma.conf.js

@@ -4,7 +4,6 @@
 module.exports = function (config) {
     'use strict';
     config.set({
-
         // base path that will be used to resolve all patterns (eg. files, exclude)
         basePath: '',
 
@@ -25,15 +24,13 @@ module.exports = function (config) {
             included: false
         }, {
             pattern: 'test/data/*.xml',
-            included: true//,
-            //served: true,
-            //watched: true
+            included: true
         }],
 
         // preprocess matching files before serving them to the browser
         // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
         preprocessors: {
-            'test/data/*.xml': ['html2js']
+            'test/data/*.xml': ['xml2js']
         },
 
         // test results reporter to use

+ 1 - 3
package.json

@@ -49,12 +49,10 @@
         "karma": "",
         "karma-chai": "",
         "karma-mocha": "",
-        "karma-fixture": "",
         "karma-mocha-reporter": "",
         "karma-chrome-launcher": "",
         "karma-firefox-launcher": "",
         "karma-phantomjs-launcher": "",
-        "karma-html2js-preprocessor": "",
-        "karma-json-fixtures-preprocessor": ""
+        "karma-xml2js-preprocessor": ""
     }
 }

+ 1 - 1
src/Common/DataObjects/fraction.ts

@@ -64,7 +64,7 @@ export class Fraction {
         this.setRealValue();
     }
 
-    public ToString(): string {
+    public toString(): string {
         return this.numerator + "/" + this.denominator;
     }
 

+ 1 - 1
src/Common/FileIO/Xml.ts

@@ -58,7 +58,7 @@ export class IXmlElement {
     // }
     for (let i: number = 0; i < nodes.length; i += 1) {
       let node: Node = nodes[i];
-      // console.log("node: ", this.elem.nodeName, ">>", node.nodeName, node.nodeType === Node.ELEMENT_NODE);
+      console.log("node: ", this.elem.nodeName, ">>", node.nodeName, node.nodeType === Node.ELEMENT_NODE);
       if (node.nodeType === Node.ELEMENT_NODE &&
         (nameUnset || node.nodeName.toLowerCase() === nodeName)) {
           ret.push(new IXmlElement(node as Element));

+ 11 - 9
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -118,6 +118,7 @@ export class InstrumentReader {
           if (xmlNode.hasAttributes && xmlNode.attribute("print-object") !== undefined && xmlNode.attribute("print-spacing") !== undefined) {
             continue;
           }
+          Logging.log("New Note: ", (xmlNode as any).elem.innerHTML);
           let noteStaff: number = 1;
           if (this.instrument.Staves.length > 1) {
             if (xmlNode.element("staff") !== undefined) {
@@ -142,9 +143,10 @@ export class InstrumentReader {
           let noteDivisions: number = 0;
           let noteDuration: Fraction = new Fraction(0, 1);
           let isTuplet: boolean = false;
+          // Logging.debug("NOTE", (xmlNode as any).elem.innerHTML, xmlNode.element("duration"));
           if (xmlNode.element("duration") !== undefined) {
-            try {
-              noteDivisions = parseInt(xmlNode.element("duration").value, 10);
+            noteDivisions = parseInt(xmlNode.element("duration").value, 10);
+            if (!isNaN(noteDivisions)) {
               noteDuration = new Fraction(noteDivisions, 4 * this.divisions);
               if (noteDivisions === 0) {
                 noteDuration = this.getNoteDurationFromTypeNode(xmlNode);
@@ -153,15 +155,16 @@ export class InstrumentReader {
                 noteDuration = this.getNoteDurationForTuplet(xmlNode);
                 isTuplet = true;
               }
-            } catch (ex) {
+            } else {
               let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid Note Duration.");
               this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-              Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg, ex);
+              Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
               continue;
             }
-
           }
+
           let restNote: boolean = xmlNode.element("rest") !== undefined;
+          Logging.log("New note found!", (xmlNode.element("duration") as any).elem, noteDivisions, noteDuration.toString(), restNote);
           let isGraceNote: boolean = xmlNode.element("grace") !== undefined || noteDivisions === 0 || isChord && lastNoteWasGrace;
           let musicTimestamp: Fraction = currentFraction.clone();
           if (isChord) {
@@ -237,11 +240,10 @@ export class InstrumentReader {
         } else if (xmlNode.name === "attributes") {
           let divisionsNode: IXmlElement = xmlNode.element("divisions");
           if (divisionsNode !== undefined) {
-            try {
-              this.divisions = parseInt(divisionsNode.value, 10);
-            } catch (e) {
+            this.divisions = parseInt(divisionsNode.value, 10);
+            if (isNaN(this.divisions)) {
               let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError", "Invalid divisions value at Instrument: ");
-              Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg, e.toString());
+              Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
               this.divisions = this.readDivisionsFromNotes();
               if (this.divisions > 0) {
                 this.musicSheet.SheetErrors.push(errorMsg + this.instrument.Name);

+ 2 - 0
src/MusicalScore/ScoreIO/VoiceGenerator.ts

@@ -85,6 +85,7 @@ export class VoiceGenerator {
     ): Note {
         this.currentStaffEntry = parentStaffEntry;
         this.currentMeasure = parentMeasure;
+        Logging.debug("read called:", restNote);
         try {
             this.currentNote = restNote
                 ? this.addRestNote(noteDuration, divisions)
@@ -264,6 +265,7 @@ export class VoiceGenerator {
     private addSingleNote(
         node: IXmlElement, noteDuration: number, divisions: number, graceNote: boolean, chord: boolean, guitarPro: boolean
     ): Note {
+        Logging.debug("addSingleNote called");
         let noteAlter: AccidentalEnum = AccidentalEnum.NONE;
         let noteStep: NoteEnum = NoteEnum.C;
         let noteOctave: number = 0;

+ 1 - 1
src/MusicalScore/VoiceData/Instructions/RhythmInstruction.ts

@@ -46,7 +46,7 @@ export class RhythmInstruction extends AbstractNotationInstruction {
     }
 
     public ToString(): string {
-        return "Rhythm: " + this.rhythm.ToString();
+        return "Rhythm: " + this.rhythm.toString();
     }
 }
 

+ 2 - 2
src/MusicalScore/VoiceData/Note.ts

@@ -135,9 +135,9 @@ export class Note {
     }
     public ToString(): string {
         if (this.pitch !== undefined) {
-            return this.Pitch.ToString() + ", length: " + this.Length.ToString();
+            return this.Pitch.ToString() + ", length: " + this.Length.toString();
         } else {
-          return "rest note, length: " + this.Length.ToString();
+          return "rest note, length: " + this.Length.toString();
         }
     }
     public getAbsoluteTimestamp(): Fraction {

+ 21 - 16
test/MusicalScore/ScoreIO/MusicSheetReader.ts

@@ -2,35 +2,39 @@ import {MusicSheetReader} from "../../../src/MusicalScore/ScoreIO/MusicSheetRead
 import {MusicSheet} from "../../../src/MusicalScore/MusicSheet";
 import {IXmlElement} from "../../../src/Common/FileIO/Xml";
 
-// Fixture has no typings yet, thus declare it as 'any'
-declare var fixture: any;
-
 describe("Music Sheet Reader Tests", () => {
-
     // Initialize variables
     let path: string = "/test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
     let reader: MusicSheetReader = new MusicSheetReader();
-    let root: IXmlElement;
+    let score: IXmlElement;
     let sheet: MusicSheet;
 
+    function getSheet(filename: string): Document {
+      return ((window as any).__xml__)[filename];
+    }
+
     before((): void => {
-        fixture.setBase("base");
+        let parser: DOMParser = new DOMParser();
+        let dict: { [filename: string]: any; } = (window as any).__xml__;
+        for (let filename in dict) {
+          if (dict.hasOwnProperty(filename)) {
+            dict[filename] = parser.parseFromString(dict[filename], "text/xml");
+          }
+        }
+        // Load the xml file
+        let doc: Document = getSheet("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        chai.expect(doc).to.not.be.undefined;
+        score = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
+        // chai.expect(score).to.not.be.undefined;
+        sheet = reader.createMusicSheet(score, path);
     });
 
-    // Load the xml files
     beforeEach((): void => {
-      fixture.load(path);
-      // console.log(this.result[0].length, typeof this.result, typeof this.result[0], this.result[0].substr, this.result[0].getElementById);
-      let container: Element = document.getElementById("fixture_container");
-      let documentElement: IXmlElement = new IXmlElement(container);
-      chai.expect(documentElement.elements("score-partwise").length).to.equal(1);
-      root = documentElement.element("score-partwise");
-      chai.expect(root).to.not.be.undefined;
-      sheet = reader.createMusicSheet(root, path);
+      // ???
     });
 
     afterEach((): void => {
-      fixture.cleanup();
+      // cleanup?
     });
 
     it("Read title and composer", (done: MochaDone) => {
@@ -54,6 +58,7 @@ describe("Music Sheet Reader Tests", () => {
         chai.expect(sheet.Instruments.length).to.equal(2);
         chai.expect(sheet.InstrumentalGroups.length).to.equal(2);
         console.log("SheetErrors: ", sheet.SheetErrors);
+        console.log("Sheet", sheet);
         chai.expect(sheet.Instruments[0].Name).to.equal("Piano (right)");
         chai.expect(sheet.Instruments[1].Name).to.equal("Piano (left)");
         done();

+ 81 - 81
test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml

@@ -82,7 +82,7 @@
             <per-minute>156</per-minute>
             </metronome>
           </direction-type>
-        <sound tempo="156"/>
+        <sound tempo="156"></sound>
         </direction>
       <direction placement="above">
         <direction-type>
@@ -91,7 +91,7 @@
             <per-minute>156</per-minute>
             </metronome>
           </direction-type>
-        <sound tempo="156"/>
+        <sound tempo="156"></sound>
         </direction>
       <direction placement="above">
         <direction-type>
@@ -105,7 +105,7 @@
             <per-minute>156</per-minute>
             </metronome>
           </direction-type>
-        <sound tempo="156"/>
+        <sound tempo="156"></sound>
         </direction>
       <note default-x="71.83" default-y="-15.00">
         <pitch>
@@ -360,7 +360,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -382,7 +382,7 @@
             <p></p>
             </dynamics>
           </direction-type>
-        <sound dynamics="54.44"/>
+        <sound dynamics="54.44"></sound>
         </direction>
       <note default-x="54.33" default-y="-15.00">
         <pitch>
@@ -1167,20 +1167,20 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
         </note>
       <barline location="right">
         <bar-style>light-heavy</bar-style>
-        <repeat direction="backward"/>
+        <repeat direction="backward"></repeat>
         </barline>
       </measure>
     <measure number="16" width="136.26">
       <barline location="left">
         <bar-style>heavy-light</bar-style>
-        <repeat direction="forward"/>
+        <repeat direction="forward"></repeat>
         </barline>
       <direction placement="below">
         <direction-type>
@@ -1188,7 +1188,7 @@
             <p></p>
             </dynamics>
           </direction-type>
-        <sound dynamics="54.44"/>
+        <sound dynamics="54.44"></sound>
         </direction>
       <note default-x="12.47" default-y="-20.00">
         <pitch>
@@ -1423,10 +1423,10 @@
       <direction placement="below">
         <direction-type>
           <dynamics>
-            <f/>
+            <f></f>
             </dynamics>
           </direction-type>
-        <sound dynamics="106.67"/>
+        <sound dynamics="106.67"></sound>
         </direction>
       <note default-x="12.00" default-y="5.00">
         <pitch>
@@ -1722,7 +1722,7 @@
         <stem>down</stem>
         </note>
       <note default-x="26.37" default-y="5.00">
-        <chord/>
+        <chord></chord>
         <pitch>
           <step>G</step>
           <octave>5</octave>
@@ -1733,13 +1733,13 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -1752,7 +1752,7 @@
             <p></p>
             </dynamics>
           </direction-type>
-        <sound dynamics="54.44"/>
+        <sound dynamics="54.44"></sound>
         </direction>
       <note default-x="12.00" default-y="-50.00">
         <pitch>
@@ -2017,7 +2017,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -2148,12 +2148,12 @@
         <stem>up</stem>
         <notations>
           <articulations>
-            <staccato/>
+            <staccato></staccato>
             </articulations>
           </notations>
         </note>
       <note default-x="12.00" default-y="-30.00">
-        <chord/>
+        <chord></chord>
         <pitch>
           <step>G</step>
           <octave>4</octave>
@@ -2174,12 +2174,12 @@
         <stem>up</stem>
         <notations>
           <articulations>
-            <staccato/>
+            <staccato></staccato>
             </articulations>
           </notations>
         </note>
       <note default-x="42.81" default-y="-35.00">
-        <chord/>
+        <chord></chord>
         <pitch>
           <step>F</step>
           <octave>4</octave>
@@ -2200,12 +2200,12 @@
         <stem>up</stem>
         <notations>
           <articulations>
-            <staccato/>
+            <staccato></staccato>
             </articulations>
           </notations>
         </note>
       <note default-x="73.63" default-y="-40.00">
-        <chord/>
+        <chord></chord>
         <pitch>
           <step>E</step>
           <octave>4</octave>
@@ -2226,12 +2226,12 @@
         <stem>up</stem>
         <notations>
           <articulations>
-            <staccato/>
+            <staccato></staccato>
             </articulations>
           </notations>
         </note>
       <note default-x="104.44" default-y="-45.00">
-        <chord/>
+        <chord></chord>
         <pitch>
           <step>D</step>
           <octave>4</octave>
@@ -2246,10 +2246,10 @@
       <direction placement="below">
         <direction-type>
           <dynamics>
-            <f/>
+            <f></f>
             </dynamics>
           </direction-type>
-        <sound dynamics="106.67"/>
+        <sound dynamics="106.67"></sound>
         </direction>
       <note default-x="12.00" default-y="-50.00">
         <pitch>
@@ -2814,20 +2814,20 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
         </note>
       <barline location="right">
         <bar-style>light-heavy</bar-style>
-        <repeat direction="backward"/>
+        <repeat direction="backward"></repeat>
         </barline>
       </measure>
     </part>
@@ -2864,13 +2864,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -2888,13 +2888,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -2912,7 +2912,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -2928,7 +2928,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -2946,7 +2946,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3013,13 +3013,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3037,13 +3037,13 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3115,13 +3115,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3237,13 +3237,13 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3351,13 +3351,13 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3380,7 +3380,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3396,7 +3396,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3414,7 +3414,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3430,7 +3430,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3492,20 +3492,20 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <barline location="right">
         <bar-style>light-heavy</bar-style>
-        <repeat direction="backward"/>
+        <repeat direction="backward"></repeat>
         </barline>
       </measure>
     <measure number="16" width="136.26">
       <barline location="left">
         <bar-style>heavy-light</bar-style>
-        <repeat direction="forward"/>
+        <repeat direction="forward"></repeat>
         </barline>
       <note default-x="12.47" default-y="-70.00">
         <pitch>
@@ -3571,7 +3571,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3681,7 +3681,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3697,7 +3697,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3782,13 +3782,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3806,13 +3806,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3830,7 +3830,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3846,7 +3846,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3869,7 +3869,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3931,13 +3931,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3955,13 +3955,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -3979,7 +3979,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -3995,7 +3995,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -4013,13 +4013,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -4132,13 +4132,13 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -4246,13 +4246,13 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>4</duration>
         <voice>1</voice>
         <type>half</type>
@@ -4275,7 +4275,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -4291,7 +4291,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -4309,7 +4309,7 @@
         <stem>down</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -4325,7 +4325,7 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
@@ -4387,14 +4387,14 @@
         <stem>up</stem>
         </note>
       <note>
-        <rest/>
+        <rest></rest>
         <duration>2</duration>
         <voice>1</voice>
         <type>quarter</type>
         </note>
       <barline location="right">
         <bar-style>light-heavy</bar-style>
-        <repeat direction="backward"/>
+        <repeat direction="backward"></repeat>
         </barline>
       </measure>
     </part>