Table of Contents

Class QacXmlFileReader

Namespace
MES.MQC.DataSourceLibrary.Adapters.Files
Assembly
MES.MQC.DataSourceLibrary.dll
public class QacXmlFileReader : FileReader
Inheritance
QacXmlFileReader
Inherited Members

Properties

DataSource

The Data Source of the Adapter. If a report file contains data from multiple data sources, this property has to be to "Unknown" and the DataSource of each AdapterData object has to be defined.

public override string DataSource { get; }

Property Value

string

Description

Description of the Adapter that is visible in the Adapter Dialog as a popover. If the adapter is an API Connector, the description is also shown in the Add/Edit DataSource dialog, when the API Connector is selected. Absolute links get transformed into HTML Link Tags, line breaks (\n) get transformed into HTML line breaks (<br>), HTML tags are not allowed.

public override string Description { get; }

Property Value

string

FileExtensions

File Extensions of the Adapter. This property has to be defined and must have at least one file extension. The Adapter is only used for FilePaths with the defined file extensions. The IsValid method is not called unless the file extension matches.

public override List<string> FileExtensions { get; }

Property Value

List<string>

Name

Unique Name of the Adapter. Defaults to the ClassName (without Adapter / FileReader / ApiConnector suffix), can be overridden with a user defined Name.

public override string Name { get; }

Property Value

string

Methods

GetHumanReadableFilePath(FileReaderContext)

Get the human-readable file path. Can be overridden with a user defined function. Can be used together with GetHumanReadableFilePaths, but it is recommended to only use one of the methods.

protected override string GetHumanReadableFilePath(FileReaderContext context)

Parameters

context FileReaderContext

FileReaderContext

Returns

string

Human readable file

IsValid(FileReaderContext)

Check if the file name is equal to 'results_data.xml' and check if the root element is equal to 'AnalysisData'

protected override bool IsValid(FileReaderContext context)

Parameters

context FileReaderContext

Context of file

Returns

bool

true if file is a valid QAC XML report file

Read(FileReaderContext)

Read each 'File' element inside <dataroot type="per-file"> and fetch 'path' attribute as ArtifactPath if there is 'File' element with same 'path' attribute inside <dataroot type="project"> <tree type="files"> and fetch 'basename' attribute as ArtifactName. For each Artifact these measures should be read : Guidelines, Findings Measures should be read for different measurements per artifact. The measurement name is taken from the attribute 'name' of each <tree type="rules"> <RuleGroup name = "xxx"> MeasureName: Guidelines From 'Rule' elements inside <dataroot type="project"> <tree type="rules"> <RuleGroup name = "xxx"> read number of 'Rule' elements that has 'Message' elements as child element as value of 'Total' variable From 'Rule' elements inside <dataroot type="per-file"> <File path=".../example.h"> <tree type="rules"> <RuleGroup name = "xxx"> read number of 'Rule' elements that has 'Message' elements as child element and active="0" as value of 'Suppressed' variable read number of all 'Rule' elements that has 'Message' elements as child element minus value of 'Suppressed' as value of 'Failed' variable calculate value of 'Total' minus value of 'Failed' as value of 'Passed' variable All above measures read for measurement = 'name' attribute of 'RuleGroup' Note: Guidelines.Passed contains Guidelines.Suppressed MeasureName: Findings From 'Rule' elements inside <dataroot type="per-file"> <File path=".../example.h"> <tree type="rules"> <RuleGroup name = "xxx"> read 'active' attribute as value of 'Failed' variable read 'total' attribute minus value of 'Failed' as value of 'Suppressed' variable All above measures read for measurement = 'name' attribute of 'RuleGroup'

protected override AdapterReadResult Read(FileReaderContext context)

Parameters

context FileReaderContext

Context of file

Returns

AdapterReadResult

All Data is stored in an AdapterData Model object

Examples

=> Guidelines.Total = 3 for MeasurementName 'xxx' => ArtifactPath = '.../example.h' , ArtifactName = 'example.h' => Findings.Failed = 4 , Findings.Suppressed = 3 for MeasurementName 'xxx' => Guidelines.Failed = 1 , Guidelines.Suppressed = 2, Guidelines.Passed = 2 for MeasurementName 'xxx'