Basic Structure
The following is an example of about the simplest XML report which will actually run.
<?xml version='1.0' ?>
<!-- Example
Report
XML Report by Mike Weideli of Littlefield
Consultancy
Version 1 14 May 2008
-->
<CustomReport title="Ex1
ExampleReport" menupath="Example reports"
description="Nearly the
very minimum required for an XML report "
>
<SQL>
SELECT *
FROM Individual
<Where
keytype="Default">
</Where>
</SQL>
</CustomReport>
Copy the above (in green italics) and paste it into Notepad. Save the file with a file type of .xml (eg. as MyExample1.xml Note 1 ) into the Reports folder of Recorder (typically C:\Program Files\Recorder 6\ User Files\Reports). Customise the report by changing the following :-
The <SQL> tag is always required and there must always be a SELECT statement. The <Where> tag (not to be confused with the WHERE clause in SQL) is also required. In this example it is set to default. Other option will be explained later.
Save your changes then open Recorder 6. Any errors in the structure will give rise to an error message when Recorder 6 is opened. Check to ensure that you have not accidentally removed tags or attributes. A common mistake when editing the attributes is to accidentally remove one of the double quotation marks.
Run the report in Recorder using Report/Run, then choosing the report from the menu and clicking on OK.
As you progress through the examples in the following pages change this saved example to incorporate the new features.
Notes
1. By default Notepad will save files as .txt. Use the Save As option and change file type to All files. You should then be able to save the file as .xml. Alternatively you can change the way the files are displayed in Windows to always show the file type (extension). If this is done the file can be renamed .xml.
2. Spaces are generally ignored within XML so you can use them to indent the text, making it easier to read. The reports do not work if the first character is a space (ie. before the <xml) which can accidentally happen during copying.
3. The tags and attributes are case sensitive. <CustomReport> and <customreport> are treated as different tags so take care when editing. Recorder reports normally use the convention that tag names use proper case whilst attribute names use lower case.
4. Double clicking on an XML report file will probably open it in a web browser (Internet Explorer). It will not be possible to edit the report when opened this way, but if there are any syntax errors in the XML these may be shown with details of the problem. There are HTML editors available (eg. HTML Pad ) which will allow editing and also check syntax. Word processors should be avoided as they can insert invisible characters which XML does not recognise.