ILOG JRules User Guide > Integrating Application Data > Reference > Mapping Between XML Schema and Dynamic Classes > Schema Types > Complex Type Extension

In this example, the complex type book has been extended to computer-book by adding a new attribute named language. The example includes a rule named processComputerBook that matches "Java" with the title of a ComputerBook object.

Here is the schema:

<complexType name= "book" >
 <sequence>
   <element name="ident" type="string"/>
   <element name="title" type="string" />
 </sequence>
</complexType>
<complexType name="computer-book">
 <complexContent>
  <extension base="book">
    <sequence>
     <element name="language" type="string"/>
    </sequence>
  </extension>
 </complexContent>
</complexType>

Here is an excerpt from an XML document:

<computer-book>
  <ident>12345</ident>
  <title>ILOG JRules Reference Manual</title>
   <language>Java IRL</language>
</computer-book>

Here is the XOM representation:

class Book extends IlrXmlObject
{
   ...
     String ident;
     String title;
   ...
}
class ComputerBook extends Book
{
  String language;
   ...
}

And here is the rule:

rule processComputerBook
{
   when {
        ComputerBook ( language equals "Java" );
   }
   then {
      ...
   }
}

Related Reference

Built-in Simple Types
Simple Type Mapping
Simple Types Derived from Other Simple Types
List and Union Types
Local Simple Types Mapped onto Inner Classes
Complex Types
Extension of Simple Type Content in Complex Types
Complex Type Restriction
Local Complex Types Mapped to Inner Classes
Default Constructor Dynamic Methods
Type Identifier Mapping