Rational Developer for System z

Exporting results in XML and CSV formats

This topic describes how to export the results of a code review to a data file in XML or CSV format. The export process converts the result information from an analysis history into a formatted data file that can be used as input to other programs, inside or outside Eclipse.

Contrast: Exporting data versus generating reports

The actions of exporting data and of generating reports are similar in that:
  • They both create formatted output from a result history.
  • They both write the formatted output to a file.
The difference is the type of output produced:
  • Exporting data generates result information in XML or CSV files that can be used as input to other programs.
  • Generating reports creates text or graphical output in HTML or PDF format. See Generating and saving reports.

Exporting the results of a code review to a file

To export the results:
  1. In the Software Analysis Results view:
    1. Right-click an analysis history.
    2. Click Export.
  2. In the Software Analysis Data Export window:
    1. Select an export format from the list. The options are:
      XML Analysis Results
      Converts the entire results to an XML document.
      CSV Analysis Results
      Converts the entire results to a CSV document.
      Analysis Summary
      Generates an XML document containing a high-level summary of the code review processing.
      Executed Rules
      Generates an XML document containing a list of the rules that were applied and their severities.
      Scanned Resources
      Generates an XML document containing a list of the source code files that were processed.
    2. Specify an output file in the Output File field.
    3. Click OK.
  3. The selected type of data is generated and written to the output file.

View the schema of the XML format

Figure 1 shows the XML schema for the XML output format:

Figure 1. XML schema for XML output format
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.ibm.com/rdz/AnalysisResults" 
xmlns="http://www.w3.org/2001/XMLSchema" 
xmlns:tns="http://www.ibm.com/rdz/AnalysisResults">
   <element name="report">
      <complexType>
         <sequence>
            <element name="provider" type="tns:providerType"
            minOccurs="0" maxOccurs="1"/>
            <element name="files" type="tns:filesType" 
            minOccurs="0" maxOccurs="1"/>
         </sequence>
      </complexType>
   </element>
   <complexType name="providerType">
      <sequence>
         <element name="category" type="tns:categoryType" minOccurs="0" 
         maxOccurs="unbounded"></element>
      </sequence>
      <attribute name="name" type="string" use="required"></attribute>
      <attribute name="id" type="string" use="required"></attribute>
   </complexType>
   <complexType name="filesType">
      <attribute name="id" type="string" use="required"></attribute>
      <attribute name="path" type="string" use="required"></attribute>
   </complexType>
   <complexType name="categoryType">
      <sequence>
         <element name="rule" type="tns:ruleType" minOccurs="0" 
         maxOccurs="unbounded"></element>
      </sequence>
      <attribute name="name" type="string" use="required"></attribute>
      <attribute name="id" type="string" use="required"></attribute>
   </complexType>
   <complexType name="ruleType">
      <sequence>
         <element name="result" type="tns:resultType" minOccurs="0" 
         maxOccurs="unbounded"></element>
      </sequence>
      <attribute name="name" type="string" use="required"></attribute>
      <attribute name="id" type="string" use="required"></attribute>
      <attribute name="severity" type="tns:severityType" use="required">
      </attribute>
   </complexType>
   <simpleType name="severityType">
      <restriction base="string">
         <enumeration value="SEVERE"></enumeration>
         <enumeration value="WARNING"></enumeration>
         <enumeration value="RECOMMENDATION"></enumeration>
      </restriction>
   </simpleType>
   <complexType name="resultType">
      <attribute name="fileId" type="string" use="required"></attribute>
      <attribute name="line" type="int" use="required"></attribute>
   </complexType>
</schema>

View the fields of the CSV format

Table 1 shows the field names and field values of the CSV format:
Table 1. Comma-separated values
Field name Field value
PROVIDER ID The ID of the rule provider that generated the result.
PROVIDER The name of the rule provider that generated the result.
CATEGORY ID The ID of the category that contains the rule that generated the result.
CATEGORY The name of the category that contains the rule that generated the result.
RULE ID The ID of the rule that generated the result.
RULE The name of the rule that generated the result.
SEVERITY The severity of the rule that generated the result: SEVERE, WARNING, or RECOMMENDATION.
FILE The file for which the result was generated.
LINE The line of the file on which the result was generated.

Feedback