ILOG JRules User Guide > Integrating Application Data > Tasks > Using the Dynamic XOM API > Writing a XOM using Java-Like Syntax

You can write a XOM using a Java-like syntax.

To write a XOM:

  1. Use the classes in ilog.rules.bom.util .
  2. The classes in ilog.rules.bom.util provide the utilities used for loading such a file into an object model. Here is an example of a class specified using this syntax:
package mypackage.binding;
 
public class Person
  extends ilog.rules.factory.IlrHashObject
  property "ilog.rules.engine.driver"
           "ilog.rules.factory.IlrHashDriver"
{
  public java.lang.String name;
  public int age;
  public Person();
}
  1. To read this class, create a reader with the above content.
  2. Use the following code to load the reader into the XOM:
import ilog.rules.bom.util.*;
 
Reader reader = ...;
try
{
  new IlrJavaSerializer().readObjectModel(reflect,reader);
}
catch(IlrSyntaxError ex)
{
  // we have to process the syntax error
      String[] messages = error.getErrorMessages();
    for (int i = 0; i < messages.length; i++) {
      System.err.println(messages[i]);
    }
    System.err(error.getMessage());
}

Related Concepts

XML Binding
Web Service Binding

Related Tasks

Creating a Dynamic Class
Invoking Dynamic Classes
Setting the Classpath to Contain the XOM and the Rule Engine
Writing a Ruleset Execution Method

Related Reference

Mapping Between XML Schema and Dynamic Classes

Related Samples and Tutorials

How to Run Rules Against XML Objects