##### General

- Home
- Downloads
- Javadocs
- Mailing Lists
- Bug Tracker
- SourceForge Project
- GitHub Project

##### Running

- Ant Task Usage
- Command-Line
- Run as a Test
- Other Tools/Frameworks

##### Using

- Creating a RuleSet
- Creating a Rule
- Configuring Rules
- Starter RuleSet (All)

##### Report Types

- HTML Report
- XML Report
- Text and IDE Reports

##### Sample Reports

- Sample HTML Report
- Sample XML Report

##### Rules

- Rule Index
- Basic Rules
- Braces Rules
- Concurrency Rules
- Convention Rules
- Design Rules
- DRY Rules
- Enhanced Rules
- Exceptions Rules
- Formatting Rules
- Generic Rules
- Grails Rules
- Groovyism Rules
- Imports Rules
- JDBC Rules
- JUnit Rules
- Logging Rules
- Naming Rules
- Size/Complexity Rules
- Security Rules
- Serialization Rules
- Unnecessary Rules
- Unused Rules

##### Developing

- Developer Guide

##### Project Documentation

- Project Information
- Project Reports

## XmlReportWriter

### Description

The `org.codenarc.report.XmlReportWriter` class (type="xml") produces an XML report of the CodeNarc results.

Note: This XML format is still being refined and is subject to change. Contact me if you have specific requirements or suggestions.

See a Sample XML Report. Also see the mrhaki blog post about creating custom CodeNarc HTML reports using XSLT.

### Option Nested Elements

The option element is a child of the report element and defines a report-specific option for a report.

`org.codenarc.report.XmlReportWriter` supports the following options:

Attribute | Description | Required
outputFile | The path and filename for the output report file. | No
title | The title for the output report. | No
writeToStandardOut | Set to "true" or `true` to write out the report to stdout (`System.out`) instead of writing to a file. | No

### Example

Here is an example Ant XML build file illustrating configuration of `org.codenarc.report.XmlReportWriter`. Note that the report type is specified as "xml".

    <taskdef name="codenarc" classname="org.codenarc.ant.CodeNarcTask"/>
    <target name="runCodeNarc">
        <codenarc
                ruleSetFiles="rulesets/basic.xml,rulesets/exceptions.xml,rulesets/imports.xml"
                maxPriority1Violations="0">

            <report type="xml">
                <option name="outputFile" value="reports/CodeNarcXmlReport.xml" />
                <option name="title" value="My Sample Code" />
            </report>

            <fileset dir="src">
                <include name="**/*.groovy"/>
            </fileset>
        </codenarc>
    </target>