Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DIY Schema Validation for Workmanlike ONIXDIY Schema Validation for Workmanlike ONIX


NOTE: This is dated documentation that has been superseded by much better EDItEUR documentation available at:

https://www.editeur.org/93/Release-3.0-Downloads/#How%20to

The information below may be of interest.  There is no fundamental difference, as a procedure, between validating ONIX 2.1 and ONIX 3.0 except in the sense the actual XSD schemas are completely distinct, but the following is focused on 2.1 and doesn't include any information on EDItEUR's strict schema for ONIX 3.0 which is an excellent tool for ensuring your ONIX follows best practices.


...


You can't really understand anything done in XML unless you know how to do a proper XML validation of the file. For validation you need three things:

...

Locally Installing your files

Unitl Until recently EDItEUR supported ONIX 2.1 in a way that allowed you to do a standard DTD validation over the internet using files stored on the Editeur's server.  That put a huge demand on Editeur's bandwidth and resources, so they've long asked all users install their reference files locally. As noted above, they have now gleefully taken away that option.  ONIX 3.0 has never offered it.  So like the change to Schemas from DTDs, local file installation is now just a normal part of the ONIX 2.1 and 3.0 world.

...

XML Nanny is excellent, simple software but some users have reported a line limit on XML Nanny where the software reports an error at line 65,535 when the actual error is many lines further down the file.  It appears that citation is accurate – an error exists – but the line reporting stops working.  If XML Nanny reports the file is fine, it is.  It's only if it reports an error after line 65,535 that this crops up.  On the assumption working solution to an issue is better than nothing and that you might have access to a PC, if you think you've encountered this issue and need a workaround try ONIX file splitter:

Free ONIXEdit Splitter

It's excellent software and reliably splits any size of ONIX file of either version, into same sized pieces which can be individually validated if you think you've run into this issue.

Linux and MAC

xmllint comes installed in most Linux versions and on many Macs as well.  It's a command line XML parser which means you'll need to write small scripts to do validations. I'm not going to illustrate any more than the below (and don't use this unless you're more comfortable using command line tools than me), but this example is intended for a Mac, with the username "Bob" with a folder called "schema" on his "Desktop", containing (in this case) the ONIX 2.1 reference schema "ONIX_BookProduct_Release2.1_reference.xsd",  The Desktop contains an ONIX file "TestOnix.xml" which has been set up for schema as noted below.  

Note that there are some instructions in the "Reference or Short Tag" section below on how to confirm the file location on a MAC – you have to be absolutely right in your location or it doesn't work. And you need to understand the difference between Reference or Short tags as well.  All that is discussed below in more detail.

This worked for me using Terminal:

Code Block
xmllint --schema /Users/Bob/Desktop/schema/ONIX_BookProduct_Release2.1_reference.xsd /Users/Bob/Desktop/TestOnix.xml

You can find a full listing of commands here:

Java

Java based programs should workon any system but are seldom free.  I'll illustrate oXygen as it's often recommended for working with ePub.  It's expensive but you can get it on a 30 day trial.  Any of the versions Editor / Developer / Author will work for validation.

www.oxygenxml.com 

...


The are lots more possible tools out there, but to use any of them you'll need to have the actual ONIX documents:

...

So here are two starter files – use these instead of cut and paste from this document – you'll save time and eliminate a source of errors:

DIY Schema Validation for Workmanlike ONIX

DIY Schema Validation for Workmanlike ONIX97747107

97747107

The trick is never to overwrite the declarations.  Problems in the declaration are especially tricky to troubleshoot as they prevent the XML software from working at all.  That makes the error message especially vague – or absent.  See troubleshooting below.

...

And here are two starter files:

DIY Schema Validation for Workmanlike ONIX

DIY Schema Validation for Workmanlike ONIX97747107

97747107

Reference or Short Tag?

Hopefully you know this already. ONIX comes in two tag types: Reference and Short. There's no functional difference between the two sets -- but in the schemas you downloaded you can see some are labelled for Short and others for Reference. The tag names used each are a unique set (no overlap), but there is a one-to-one correspondence between them, so the tag sets carry the same meaning only they just appear differently. Why? Well if you had a very big ONIX file of thousands of records, you'll find that a "short" tag file might be as much as 30% smaller. It can help processing.  It doesn't matter which you use, but Editeur and BookNet recommend Reference tags as the "preferred choice".

...

Note that it has two distinct declarations, the first invoking the .dtd, and a second one that cites the .xsd file.    


Have a look at the original declaration – particularly the first line:

...

Catch up to those go-getters already learning ONIX 3.0!  Experiment!  Have fun being the first kid in your bibliographic group to experiment with ONIX 3.0.  Here are equivalent starter files for it:

DIY Schema Validation for Workmanlike ONIX

DIY Schema Validation for Workmanlike ONIX97747107

97747107