ReqXML to ReqIF
7 min read
last updated: 10/26/2021
Simplified XML format for generating ReqIF files with ReqEdit. The XML schema defines that all XML tags MUST be UPPERCASE and all HTML tags MUST be lowercase.
ReqXML Format
The namespace defined for ReqXML is http://www.reqteam.com/reqedit/data-exchange .
Example of a ReqXML file
<EXCHANGE-DATA xmlns="http://www.reqteam.com/reqedit/data-exchange" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.reqteam.com/reqedit/data-exchange file:///D:/Work/ReqEdit/RifSchemas/reqedit_xml/reqedit_xml.xsd">
<METADATA>
<DOCUMENT-TYPES>...</DOCUMENT-TYPES>
...
<ITEM-TYPES> ... </ITEM-TYPES>
...
</METADATA>
<DOCUMENTS>
<DOCUMENT>
...
</DOCUMENT>
...
</DOCUMENTS>
</EXCHANGE-DATA>
Document types – Defines attribute sets for requirement documents
Item types – Defines attribute sets for the requirement objects inside the document.
NOTE: only one item type is supported for one document (multi item type documents are not supported)
Type definition
<ITEM-TYPE>
<ID>_a23fe234-236f-45e5-b321-2342117348</ID>
<NAME>All attributes</NAME>
<ATTRIBUTES>
<ATTRIBUTE-STRING>
<NAME>RequirementsID</NAME>
</ATTRIBUTE-STRING>
<ATTRIBUTE-XHTML>
<NAME>ChapterName</NAME>
<BASETYPE>
<ID>_8a711c80-1594-48ba-b850-4855a768e5b3</ID>
<NAME>HTML-TEXT2</NAME>
</BASETYPE>
</ATTRIBUTE-XHTML>
<ATTRIBUTE-ENUM>
<ID>_7e9ac904-9c20-4a97-8d73-535cd189212e</ID>
<NAME>ObjectType</NAME>
<MULTIVALUE>false</MULTIVALUE>
<VALUES>
<VALUE ID="_7e9ac904-9c20-4a97-8d73-535cd189212e-Heading">Heading</VALUE>
<VALUE ID="_7e9ac904-9c20-4a97-8d73-535cd189212e-Information">Information</VALUE>
<VALUE ID="_7e9ac904-9c20-4a97-8d73-535cd189212e-Requirement">Requirement</VALUE>
</VALUES>
</ATTRIBUTE-ENUM>
</ATTRIBUTES>
In the example we defined:
- string attribute with name: RequirementID, For a single import is this enough.
- XHTML attribute with name: ChapterName.
- Single Enum attribute with name: ObjectType with values: Heading, Information, Requirement
Document structure
One file can contain multiple documents. Each of the documents must have a reference to the attribute set, which defines the attributes of the document itself. Even if there are no attributes a document type reference needs to be done. Additionally, a NAME need to be defined.
<DOCUMENTS>
<DOCUMENT>
<ID>_3_f7e0655f-2099-40fe-bfbc-08346abda405</ID>
<PARENT>_1_f7e0655f-2099-40fe-bfbc-08346abda405</PARENT>
<NAME>FOO</NAME>
<DOCUMENT-TYPE-REF>_a23fe234-236f-45e5-b321-document</DOCUMENT-TYPE-REF>
<ITEMS>
<ITEM>
<ITEM-TYPE-REF>_a23fe234-236f-45e5-b321-2342117348</ITEM-TYPE-REF>
<ATTRIBUTES>
<ATTRIBUTE>
<NAME>ChapterName</NAME>
<VALUE>
<div xmlns="http://www.w3.org/1999/xhtml">First main chapter.<em>ss</em></div>
</VALUE>
</ATTRIBUTE>
</ATTRIBUTES>
</ITEM>
...
</ITEMS>
</DOCUMENT>
...
</DOCUMENTS>
Each of the items need to have a reference to an item type which determines the attributes can be used in this requirement and an unique ID for later trace or structure references . To define the attribute reference, use the NAME tag and to set the value the VALUE tag, except the enum attributes.
Enum values always needs to be inside VALUES tag. Even if the Enum is single valued.
<VALUES><VALUE>Heading</VALUE></VALUES>
To build up a tree structure inside the document, it is possible to define parent items (tag PARENT). The value of the tag is the unique ID of the parent item/requirement.
Attribute Types
To define an attribute, you must define a name (NAME tag). Optional you can define an unique ID (ID tag) and a default value (DEFAULT tag). The IDs need to be unique in the complete document and need to be of type XSD:ID (https://www.data2type.de/xml-xslt-xslfo/xml-schema/datentypen-referenz/xs-id/)
Attribute types allowed in ReqXML
Type | XML Tag | Notes |
Boolean | ATTRIBUTE-BOOLEAN | |
Integer | ATTRIBUTE-INTEGER | Optionally Minimum (Tag MIN) Maximum (Tag MAX) |
Real | ATTRIBUTE-REAL | |
Date | ATTRIBUTE-DATE | Date format: 2020-07-23T23:59:59 |
String | ATTRIBUTE-STRING | Text without any formatting or line breaks |
XHTML | ATTRIBUTE-XHTML | Supports line breaks, formatting or attachments |
Enumeration | ATTRIBUTE-ENUM | Multivalued Enums (Tag MULTIVALUE with value true / false) |
Each attribute needs to refer to a predefined attribute type. For enumerations the valid valued need to be defined
<ATTRIBUTE-ENUM>
<ID>_7e9ac904-9c20-4a97-8d73-535cd189212e</ID>
<NAME>ObjectType</NAME>
<MULTIVALUE>false</MULTIVALUE>
<VALUES>
<VALUE ID="_7e9ac904-9c20-4a97-8d73-535cd189212e-Heading">Heading</VALUE>
<VALUE ID="_7e9ac904-9c20-4a97-8d73-535cd189212e-Information">Information</VALUE>
<VALUE ID="_7e9ac904-9c20-4a97-8d73-535cd189212e-Requirement">Requirement</VALUE>
</VALUES>
</ATTRIBUTE-ENUM>
XHTML Attributes
For formatted content please use attributes of type XHTML. All content MUST be wrapped in a div tag
<div xmlns="http://www.w3.org/1999/xhtml">My formatted ... content</div>
NOTE: The div wrapping is necessary to be able to validate the XHTML content internally.
Limitations
Please keep in mind, that ReqXML is only a preformat for the ReqIF, which does not allow all tags from XHTML. So ReqXML allows only tags which are valid in ReqIF, too.
So please use only the basic formatting tags (like cite, em, strong, sup, sub ..) and the predefined heading tags (h1..h6). You can use XHTML Tables and list elements (Tags OL and UL) as well.
In a requirement document the requirements will be linked completely, and not only some words (like in XHTML with the A tag). Please use for tracing definition the link tag of ReqXML to reference between requirements (artefacts)
If you want to reference to external files, please do it only with the tag OBJECT and not with IMG (which is not allowed). Attachments of a single document should be placed in a definite subfolder (which is named like the document itself or its ID).
<object data=”./attachments/Anschreiben.docx” type=”application/word”>
<object data=”./attachments/Anschreiben.png” type=”image/png”>this is an alternative text</object></object>
It is recommended to create for each of the attached files a small preview, so the requirements engineer could have a quick impression about the content inside the file. Previews has to have PNG format!
For more advanced users, which are already experience with XML Schema the list of valid tags can be traced down in the XML Schema file located at ReqEdit in the folder <<PATH to REQEDIT>>ReqEdit\RifSchemas\reqif\driver.xsd and referenced schema files inside.
Relevant ReqIF attribute naming
If you want to use your data in Requirement Management systems or want to have a correctly display the data in ReqEdit, please use the following naming conventions:
Attribute Name | Type | Description |
ReqIF.ChapterName | XHTML | Requirements heading |
ReqIF.Name | XHTML | Short description |
ReqIF.Text | XHTML | Requirements text |
ReqIF.ForeignDeleted | BOOLEAN | Display this item as deleted if set to true |
ReqIf.ForeignID | INTEGER | ID given by the source RM system |
ReqIF.ForeignCreatedBy | STRING | User that created this item |
ReqIF.ForeignCreatedOn | DATE | Date the item was created |
ReqIF.ForeignModifiedBy | STRING | User last modified the item |
LAST-CHANGE attribute of item | DATE | Modification date of the item |
ReqIF.ChapterNumber | STRING | The chapter number |
Best practices
- Please avoid defining a heading and requirements text in one item/requirement.
- Use only headings as structuring element, if its possible
- Please use long IDs (preferred UUIDs) for the unique IDs, so the chance is low to have the same ID for two elements in your complete project.
- Don’t use the same attribute names inside the same type definition
- Don’t use the same value inside the same Enum definition
IBM specific SAME-AS mapping
DOORS Next support the possibility to define different attributes for different documents, but the meaning of the attribute is identic. To avoid creating multiple instances of the same attribute it is possible to determine a SAME-AS tag with an URL content, that says to DNG not to create the attribute multiple times. This definition needs to be done in the document types or item types definition of the specific attribute
<ATTRIBUTE-DATE>
<NAME>LastModified</NAME>
<SAME-AS>http://purl.org/dc/terms/modified</SAME-AS>
</ATTRIBUTE-DATE>
Updates
If you plan multiple imports of the same document for updates, it is recommended to fix down the Attribute Ids and the referred base type. These values will be stored in the RM system (like DOORS or Polarion) and could be later updated easily. To do so, please define for each of the attributes a unique ID.
For Enum values (Tags VALUES) please define the valid values (Tag VALUE). The definition of unique IDs is only necessary if you plan an update import.
Traces
It is possible to define links between the different items (not necessarily in the same document, but in the same file). The block LINKS should follow the ATTRIBUTES tag inside the item/requirement.
<LINKS>
<LINK-TYPE NAME="verification">
<LINK TARGET="abc" DOCUMENT-REF="REQ-q23" />
<LINK TARGET="def" DOCUMENT-REF="REQ-q23" />
</LINK-TYPE>
<LINK-TYPE NAME="satisfies">
<LINK TARGET="abcd" />
</LINK-TYPE>
</LINKS>
The reference to the document is not necessary, if the ID can be identified in the file. The attribute TARGET holds the unique ID of the target item. The Attribute DOCUMENT-REF is the unique ID of the document, where the item ID should be in.