MakeMusic
SmartMusic Finale Garritan MusicXML

Differences between XSD and DTD

Moderator: Michael Good

Differences between XSD and DTD

Postby Matthew.James.Briggs » Tue Jun 21, 2016 2:27 pm

I have built my model of MusicXML from the XSD (3.0) specification, but I see here

http://www.musicxml.com/for-developers/musicxml-xsd/

that XSD is stricter than DTD. I have also noticed that many MusicXML documents specify DTD validation in their DOCTYPE statements.

This is a concern as I am now working on import. Are the differences between DTD and XSD validation documented? Specifically, is there some list of those constructs which would be valid in DTD but invalid in XSD?

If not, does anyone have some experience with deriving this information from the specification?

Michael, in a much early question viewtopic.php?f=12&t=2692&p=8878&hilit=xsd#p8878
you suggested that an application should support both. In my case I am not actually going to use the dtd or xsd for validation because my data-model is so tightly bound to the xsd that it can only hold data that would validate against the xsd.

Thus I plan to use a non-validating parser and throw or message when I encounter items that don't match my data model.

However I would like to handle cases gracefully where the writing application used the dtd specification and I should do some manipulation to fit it into the xsd-valid structure.

Thanks!
Matt
“Now that things are so simple, there's so much to do.” - Morton Feldman
http://matthewjamesbriggs.com
User avatar
Matthew.James.Briggs
 
Posts: 23
Joined: May, 2014
Location: Seattle, WA, USA
Reputation: 0
Software Owned:
Max OS X, Finale, Logic Pro, XCode, Xmplify, Sublime Text

Re: Differences between XSD and DTD

Postby Michael Good » Tue Jun 21, 2016 7:48 pm

Hi Matt,

When you are reading MusicXML files, just validate against the XSD if that's easier. Don't worry about the DTD or the differences between the two. The XSD is more accurate.

What I meant by the earlier note is that it is good to write the DOCTYPE even if you validate against the XSD. The DOCTYPE doesn't require DTD validation, but makes it easier for MusicXML applications that do use the DTD to validate correctly.
Michael Good
VP of MusicXML Technologies
MakeMusic, Inc.
User avatar
Michael Good
 
Posts: 2197
Joined: March, 2014
Reputation: 0

Re: Differences between XSD and DTD

Postby Matthew.James.Briggs » Sun Jul 10, 2016 12:43 pm

As I work through my input test cases, I am finding things in the Lilypond MusicXML test suite that appear to be invalid per the XSD.

Here are some examples:

* 01e_Pitches_ParenthesizedAccidentals.xml incorrectly uses "double-flat" which should be "flat-flat" instead

* 22b_Staff_Notestyles.xml incorrectly has <slash> elements that are missing the required attribute 'use-stems' and the required child element 'slash-type'

* 32b_Atriculations_Texts.xml has a 'color' attribute on the 'words' element I have examined the xsd thoughouly and I believe this is illegal (though I'm surprised by this).

However, when I take the 32b file and request validation against the 3.0 Score Partwise DTD using this tool, it passes. The file is here

Am I now discovering the differences between MusicXML's DTD specification and MusicXML's XSD specification?

To be more specific:
    Is 'color' a legal attribute of the 'words' element when using the DTD?
    Is 'color' a legal attribute of the 'words' element when using the XSD?

Thanks.
“Now that things are so simple, there's so much to do.” - Morton Feldman
http://matthewjamesbriggs.com
User avatar
Matthew.James.Briggs
 
Posts: 23
Joined: May, 2014
Location: Seattle, WA, USA
Reputation: 0
Software Owned:
Max OS X, Finale, Logic Pro, XCode, Xmplify, Sublime Text

Re: Differences between XSD and DTD

Postby Michael Good » Mon Jul 11, 2016 11:47 am

The color attribute is legal on the words element in both the DTD and XSD.

In the XSD it's part of the color attribute group, which in turn is part of the print-style, print-style-align, and text-formatting attribute groups. The text-formatting attribute group is part of the formatted-text complex type, which is the type of the words element.

There's a similar chain of entity references in the DTD.
Michael Good
VP of MusicXML Technologies
MakeMusic, Inc.
User avatar
Michael Good
 
Posts: 2197
Joined: March, 2014
Reputation: 0

Re: Differences between XSD and DTD

Postby Matthew.James.Briggs » Sat Jul 23, 2016 8:46 am

Thanks, I'm finding some mistakes in my model that must have occurred when traversing attribute group references.
“Now that things are so simple, there's so much to do.” - Morton Feldman
http://matthewjamesbriggs.com
User avatar
Matthew.James.Briggs
 
Posts: 23
Joined: May, 2014
Location: Seattle, WA, USA
Reputation: 0
Software Owned:
Max OS X, Finale, Logic Pro, XCode, Xmplify, Sublime Text

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron