Powered by SmartDoc

className

The extention syntax className specifies a class name for a class.

Target

The target of the className attribute is the class.

Parameters

The className attribute takes a string value for a class name of a target class.

Artifact

A class name for a target class will be the name specified by the className attribute.

Example

List 8.3.4.1[grammarClassName.rng] is a sample schema for the className attribute. In an element element named address, the className attribute is used. In this case, a name of a class from the element address will be MyAddress instead of Address.

grammarClassName.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" java:default="0"/>
      </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:className="MyAddress">
      <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>

Effects of the className attribute on the sample schema are described in Table 8.3.4.1[Effects of className].

Effects of className
element name with className without className
account Account Account
address MyAddress Address
phone Phone Phone