Support for arbitrary XML data sources
Genero Report Writer can produce reports from arbitrary XML input sources.
The xml source is described by an XML Schema. The Open schema file dialog proposes rdd and xsd file formats.
If an xsd file is selected, the designer interprets the file as follows:
- Any XML Attribute is considered a variable.
- Any simple type element with minOccurs=1 and maxOccurs=1 is considered a variable.
- Any complex type elements with minOccurs=0 or maxOccurs>1 produce triggers.
For an example, see the Table.4rp report design document in the Reports sample project, located under the OrderReportXML application node. Open this report to see the OrderData.xsd used as data schema for the report (as shown in the Data View tab).
Encoding null values in the data
xsi:nil
” (with “xsi
” representing the namespace
“http://www.w3.org/2001/XMLSchema-instance
”) can be used on an empty element to
denote a null value. The RTL function isNull()
for input variables will return true
for such a variable. For example, consider the following document fragment:
<input xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
…
<productReference xsi:nil=”true”></productReference>
The RTL expression productReference.isNull()
will yield true for this instance of
the variable.Limitations
Recursive references are not supported. Elements involved in a recursive reference will be ignored by the designer.
- It is an XML simple type element with minOccurs="0".
- It is an XML Attribute without use="required" in the schema definition.
Simple type element with minOccurs="0" are discarded by the designer. No variable is created.
The designer creates variables for optional attributes and issues a warning. An error occurs if the variable is not present at runtime.
The Genero application
When you declare the data of a report design document (.4rp) to use an arbitrary XML data
sources, you must use the fgl_report_runFromXML
API function in your report. See
fgl_report_runFromXML.