Powered by SmartDoc

extends

The extention syntax attribute extends specifies a parent class name for a target class.

Parameters

The extends attribute takes a string value for a Java class name of a parent class.

Artifact

A base class of the target class will be the Java class specified by the extends attribute.

Example

List 8.7.3.1[grammarExtends.rng] is a sample schema for the extends attribute. A element has the extends attribute which has value 'MyBase'.

grammarExtends.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:java="http://www.relaxer.org/xmlns/relaxer/java"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address" java:extends="MyBase">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>