Colby-CPU-Sim / CPUSim

GNU General Public License v3.0
52 stars 18 forks source link

Replace the DTD with an XSD for validating CPU Files #113

Open Nava2 opened 7 years ago

Nava2 commented 7 years ago

Currently, we use a DTD description for CPU files, however, DTDs have largely been deprecated in favour of XSDs.

I started work on this with this file: https://gist.github.com/Nava2/3cd7b418ee9030e6b6d71e2b715b19f6

This allows for several features:

  1. The order of elements can be constrained in different ways, for example, grouping MicroInstructions and Modules and inside there, order is irrelevant.
  2. Support in IntelliJ makes this handy
  3. Better typing support

Rather than working on this by hand, though. It is probably better to use JAXB annotations.

djskrien commented 7 years ago

This sounds great to me. We need to preserve backwards compatibility, however. Will that be a problem?

On Jan 30, 2017, at 12:11 PM, Kevin Brightwell notifications@github.com wrote:

Currently, we use a DTD description for CPU files, however, DTDs have largely been deprecated in favour of XSDs.

I started work on this with this file: https://gist.github.com/Nava2/3cd7b418ee9030e6b6d71e2b715b19f6

This allows for several features:

• The order of elements can be constrained in different ways, for example, grouping MicroInstructions and Modules and inside there, order is irrelevant. • Support in IntelliJ makes this handy • Better typing support Rather than working on this by hand, though. It is probably better to use JAXB annotations.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Nava2 commented 7 years ago

XSD has the excellent feature of allowing for "optional" tags, so nope! Shouldn't be. Also, the XSD would only be validated when used with new versions, old one still falling back to the older version. Ideally, always read old, only write new.