Failed to Generate or Read Data Source XML

While developing an XML publisher report, I was receiving the following error:

Failed to generate or read Data Source XML file (235,2305) PSXP_RPTDEFNMANAGER.ReportDefn.OnExecute  
Name:ProcessReport  PCPC:44256  Statement:1039

The code involved setting the run time data XML file using the following line:

&report_defn.SetRuntimeDataXMLFile(&path_to_xml_file);

Before calling ProcessReport. This didn't seem to work, however changing the code to read an XML file on the application server, creating an XMLDoc object out of the contents of the file and using SetRuntimeDataXMLDoc did the trick. Basically code like this (note only relevant code is shown):

/* Read the contents of the XML data file */
&xml_file = GetFile(&xml_data_file_path, "R", %FilePath_Absolute);
While &xml_file.ReadLine(&xml_data_line)
   &xml_data = &xml_data | &xml_data_line;
End-While;
 
/* Create XMLDoc object from file */
&xml_doc = CreateXmlDoc(&xml_data);
 
/* Set runtime data XML document */
...
&report_defn.SetRuntimeDataXMLDoc(&xml_doc);
...

Further to this, it appears the problem was trying to use the SetRunTimeDataXMLFile method for an XMLDoc data source. Changing over to a data source that is an XML file resolves the issue. In other words, the SetRunTimeDataXMLFile is designed for a data source of XML file (not XML Doc).

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License