OpenSheetMusicDisplay
    Preparing search index...

    Function removeWhitespaceBetweenElements

    • Removes the white space between the elements of an XML string (line breaks and indentation), which is a third to a half of a typical MusicXML file. The parser creates a text node for each of them, though they mean nothing in MusicXML, whose elements contain either elements or text. Without them, the browser parses the file about a quarter faster and the document needs less memory. The text of elements is kept, also when it is only white space (<words> </words>): white space is only removed next to an element's child elements. A string with a CDATA section or entity declarations (rare in MusicXML) is returned unchanged, as tags inside of them are text.

      Parameters

      • xml: string

      Returns string