| ILOG JRules User Guide > Integrating Application Data > Reference > Mapping Between XML Schema and Dynamic Classes > Schema Types > Local Complex Types Mapped to Inner Classes |
Local Complex Types Mapped to Inner Classes |
PREVIOUS NEXT |
This example shows how to map embedded local complex types onto inner classes.
| Note |
| The inner class policy is activated by default. |
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 {
...
}
}
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |