ILOG JRules User Guide > Integrating Application Data > Tasks > Using the XML Binding API > Writing to an XML Document

During serialization, an XML object is represented as XML data.

To write an IlrXmlObject to an XML document:

IlrReflect model = ... // the model specifying the structure of the
                          XML document
IlrXmlObject myObject = ... // An existing XML object
try {
   driver.setModel ( model ); // not necessary if the schema is already loaded
   Writer writer = new FileWriter ("xmlFile.xml");
   driver.writeObject ( myObject, writer );
} catch ( IlrXmlErrorException e ) {
   // some loading error
}

Related Concepts

XML Binding

Related Tasks

Adding XML Objects to the Working Memory
Using XML Objects as Ruleset Parameters
Assigning the Root Element Name of an XML Object
Reading an XML Document
Managing Unknown Operators on Attributes and Elements
Configuring XML Binding