Description

The XMLSegmentMergeV2Receiver, merges different XML data segments, created by the SegmentDataCreatorReceiver, to generate complex nested XML output.


The XMLSegmentMergeV2Receiver is an upgrade from the XMLSegmentMergeReceiver in that it requires an XSD to read from, that describes the structure of the XML document; thus, laborious work of attaching templates to each Domain, as was necessary for the XMLSegmentMergeReceiver, is no longer needed. 


The XMLSegmentMergeV2Receiver's greatest feature is that it allows for highly nested XML documents to be auto-created from their XSDs in just minutes.


In This Article


Component Diagram

The component diagram below, shows how the XMLSegmentMergeV2Receiver interacts with other GenRocket components to create complex nested XML documents by merging XML data from two or more segments.  

Combining the use of the Segment data, plus the use of the config.xml and XSD file, the XMLSegmentMergeV2Receiver can create complex nested XML output for any XML document no matter how deep or complex its hierarchy or the amount of test data or test data files are needed to solve the test data challenge.   




When should this Receiver be used? 

  • Any time you want to generate complex nested XML output.


When should this Receiver not be used? 

  • Any time you want to generate another type of nested output.


Receiver Parameters

The XMLSegmentMergeV2Receiver requires that the following parameters are defined. Items with an asterisk* are required.

  • outputPath* - Defines the location to store the newly generated nested XML file(s).
  • outputSubDirectory* - Defines the prefix name of subdirectories that are auto created under the outputPath and then appended with a number.
  • configPath *- Defines the location where the configuration file and XSD file are to be stored.
  • configSubDir - Defines the subdirectory under the configPath directory where the configuration file and XSD file are to be stored.
  • configName* - Defines the name of the configuration file.
  • filesPerOutputSubDir* - Defines the number of files to be generated per output subdirectory.
  • segmentPath* - Defines the path to the Segment directory where all segment subdirectories can be found.
  • segmentSubDirectory* - Defines the subdirectory under the segmentPath where segment files can be found.
  • overrideFileName - Defines the fileName which will override the fileName provided in the configuration file.
  • deleteOutputSubDir - Defines whether to delete the generated or an existing outputSubDirectory or not during the execution of the Scenario.


Receiver Attribute Property Keys

There are no property keys necessary for this Receiver.


XSD Specification

In order for GenRocket to import, parse an XSD and convert its information into GenRocket Domains and establish Domain Parent/Child/Sibling relationships, a consistent XSD format must be adhered to.  Please click the following links for details on Defining an XSD and for an explanation on Why an XSD is Necessary.


Configuration File

GenRocket automatically creates a Configurator, after importing an XSD, and converting its elements into GenRocket Components.  The Configurator produces an XML Document for downloading to a local computer. The XMLSegmentMergeV2Receiver reads and parses the XML Document and reads and parses the XSD document to automatically configure itself to merge and properly write the nested generated segment data out to one or more XML test data files.  Please click the following link to see an Example Configuration File.


Note: To split a value into n number of XML elements, Use #{GR_CRLF} in the element Value. For example: to split an Address into 4 Address elements, use "1000 Cecil Road#{GR_CRLF}Barnard Castle#{GR_CRLF}Durham, England#{GR_CRLF}DL12 8AN"


<addresses>
  <address>1000 Cecil Road</address>
  <address>Barnard Castle</address>
  <address>Durham, England</address>
  <address>DL12 8AN</address>
</addresses>


A Fictional Story Example for Generating Complex Nested XML Data

Please click the following link to see a Full Example Using the XMLSegmentMergV2Receiver.