Professional > Data management scripting > Transferring data using a DMS file > Writing data > Transferring data to XML
 
Transferring data to XML
This topic provides some notes on using a DMS file to transfer case data to an XML file. The DMS file uses the XML DSC to write the data to the XML file.
Note The XML DSC is supplied by UNICOM Intelligence for the purpose of demonstrating and testing the transfer of small volumes of data. Do not use the XML DSC in production processes: use the UNICOM Intelligence Data File CDSC instead. The XML DSC might be withdrawn in a future release of UNICOM Intelligence.
Writing to a new file
If the XML file you specify in the OutputDataSource section does not exist, XML CDSC will create a new file.
Writing to an existing file
XML CDSC can write data to an existing XML file. If the structure of the data has changed, XML CDSC will update the structure in the existing file whenever possible. However, XML CDSC cannot update the data structure if the data type of any of the variables has changed. For example, you will get an error (typically “Invalid index”) if you attempt to export a categorical variable called age to a file that contains a numeric variable called age. The DMS file does not update data that was transferred previously, and merely appends the new case data records to the end of the file. You should therefore be careful not to create duplicate records in the XML file by exporting the same case data to it more than once.
Setting up weighting
XML CDSC can update existing records and so you can use the Weight component to set up weighting in the XML file. For an example of doing this, see Setting up weighting in a DMS file.
How do I specify an export to an XML file?
In the connection string in the OutputDataSource section, specify mrXmlDsc for the Data Source property and the name and location of the XML file for the Location property. For example:
OutputDataSource(Output,"The output data source")
  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=mrXmlDsc; _
    Location=
        [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\
        Output\CleanData.xml; _
  MetaDataOutputName =
      [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\       Output\CleanData.mdd"
End OutputDataSource
See also
Transferring data using a DMS file
Writing data