Name

data — data pattern

Synopsis

element data
{
 attribute type { xsd:NCName },
 (
 attribute ns { text }?,
 attribute datatypeLibrary { xsd:anyURI }?,
 attribute * - (rng:* | local:*) { text }*
 ),
 (
 ( element * - rng:* { ... }* )
 & ( element param { ... }*, element except { ... }? )
 )
}

Class

pattern

May be included in

attribute, choice, define, element, except, group, interleave, list, mixed, oneOrMore, optional, start, zeroOrMore

Compact syntax equivalent

datatypeName param exceptPattern

Description

The data pattern matches a single text node (i.e., token, or attribute value) and gives the possibility of restricting its values. It is different from the text pattern, which matches zero or more text nodes and doesn’t give any option for restricting the values of these text nodes. The restrictions are applied through the type attribute, which defines the datatype and the param and except child patterns.

Restrictions

The data pattern is meant for data-oriented applications and can’t be used in mixed content models.

Example

<attribute name="see-also">
 <list>
  <data type="token"/>
 </list>
</attribute>
    
<attribute name="id">
 <data type="NMTOKEN">
   <param name="maxLength">16</param>
 </data>
</attribute>
<element name="isbn">
 <data type="token">
  <except>
   <value>0836217462</value>
  </except>
 </data>
</element>

Attributes

datatypeLibrary

This attribute defines the default datatype library. The value is inherited.

ns

This attribute defines the default namespace for the elements defined in a portion of a ...

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.