pensoft / dev

Building on Pensoft's platforms? You've come to the right place.
1 stars 0 forks source link

Schema does not make submitting author requirement #7

Closed aliceh75 closed 10 years ago

aliceh75 commented 10 years ago

But PWT API won't accept an XML without a submitting author:

Xml is invalid!pwt.api.noSubmittingAuthor

Biserkov commented 10 years ago

XML Schema 1.1 supports assert which can be used to enforce such a rule:

<xsd:complexType name="title_and_authorsType">
    <xsd:sequence>
        ...
        <xsd:element name="author" type="authorType" minOccurs="1" maxOccurs="676"/>
    </xsd:sequence>
    <xsd:assert test="count(author/fields/submitting_author/value[text() = '1']) = 1" />
</xsd:complexType>

Unfortunately, currently, our tools support only XML schema 1.0 I'll look into upgrade possibilities...

Biserkov commented 10 years ago

I've found a validator that supports XML Schema 1.1. Should I proceed to integrate it into the API or would that cause problems on your end?

aliceh75 commented 10 years ago

I'm afraid libxml, which is used by PHP XML libraries, does not support XSD 1.1. We could look into alternative validators, but that's a lot of work for this simple feature. So if this can't be achieved with XSD 1.0, then it's probably easiest for me to add the test as a manual check on top of the XML validation.

Also I guess from your point of view, using the lesser supported xsd 1.1 would make it harder for other developers to use the API.

Biserkov commented 10 years ago

OK, I guess we'll stick with 1.0 ...

It sucks being stuck in 2001 (with errata from 2004), but deadlines!