Define the Report Schema

A schema defines the expected output. The report schema for all Mart reports is defined in the reports-schema.xml file. This file is available in the MartServer\WEB-INF folder. Help ensure that the report data output always confers to the schema definition.

Report schemas have the following characteristics:

  • Report schemas are created in XML format.
  • Report schemas have a unique name that identifies the schema. We recommend that you have this name same as that of the report name.
  • Reports are defined using XML elements.

Follow these steps:

  1. Open the MartServer\WEB-INF\Reports-schema.xml file.
  2. Enclose report schema definition within the <report_schema> element.
  3. Define a name for the report schema within the <Name> element.
  4. Define the Schema within the <schema> element in the CDATA section.
  5. Defining a schema definition within the CDATA section helps XML accept the XML related information within an XML definition.

Note: There are various tools to generate Schema Definition (that is, XSD) information from a XML. You can generate the schema definition using a tool of your choice and include it in the reports-schema.xml file.

An example of defining a report schema on Users is shown below.

<report_schema>
<Name> Users </Name>
	<schema>
	<Report_Output>
		<![CDATA[<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
			<xs:element name="report_root">
				<xs:complexType>
				<xs:sequence>
					<xs:element name = "User" maxOccurs="unbounded">
					<xs:complexType>
					<xs:sequence>
					<xs:element name = "Id" type="xs:string"/>
					<xs:element name ="Username" type="xs:string"/>
					<xs:element name ="EmailId" type="xs:string"/>
					<xs:element name ="UserType" type="xs:string"/>
					<xs:element name = "IsInternal" type="xs:string"/>
					<xs:element name = "IsDeleted" type="xs:string"/>
					</xs:sequence>
					</xs:complexType>
					</xs:element>
				</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:schema>]]>
	</schema>
</report_schema>