proycon / foliatools

A number of command-line tools for working with FoLiA (Format for Linguistic Annotation). Includes validators, converters, visualisers, and more.
GNU General Public License v3.0
10 stars 4 forks source link

foliavalidator gives Uninformative message on missing version #6

Open kosloot opened 5 years ago

kosloot commented 5 years ago

test file:

<?xml version="1.0" encoding="UTF-8"?>
<FoLiA xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://ilk.uvt.nl/folia" xml:id="doc" generator="libfolia-v0.11">
  <metadata type="native">
    <annotations/>
  </metadata>
  <text xml:id="text">
    <p xml:id="p1">
      <t>Een tekst.</t>
    </p>
  </text>
</FoLiA>

The validator complains:

Error on line 0: Element FoLiA failed to validate attributes VALIDATION ERROR against RelaxNG schema (stage 1/3), in empty2.xml Element FoLiA failed to validate attributes

libfolia/folialint DOES accept this file, but will add a bogus version value of 1.4.987

I would expect a more informative message, like:
Element FoLiA failed: missing 'version' attribute
proycon commented 5 years ago

Hmm yeah, the validator actually does three stages, first it simply invokes the RelaxNG stylesheet, which produced messages like this. Only if that passes it processes the document with the library. The last stage is a serialisation check. If you want to do only library validation you can pass the --quick option, which should produce a better error too.

For FoLiA v2, the version attribute is mandatory.

kosloot commented 5 years ago

But that means that pre folia2.0 document that lack a version are always rejected. That's why I introduced the bogus value.

proycon commented 5 years ago

Ah right, that makes sense yes. I might need to do that too then,