When you import data from XML with or without a template, you can create a trace log to verify that the import process worked correctly. The trace log shows whether a template was used and if so which template, and it shows which elements and rows were imported.
To create a trace log, select the Trace XML Import check box on in the Data Import page in the Properties view and specify the name and location of the log file in the Trace File Name box. If you do not specify a name for the trace file, PowerBuilder generates a trace file with the name pbxmtrc.log in the current directory.
You can also use the Import.XML.Trace and Import.XML.TraceFile DataWindow object properties.
If you use ImportClipboard or ImportStringan import method to import the data, you must specify XML! as the importtype argument. For example:
ImportString(XML!, ls_xmlstring)
If you omit the importtype argument, the trace file is not created. You do not need to specify the importtype argument if you use ImportFile.
The following trace log shows a default import of the department table in the EAS Demo database:
/*--------------------------------------------------*/ /* 09/10/2005 18:26 */ /*--------------------------------------------------*/ CREATING SAX PARSER. NO XML IMPORT TEMPLATE SET - STARTING XML DEFAULT IMPORT. DATAWINDOW ROWSIZE USED FOR IMPORT: 3 ELEMENT: dept_id: 100 ELEMENT: dept_name: R & D ELEMENT: dept_head_id: 501 --- ROW ELEMENT: dept_id: 200 ELEMENT: dept_name: Sales ELEMENT: dept_head_id: 902 --- ROW ELEMENT: dept_id: 300 ELEMENT: dept_name: Finance ELEMENT: dept_head_id: 1293 --- ROW ELEMENT: dept_id: 400 ELEMENT: dept_name: Marketing ELEMENT: dept_head_id: 1576 --- ROW ELEMENT: dept_id: 500 ELEMENT: dept_name: Shipping ELEMENT: dept_head_id: 703 --- ROW
The following trace log shows a template import of the department table. The template used is named t_1. Notice that the DataWindow column dept_id is referenced twice, as both an attribute and a column. The second occurrence is ignored for the template import, as described in “Restrictions”. The Detail Start element has an implicit attribute named __pbband which is also ignored.
/*---------------------------------------------------*/ /* 09/10/2005 18:25 */ /*---------------------------------------------------*/ CREATING SAX PARSER. USING XML IMPORT TEMPLATE: t_1 XML NAMES MAPPING TO DATAWINDOW IMPORT COLUMNS: ATTRIBUTE: /d_dept/d_dept_row NAME: '__pbband' >>> RESERVED TEMPLATE NAME - ITEM WILL BE IGNORED ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id' DATAWINDOW COLUMN: 1, NAME: 'dept_id' ELEMENT: /d_dept/d_dept_row/dept_id_xml_name >>> DUPLICATE DATAWINDOW COLUMN REFERENCE: 1, NAME: 'dept_id' - ITEM WILL BE IGNORED ELEMENT: /d_dept/d_dept_row/dept_head_id DATAWINDOW COLUMN: 3, NAME: 'dept_head_id' ELEMENT: /d_dept/d_dept_row/dept_name DATAWINDOW COLUMN: 2, NAME: 'dept_name' ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 100 ELEMENT: /d_dept/d_dept_row/dept_head_id: 501 ELEMENT: /d_dept/d_dept_row/dept_name: R & D --- ROW ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 200 ELEMENT: /d_dept/d_dept_row/dept_head_id: 902 ELEMENT: /d_dept/d_dept_row/dept_name: Sales --- ROW ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 300 ELEMENT: /d_dept/d_dept_row/dept_head_id: 1293 ELEMENT: /d_dept/d_dept_row/dept_name: Finance --- ROW ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 400 ELEMENT: /d_dept/d_dept_row/dept_head_id: 1576 ELEMENT: /d_dept/d_dept_row/dept_name: Marketing --- ROW ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 500 ELEMENT: /d_dept/d_dept_row/dept_head_id: 703 ELEMENT: /d_dept/d_dept_row/dept_name: Shipping --- ROW