The XML Instance Template

Now we have the XML Schema and the CSS file. Based on these files, the <oXygen/> Author can help the content author in loading, editing and validating the test reports. We have to create an XML file template, a kind of skeleton, that the users can use as a starting point for creating new test reports.

The template must be generic enough and refer the XML Schema file and the CSS stylesheet. This is an example:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="test_report.css"?>
<report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:noNamespaceSchemaLocation="test_report.xsd">
    <title>Test report title</title>
    <description>
        <line>This is the report 
                  <important>description</important>.</line>
    </description>
    <results>
        <entry>
            <test_name>Sample test1</test_name>
            <passed>true</passed>
        </entry>
        <entry>
            <test_name>Sample test2</test_name>
            <passed>true</passed>
        </entry>
    </results>
</report>

The processing instruction xml-stylesheet associates the CSS stylesheet to the XML file. The href pseudo attribute contains the URI reference to the stylesheet file. In our case the CSS is in the same directory as the XML file.

The next step is to place the XSD file and the CSS file on a web server and modify the template to use the HTTP URLs, like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" 
        href="http://www.mysite.com/reports/test_report.css"?>
<report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation=
        "http://www.mysite.com/reports/test_report.xsd">
    <title>Test report title</title>
    <description>
.......

The alternative is to create an archive containing the test_report.xml, test_report.css and test_report.xsd and send it to the content authors.