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

During deserialization, an XML object is created from the XML document. You can then read the XML document and represent it as an IlrXmlObject instance. Errors may be thrown if the document format is not valid.

To read an XML document and represent it as an IlrXmlObject instance:

IlrReflect model = ... // the model representing the XML document
try {
  //return the root XML object of the XML file
   driver.setModel ( model ); // not necessary if the schema is already loaded
  Reader reader = new FileReader ("xmlFile.xml");
   IlrXmlObject myObject = driver.readObject (reader);
 
} catch ( IlrXmlErrorException e ) {
   // some reading errors
}

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
Writing to an XML Document
Managing Unknown Operators on Attributes and Elements
Configuring XML Binding