Package org.jacoco.report.internal.xml

## Class ReportElement

- java.lang.Object
- - org.jacoco.report.internal.xml.XMLElement
  - - org.jacoco.report.internal.xml.ReportElement

    public class ReportElement
    extends XMLElement

A `XMLElement` with utility methods to create JaCoCo XML reports.

### Field Summary

### Fields inherited from class org.jacoco.report.internal.xml.XMLElement

`writer`

### Constructor Summary

Constructors
`ReportElement​(java.lang.String name, java.io.OutputStream output, java.lang.String encoding)` Creates a `report` root element for a XML report.

### Method Summary

All Methods Instance Methods Concrete Methods
`ReportElement` `classElement​(IClassCoverage coverage)` Creates a 'class' element.
`void` `counter​(ICoverageNode.CounterEntity counterEntity, ICounter counter)` Creates a 'counter' element.
`ReportElement` `element​(java.lang.String name)` Creates a new child element for this element.
`ReportElement` `group​(java.lang.String name)` Creates a 'group' element.
`void` `line​(int nr, ILine line)` Creates a 'line' element.
`ReportElement` `method​(IMethodCoverage coverage)` Creates a 'method' element.
`ReportElement` `packageElement​(java.lang.String name)` Creates a 'package' element.
`void` `sessioninfo​(SessionInfo info)` Creates a 'sessioninfo' element.
`ReportElement` `sourcefile​(java.lang.String name)` Creates a 'sourcefile' element.

### Methods inherited from class org.jacoco.report.internal.xml.XMLElement

`attr, attr, attr, close, text`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ReportElement

    public ReportElement​(java.lang.String name,
                         java.io.OutputStream output,
                         java.lang.String encoding)
                  throws java.io.IOException

Creates a `report` root element for a XML report.

Parameters:
  `name` - value for the name attribute
  `encoding` - character encoding used for output
  `output` - output stream will be closed if the root element is closed
Throws:
  `java.io.IOException` - in case of problems with the underlying output

### Method Detail

#### element

    public ReportElement element​(java.lang.String name)
                          throws java.io.IOException

Description copied from class: `XMLElement`
Creates a new child element for this element. Might be overridden in subclasses to return a instance of the subclass.

Overrides:
  `element` in class `XMLElement`
Parameters:
  `name` - name of the child element
Returns:
  child element instance
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### sessioninfo

    public void sessioninfo​(SessionInfo info)
                     throws java.io.IOException

Creates a 'sessioninfo' element.

Parameters:
  `info` - info object to write out
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### group

    public ReportElement group​(java.lang.String name)
                        throws java.io.IOException

Creates a 'group' element.

Parameters:
  `name` - value for the name attribute
Returns:
  'group' element
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### packageElement

    public ReportElement packageElement​(java.lang.String name)
                                 throws java.io.IOException

Creates a 'package' element.

Parameters:
  `name` - value for the name attribute
Returns:
  'package' element
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### classElement

    public ReportElement classElement​(IClassCoverage coverage)
                               throws java.io.IOException

Creates a 'class' element.

Parameters:
  `coverage` - class coverage node to write out
Returns:
  'class' element
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### method

    public ReportElement method​(IMethodCoverage coverage)
                         throws java.io.IOException

Creates a 'method' element.

Parameters:
  `coverage` - method coverage node to write out
Returns:
  'method' element
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### sourcefile

    public ReportElement sourcefile​(java.lang.String name)
                             throws java.io.IOException

Creates a 'sourcefile' element.

Parameters:
  `name` - value for the name attribute
Returns:
  'sourcefile' element
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### line

    public void line​(int nr,
                     ILine line)
              throws java.io.IOException

Creates a 'line' element.

Parameters:
  `nr` - line number
  `line` - line object to write out
Throws:
  `java.io.IOException` - in case of problems with the underlying output

#### counter

    public void counter​(ICoverageNode.CounterEntity counterEntity,
                        ICounter counter)
                 throws java.io.IOException

Creates a 'counter' element.

Parameters:
  `counterEntity` - entity of this counter
  `counter` - counter object to write out
Throws:
  `java.io.IOException` - in case of problems with the underlying output