[tei-council] Wot is wrong with my ODD?

Lou Burnard lou.burnard at retired.ox.ac.uk
Sat Jun 7 07:26:32 EDT 2014


A little more experimentation shows that @allowText only works as you'd 
expect in a very small number of specific cases, and can also lead to 
your generating an invalid schema.

We did say that the implementation of pureODD is still experimental!

For example:

   <elementSpec ident="stuff">
           <desc>élément racine d'un schéma simplissime</desc>
           <content allowText="true">
                <elementRef key="bit"/>
               <elementRef key="bob"/>
               <elementRef key="t1"/>
           </content>
         </elementSpec>

does what you'd expect and generates the following RNC

  element stuff { (text | bit | bob | t1)* }

(it  produces the following nonsense in DTD though

<!ELEMENT stuff (#PCDATA | bitbobt1)*>

- that's a bug!)

Placing @allowText on <alternate> or <sequence> however has no effect:

  <content >
               <alternate allowText="true" minOccurs="0" 
maxOccurs="unbounded">
                 <elementRef key="bit"/>
                <elementRef key="bob"/>
               <elementRef key="t1"/>
               </alternate>
           </content>

generates

element stuff { ( bit | bob | t1)* }

(but at least the DTD generated is correct)

The presence of @allowText also implies alternation of its children.

Hence:

  <content  allowText="true">
               <alternate  minOccurs="0" maxOccurs="unbounded">
                 <elementRef key="bit"/>
                <elementRef key="bob"/>
               <elementRef key="t1"/>
               </alternate>
           </content>

generates this monster
* element stuff { (text | (text | bit | bob | t1)*)* }*

I think the rule of thumb is that @allowText="true" will always try to 
generate a valid XML mixed content model and hence it usually makes 
sense only on <content>

I note also that the only example of how to use @allowText in the 
Guidelines is within a macro spec, which is probably a little unhelpful.

Definitive word must await the return of the mighty Rahtz from 
Brussells, where I assume he is busy ensuring the election of Herr Juncker.


On 07/06/14 01:17, Martin Holmes wrote:
> Hi Lou,
>
> On 14-06-06 02:48 PM, Lou Burnard wrote:
>> On 06/06/14 22:18, Martin Holmes wrote:
>>> I'm trying to create a content model for <seg> using the new TEI ODD
>>> elements. I want to allow any of a small number of elements, with text
>>> mixed in, or just text. I have this:
>>>
>>> <elementSpec ident="seg" mode="change">
>>>       <content>
>>>         <alternate allowText="true">
>>>           <macroRef key="data.text"/>
>>>           <sequence allowText="true" preserveOrder="false" minOccurs="0">
>>>             <elementRef key="orgName" maxOccurs="unbounded" minOccurs="0"/>
>>>             <elementRef key="persName" maxOccurs="unbounded" minOccurs="0"/>
>>>             <elementRef key="choice" maxOccurs="unbounded" minOccurs="0"/>
>>>             <elementRef key="seg" maxOccurs="unbounded" minOccurs="0"/>
>>>             <elementRef key="trait" maxOccurs="unbounded" minOccurs="0"/>
>>>           </sequence>
>>>         </alternate>
>>>       </content>
>>> </elementSpec>
>> I would represent what I think you want (but I may be completely
>> misunderstanding it...)  much more simply  :
>>
>> <elementSpec ident="seg" mode="change">
>>       <content>
>>         <sequence allowText="true" preserveOrder="false">
>>             <elementRef key="orgName" maxOccurs="unbounded" minOccurs="0"/>
>>             <elementRef key="persName" maxOccurs="unbounded" minOccurs="0"/>
>>             <elementRef key="choice" maxOccurs="unbounded" minOccurs="0"/>
>>             <elementRef key="seg" maxOccurs="unbounded" minOccurs="0"/>
>>             <elementRef key="trait" maxOccurs="unbounded" minOccurs="0"/>
>>         </sequence>
>>       </content>
>> </elementSpec>
> That's what I actually started with, so we're both on the same page
> regarding how we expect things to work.
>
>> However, that doesn't seem to work as it should. There was a bug in the
>> stylesheets in the handling of @allowText which I thought Sebastian had
>> fixed. But maybe he hasn't allowed for this attribute to appear on
>> <sequence>.
> I've been using the Oxygen ant task to generate the schema, but if
> Sebastian's fixed a bug recently then I should probably try again with
> the latest Stylesheets. I'll do that and report back.
>
> Cheers,
> Martin
>
>> I don't think the macroRef does what you want -- it inserts a reference
>> to data.text, not text.
>>
>>



More information about the tei-council mailing list