Local complex types mapped to inner classes

Local complex types map to inner classes.

Note:

The inner class policy is activated by default.

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

The example includes a rule named processBorrowedBook that matches “Smith” with the attribute surname of an instance of the inner class borrower.

Here is the schema:

<complexType name="borrowed-book">
  <sequence>
    <element name="ident" />
    <element name="borrower">
      <complexType>
        <sequence>
           <element name="name">
           <element name="surname">
        </sequence>
      </complexType>
    </element>
  </sequence>
</complexType>

Here is the excerpt from an XML document:

<borrowed-book>
  <ident>12345</ident>
  <borrower>
    <name>John</name>
    <surname>Smith</surname>
  </borrower>
</borrowed-book>

Here is the XOM representation:

class BorrowedBook extends IlrXmlObject
{
  class Borrower extends IlrXmlObject
  { 
     String name;
     String surname;
  };
  String ident;
  Borrower borrower;
} 

And here is the rule:

rule processBorrowedBook
{
   when {
        b: BorrowedBook (  );
        BorrowedBook.Borrower ( surname equals "Smith" ) from b.borrower;
   }
   then {
      …
   }
}