| ILOG JRules User Guide > Integrating Application Data > Reference > Mapping Between XML Schema and Dynamic Classes > Schema Types > Complex Type Extension |
Complex Type Extension |
PREVIOUS NEXT |
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 {
...
}
}
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |