Name

parent — Reference to a named pattern from the parent grammar

Synopsis

“parent” identifier
                  

Restrictions

pattern

May be included in

(pattern), attribute, datatypeName param exceptPattern, element, list, mixed, pattern&pattern, pattern*, pattern+, pattern,pattern, pattern?, pattern|pattern

XML syntax equivalent

parentRef

Description

The parent pattern is a reference to a named pattern belonging to the parent grammar, the grammar in which the current grammar is included. The scope of named patterns is usually limited to the grammar in which they are defined. The parent pattern provides a way to extend this scope and refer to named patterns defined in the parent grammar.

Example

born-element = parent born-element

start =
   attribute id { parent id-content },
   attribute available { parent available-content },
   element isbn { parent isbn-content },
   element title { parent title-content },
   element author { parent author-content }*,
   element character { parent character-content }*

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.