Tracing import
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:
|
1 |
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.
Example: default import
The following trace log shows a default import of the department table
in the EAS Demo database:
|
1 |
/*--------------------------------------------------*/<br>/*                09/10/2005 18:26                 */<br>/*--------------------------------------------------*/<br>CREATING SAX PARSER.<br>NO XML IMPORT TEMPLATE SET - STARTING XML DEFAULT IMPORT.<br>DATAWINDOW ROWSIZE USED FOR IMPORT: 3<br> <br>ELEMENT: dept_id: 100<br>ELEMENT: dept_name: R & D<br>ELEMENT: dept_head_id: 501<br>--- ROW<br>ELEMENT: dept_id: 200<br>ELEMENT: dept_name: Sales<br>ELEMENT: dept_head_id: 902<br>--- ROW<br>ELEMENT: dept_id: 300<br>ELEMENT: dept_name: Finance<br>ELEMENT: dept_head_id: 1293<br>--- ROW<br>ELEMENT: dept_id: 400<br>ELEMENT: dept_name: Marketing<br>ELEMENT: dept_head_id: 1576<br>--- ROW<br>ELEMENT: dept_id: 500<br>ELEMENT: dept_name: Shipping<br>ELEMENT: dept_head_id: 703<br>--- ROW |
Example: template import
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.
|
1 |
/*---------------------------------------------------*/<br>/* 09/10/2005 18:25 */<br>/*---------------------------------------------------*/<br>CREATING SAX PARSER.<br>USING XML IMPORT TEMPLATE: t_1<br> <br>XML NAMES MAPPING TO DATAWINDOW IMPORT COLUMNS: <br>ATTRIBUTE: /d_dept/d_dept_row NAME: '__pbband'<br>>>> RESERVED TEMPLATE NAME - ITEM WILL BE IGNORED<br>ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id'<br>DATAWINDOW COLUMN: 1, NAME: 'dept_id'<br>ELEMENT: /d_dept/d_dept_row/dept_id_xml_name<br>>>> DUPLICATE DATAWINDOW COLUMN REFERENCE: 1, NAME: 'dept_id' - ITEM WILL BE IGNORED<br>ELEMENT: /d_dept/d_dept_row/dept_head_id<br>DATAWINDOW COLUMN: 3, NAME: 'dept_head_id'<br>ELEMENT: /d_dept/d_dept_row/dept_name<br>DATAWINDOW COLUMN: 2, NAME: 'dept_name'<br> <br>ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 100<br>ELEMENT: /d_dept/d_dept_row/dept_head_id: 501<br>ELEMENT: /d_dept/d_dept_row/dept_name: R & D<br>--- ROW<br>ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 200<br>ELEMENT: /d_dept/d_dept_row/dept_head_id: 902<br>ELEMENT: /d_dept/d_dept_row/dept_name: Sales<br>--- ROW<br>ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 300<br>ELEMENT: /d_dept/d_dept_row/dept_head_id: 1293<br>ELEMENT: /d_dept/d_dept_row/dept_name: Finance<br>--- ROW<br>ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 400<br>ELEMENT: /d_dept/d_dept_row/dept_head_id: 1576<br>ELEMENT: /d_dept/d_dept_row/dept_name: Marketing<br>--- ROW<br>ATTRIBUTE: /d_dept/d_dept_row/dept_id_xml_name NAME: 'dept_id': 500<br>ELEMENT: /d_dept/d_dept_row/dept_head_id: 703<br>ELEMENT: /d_dept/d_dept_row/dept_name: Shipping<br>--- ROW |