by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Name

parentRef — Reference to a named pattern from the parent grammar

Synopsis

element parentRef
{
 attribute name { xsd:NCName },
 (
 attribute ns { text }?,
 attribute datatypeLibrary { xsd:anyURI }?,
 attribute * - (rng:* | local:*) { text }*
 ),
 ( element * - rng:* { ... }* )
}

Class

pattern

May be included in

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

Compact syntax equivalent

parent

Description

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

Example

<define name="born-element">
  <element name="born">
    <text/>
  </element>
</define>
<define name="author-element">
  <grammar>
    <start>
      <element name="author">
        <attribute name="id"/>
        <ref name="name-element"/>
        <parentRef name="born-element"/>
        <optional>
          <ref name="died-element"/>
        </optional>
      </element>
    </start>
    <define name="name-element">
      <element name="name">
        <text/>
      </element>
    </define>
    <define name="died-element">
      <element name="died">
        <text/>
      </element>
    </define>
  </grammar>
</define>

Attributes

datatypeLibrary

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

name

This attribute specifies the name of the named pattern that is referenced.

ns

This attribute defines the default namespace for the elements defined in a portion of schema. The value is inherited.


This text is released under the Free Software Foundation GFDL.