Skip to content

How do I convert a Dataset into a XML Node structure

This example demonstrates converting a dataset into a XML Node structure.

In the solution shown below, a dataset is created using "ddCreateDataset" command and the dataset is converted to XML Node Structure using the command "xmlCreateDocumentFromDataSet" command. The attributes of the Data Definition are considered as Keys and the values will be set using data from the dataset.

Solution:

# Command Target Value
Declare the dataset name with a data definition specified in the value field
1 ddCreateDataset XMLValuesDataset XMLValuesDataDefinition(W)
To convert a dataset into a XML node structure
2 xmlCreateDocumentFromDataSet XMLValuesDataset DSConvertedXML

Tips, Tricks, Gotchas & Best Practices:  

  • To convert the Dataset to XML node structure, attribute names in the Data Definition should not have spaces
  • Spaces are not allowed in the Data Definition and Data File Names as well, else the command fails with the error message XML names cannot contain the character " ".
  • While declaring the Dataset it is necessary to validate the Data Definition specified in the value field has a required number of attributes as this would decide the number of columns in the Dataset. If the number of values returned for the given XML path are more than the columns in the Dataset, command fails with the error "The Number of columns returned are more than the number of attributes in the Data Definition".
  • For the command "ddCreateDataset", the status of the Data Definition can be optionally passed within braces along with the name of the Data Definition in the value field. Allowed values for status are 'W'(WIP-Work In Progress) and 'A'(ACTIVE). If not passed, the status of the Data Definition is assumed to be 'W'.
  • As a best practice, it is always advised to define the variable names without any spaces and if you want to differentiate the words, use underscores.


Feedback and Knowledge Base