ILOG JRules User Guide > Integrating Application Data > Reference > Mapping Between XML Schema and Dynamic Classes > Schema Types > Local Simple Types Mapped onto Inner Classes

This example shows how to map embedded local simple types onto inner classes.

Note
The inner class policy is by default activated.

The example includes an element named ident that contains a simple type restriction. The simple type is represented in the XOM by the dynamic class BorrowedBook.Ident.

Here is the schema:

<complexType name="borrowed-book">
  <sequence>
    <element name="ident"/>
      <simpleType>
         <restriction base="string">
            <pattern value="A[0-9]*"/>
        </restriction>
      </simpleType>
    </element>
  </sequence>
</complexType>

Here is the excerpt from an XML document:

<borrowed-book>
  <ident>12345</ident>
</borrowed-book>

Here is the XOM representation:

class BorrowedBook extends IlrXmlObject
{
  class Ident
  { 
     ...
  };
} 

And here is the rule:

rule identifyBorrowedBook
{
   when {
        b: BorrowedBook (  );
        BorrowedBook.Ident equals "12345";
   }
   then {
      ...
   }
}

Related Reference

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