| ILOG JRules User Guide > Integrating Application Data > Tasks > Using the XML Binding API > Configuring XML Binding > Configuring the Mapping Between XML Schema and Dynamic Classes |
Configuring the Mapping Between XML Schema and Dynamic Classes |
PREVIOUS NEXT |
XML binding provides a default mapping between the XML Schema and the Java model. The ilog.rules.xml.util.IlrXmlDefaultXomMapper class implements the default mapping behavior. However, you can modify this mapping by implementing a special interface ilog.rules.xml.util.IlrXmlXomMapper and the ilog.rules.xml.xomMapper property, and declaring it to the driver using the resource file.
In order to modify the way XML elements are mapped to Java identifiers, you can implement the following methods of the IlrXmlXomMapper interface:
formatClassName
formatSimpleTypeName
formatFieldName
formatAnyFieldName
formatNewIdentifier
formatContentFieldName
The isInnerClass method indicates whether or not the XSD local types are mapped to dynamic inner Java types, and the mapComplexType method indicates which Java class maps to a given complex type.
The default mapping is the ilog.rules.xml.IlrXmlObject. If you define a different mapping, the new mapping class must:
IlrXmlObject, directly or indirectly
If the new mapping class contains Java fields, you can map XML attributes or elements to these fields. The mapXomField method indicates for each XOM field their related Java field as a java.lang.reflect.Field instance. If the mapping is dynamic, the method should return a null value.
In addition, the Java field must:
mapXomField parameter
The following procedure shows an example of a mapping that changes the default behavior slightly.
To configure the mapping to change default behavior:
MyXmlObject Java class, which inherits from ilog.rules.xml.IlrXmlObject.
xomField1 of type java.lang.String on the Java field javaField1 of the MyXmlObject class.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |