The following features are available to help you debug your XML report files:
The XML parser is part of Oracle's 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.com/technology/index.html). Search for XML parser or XDK. Information is also available in the documentation that came with your Oracle Database.
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
MODULE) keyword. For example:
rwbuilder USERID=username/password@my_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=username/password@my_db REPORT=emp.rdf CUSTOMIZE=c:\myreports\emp.xml
Note:In this example, the
REPORToption specifies a directory path to files stored on a Windows platform. For UNIX, use that platform's standard for specifying directory paths (that is, forward slashes instead of backward slashes).
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.
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_DEFINITION(newline); IF :WRITE_TO_FILE='Yes' THEN Text_IO.Put_Line(outfile, newline); END IF; END;
For this example to work, the PL/SQL that calls this procedure would need to declare a variable of type
TEXT_IO.File_Type. For example:
You would also need to 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: