OUTPUT SERVICE

The OUTPUT SERVICE of DATA FORMATS ANALYZER is implemented in the DfaOutput.py file as a DfaOutput module class.

Public Interface

class DfaOutput.OutputService(verbosity='E', version=None, refName=None, refVersion=None)

Provides methods to output data from other modules.

Parameters:

  • verbosity: The string specifying verbosity. See details in INIT SERVICE.
  • version: The string specifying the output version. See details in INIT SERVICE.
  • refName: The string specifying the reference name. See details in INIT SERVICE.
  • refVersion: The string specifying the reference version. See details in INIT SERVICE.
outputData(rootElementName=None, extractedAttributes=None, extractedElements=None, extractedTypes=None, surroundingChars=None, standardStringParts=None, outputStandard=False)

Outputs information and if requested also descriptions data about attributes, elements and types into XHTML and XML files.

Parameters:

  • rootElementName: The string specifying the root element name for which the tree structure should be generated.
  • extractedAttributes: The dictionary with information and descriptions data about attributes. See details in EXTRACT SERVICE.
  • extractedElements: The dictionary with information and descriptions data about elements. See details in EXTRACT SERVICE.
  • extractedTypes: The dictionary with information and descriptions data about types. See details in EXTRACT SERVICE.
  • surroundingChars: The list of tuples with the pairs of chars, which can surround attribute, element and type names in descriptions. It is used for marking the occurrences of attribute, element and type names to generate cross-references in descriptions. It has the following structure: LIST[TUPLE(2*STRING)].
  • standardStringParts: The dictionary with standard string parts used to generate the link to the standard for each attribute, element and type. It has the following structure: DICTIONARY{STRING:TUPLE(2*STRING)}.
  • outputStandard: The boolean specifying whether the link to the standard should be generated for each attribute, element and type. Note that the standard is either the official documentation or the schema in cases when the documentation is not available in such a detailed form or uses some other data format than HTML or XHTML. Use true (True) only when the given XSD schema is supported, otherwise use false (False) or add the support for the XSD schema by providing corresponding standard string parts.
printMessage(message=None)

Prints the message depending on specified verbosity. In the case of ERROR message it also exits the program.

Parameters:

  • message: The string with the message.

Private Methods

OutputService._outputMenuStructure(extractedNames, namesType)

Outputs a generated menu structure for the given extracted names.

Parameters:

  • extractedNames: The list of extracted names to be processed. It has the following structure: LIST[STRING].
  • namesType: The string specifying the type of extracted names.

Returns: The string with the generated menu structure.

OutputService._outputTreeStructure(elementName, extractedElements, processedElements, f)

Outputs a generated tree structure for the given element. Recursive approach is used to process all elements in extractedElementsdictionary.

Parameters:

  • elementName: The string with the current element name, which will be used to get information and descriptions data.
  • extractedElements: The dictionary with information and descriptions data about elements.
  • processedElements: The list of all element names, which were processed so far. This is used to prevent unnecessary recursion. It has the following structure: LIST[STRING].
  • f: The file where the output is written.
OutputService._outputAttributeData(attributeName, extractedAttributes, attributeNames, elementNames, surroundingChars)

Returns information and descriptions data about the given attribute name from extractedAttributesdictionary.

Parameters:

  • attributeName: The string with the current attribute name, which will be used to get information and descriptions data.
  • extractedAttributes: The dictionary with information and descriptions data about attributes.
  • attributeNames: The list of all attribute names, which will be used to mark the occurrences of other attribute names in the descriptions data of the current attribute. It has the following structure: LIST[STRING].
  • elementNames: The list of all element names, which will be used to mark the occurrences of element names in the descriptions data of the current attribute. It has the following structure: LIST[STRING].
  • surroundingChars: The list of tuples with the pairs of chars, which can surround the attribute and element names in descriptions.

Returns: The tuple with information and descriptions data about the given attribute name. It has the following structure:

TUPLE(
    LIST[Parent name (STRING)],
    Attribute XML documentation (STRING),
    Attribute XHTML documentation (STRING)
)
OutputService._outputElementData(elementName, extractedElements, attributeNames, elementNames, surroundingChars)

Returns information and descriptions data about the given element name from extractedElementsdictionary.

Parameters:

  • elementName: The string with the current element name, which will be used to get information and descriptions data.
  • extractedElements: The dictionary with information and descriptions data about elements.
  • attributeNames: The list of all attribute names, which will be used to mark the occurrences of attribute names in the descriptions data of the current element. It has the following structure: LIST[STRING].
  • elementNames: The list of all element names, which will be used to mark the occurrences of other element names in the descriptions data of the current element. It has the following structure: LIST[STRING].
  • surroundingChars: The list of tuples with the pairs of chars, which can surround the attribute and element names in descriptions.

Returns: The tuple with information and descriptions data about the given element name. It has the following structure:

TUPLE(
    LIST[Attribute name (STRING)],
    LIST[Child name (STRING)],
    LIST[Parent name (STRING)],
    Element XML documentation (STRING),
    Element XHTML documentation (STRING)
)
OutputService._outputTypeData(typeName, extractedTypes, attributeNames, elementNames, surroundingChars)

Returns information and descriptions data about the given type name from extractedTypesdictionary.

Parameters:

  • typeName: The string with the current type name, which will be used to get information and descriptions data.
  • extractedTypes: The dictionary with information and descriptions data about types.
  • attributeNames: The list of all attribute names, which will be used to mark the occurrences of attribute names in the descriptions data of the current type. It has the following structure: LIST[STRING].
  • elementNames: The list of all element names, which will be used to mark the occurrences of element names in the descriptions data of the current type. It has the following structure: LIST[STRING].
  • surroundingChars: The list of tuples with the pairs of chars, which can surround the attribute and element names in descriptions.

Returns: The tuple with information and descriptions data about the given type name. It has the following structure:

TUPLE(
    Type form (STRING),
    LIST[Attribute name (STRING)],
    LIST[Child name (STRING)],
    LIST[Usage in attribute name (STRING)],
    LIST[Usage in element name (STRING)],
    Type XML documentation (STRING),
    Type XHTML documentation (STRING)
)

Table Of Contents

Previous topic

EXTRACT SERVICE

Next topic

PREVIEW SERVICE