dataref @restriction can't be combined with @ref?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

dataref @restriction can't be combined with @ref?

Peter Boot-3
Hello all,

In my odd I define a new attribute as follows:

<attDef ident="sim" mode="add">
  <datatype>
    <dataRef ref="teidata.text" restriction="[A-Z](\s[A-Z])*"/>
  </datatype>
</attDef>

The generated rng does not take the restriction into account and just generates a string data type:

<attribute name="sim">
   <data type="string"/>
</attribute>

When I modify the definition as follows:

<attDef ident="sim" mode="add">
  <datatype>
    <dataRef name="string" restriction="[A-Z](\s[A-Z])*"/>
  </datatype>
</attDef>

what is generated is, as expected:

<data type="string">
   <param name="pattern">[A-Z](\s[A-Z])*</param>
</data>

Apparently the schema generation does not use the restriction attribute when a datatype is referred to using ref?  

If this is working as designed, maybe it could be documented with the restriction attribute.

Thanks,
Peter

lou
Reply | Threaded
Open this post in threaded view
|

Re: dataref @restriction can't be combined with @ref?

lou
I think this is because tei.data datatypes are fixed macros that can't be modified. If you want to change one you need to define a new datatype using dataSpec. But I agree it seems strange. 

On Thu, 18 Jun 2020, 13:05 Peter Boot, <[hidden email]> wrote:
Hello all,

In my odd I define a new attribute as follows:

<attDef ident="sim" mode="add">
  <datatype>
    <dataRef ref="teidata.text" restriction="[A-Z](\s[A-Z])*"/>
  </datatype>
</attDef>

The generated rng does not take the restriction into account and just generates a string data type:

<attribute name="sim">
   <data type="string"/>
</attribute>

When I modify the definition as follows:

<attDef ident="sim" mode="add">
  <datatype>
    <dataRef name="string" restriction="[A-Z](\s[A-Z])*"/>
  </datatype>
</attDef>

what is generated is, as expected:

<data type="string">
   <param name="pattern">[A-Z](\s[A-Z])*</param>
</data>

Apparently the schema generation does not use the restriction attribute when a datatype is referred to using ref? 

If this is working as designed, maybe it could be documented with the restriction attribute.

Thanks,
Peter