6.1. JAVA programming

In Java, you must first compile the source files with X-definitions. The first parameter of the method is the Properties for the translation (this parameter can be null or empty Properties and the default values of the compilation are used). The result of the compilation is an XDPool object:
  Properties props = new Properties();
  File xdef1, xdef2;
  XDPool xpool = XDFactory.compileXD(props, xdef1, xdef2);
From the XDPool object it is possible to create the XDDocument object, in which the name X=definition is entered, which contains the data model to be worked with:
  XDDocument xdoc = xpool.createXDDocument("Xdef1");
Before work, it is advisable to prepare a reporter in which information about the process will be recorded. Then it is possible to start the validation or construction mode of processing:
  ArrayReporter reporter = new ArrayReporter();
  xdoc.xparse(data, reporter); // validation
  ...
  xdoc.xcreate(data, reporter); // construction
  // check errors
  if (reporter.errors()) ...