Applying an XML Report Definition at Runtime

22-18 Publishing Reports to the Web with Oracle Reports Services When you use rwrun, the Reports Runtime command, the equivalent command line would be: rwrun USERID=usernamepasswordmy_db REPORT=c:\corp\myreports\emp.xml DESTYPE=file DESNAME=emp.pdf DESFORMAT=PDF When you run an XML report definition in this way, you must specify an XML file extension. You could also apply an XML customization file to this report using the CUSTOMIZE command line keyword.

22.4.3 Performing Batch Modifications

If you have a large number of reports that has to be updated, you can use the CUSTOMIZE command line keyword with rwconverter to perform modifications in batch. Batch modifications are particularly useful when you must make a repetitive change to a large number of reports for example, changing a fields format mask. Rather than opening each report and manually making the change in Oracle Reports Builder, you can run rwconverter once and make the same change to a large number of reports at once. The following example applies two XML report definitions, translate.xml and customize.xml, to three RDF files, inven1.rdf, inven2.rdf, and manu.rdf, and saves the revised definitions to new files, inven1_new.rdf, inven2_new.rdf, and manu_new.rdf. rwconverter usernamepasswordmy_db STYPE=rdffile SOURCE=inven1.rdf, inven2.rdf, manu.rdf DTYPE=rdffile DEST=inven1_new.rdf, inven2_new.rdf, manu_new.rdf CUSTOMIZE=d:\apps\trans\translate.xml,d:\apps\custom\customize.xml BATCH=yes

22.5 Debugging XML Report Definitions

The following features are available to help you debug your XML report files: ■ XML Parser Error Messages ■ rwbuilder ■ Writing XML to a File for Debugging Note: The rwconverter.bat file uses the start keyword to start the rwconverter process. If the start keyword is specified, then the process starts in asynchronous mode. The spawned rwconverter continues execution until completion. For using batch conversion of a large number of rdfs, all the processes start simultaneously. Therefore, it is recommended that you modify the rwconverter.bat file manually to remove the start keyword for running rwconverter in batch mode. Note: In this example, the CUSTOMIZE value demonstrates a directory path to files stored on a Windows platform. For UNIX, use that platforms standard for specifying directory paths that is, forward slashes instead of backward. Customizing Reports with XML 22-19

22.5.1 XML Parser Error Messages

The XML parser is part of Oracles XML Development Kit XDK, which is delivered with the core Oracle Database release. The XML parser is a Java package that checks the validity of XML syntax. The JAR files that contain the XML parser are automatically set up on install and are available to Oracle Reports. The XML parser catches most syntax errors and displays an error message. The error message contains the line number in the XML where the error occurred as well as a brief description of the problem. For more information on the XML parser, see the Oracle Technology Network, http:www.oracle.comtechnologyindex.html . Search for XML parser or XDK. Information is also available in the documentation that came with your Oracle Database.

22.5.2 rwbuilder

When designing an XML report definition, it is sometimes useful to open it in Oracle Reports Builder. In Oracle Reports Builder, you can quickly determine if the objects are being created or modified as expected. For example, if you are creating summaries in an XML report definition, then opening the definition in Oracle Reports Builder enables you to quickly determine if the summaries are being placed in the appropriate group in the data model. To open a full report definition in Oracle Reports Builder, use the REPORT or MODULE keyword. For example: rwbuilder USERID=usernamepasswordmy_db REPORT=c:\corp\myreports\emp.xml To open a partial report definition in Oracle Reports Builder, use the CUSTOMIZE keyword. For example: rwbuilder USERID=usernamepasswordmy_db REPORT=emp.rdf CUSTOMIZE=c:\myreports\emp.xml In both cases, Oracle Reports Builder is opened with the XML report definition in effect. You can then use the various views of Oracle Reports Builder to determine if the report is being created or modified as you expected.

22.5.3 Writing XML to a File for Debugging

If you are using SRW.ADD_DEFINTION to build an XML report definition in memory, then it can be helpful to write the XML to a file for debugging purposes. The following example demonstrates a procedure that writes each line that you pass to it to the document buffer in memory and, optionally, to a file that you specify. PROCEDURE addaline newline VARCHAR, outfile Text_IO.File_Type IS BEGIN SRW.ADD_DEFINITIONnewline; IF :WRITE_TO_FILE=Yes THEN Text_IO.Put_Lineoutfile, newline; END IF; Note: In this example, the REPORT option specifies a directory path to files stored on a Windows platform. For UNIX, use that platforms standard for specifying directory paths that is, forward slashes instead of backward slashes. 22-20 Publishing Reports to the Web with Oracle Reports Services END; For this example to work, the PLSQL that calls this procedure must declare a variable of type TEXT_IO.File_Type. For example: custom_summary Text_IO.File_Type; You must also open the file for writing and call the addaline procedure, passing it the string to be written and the file to which it should be written. For example: custom_summary := Text_IO.Fopen:file_directory || vid_summ_per.xml, w; addalinereport name=video_custom author=Generated DTDVersion=9.0.2.0.0, custom_summary; Part V Part V Globalization Support and Bidirectional Support Part V provides information about Reports-related globalization support settings and bidirectional support: ■ Chapter 23, Implementing Globalization and Bidirectional Support