Sample DB to XML

Top  Previous  Next

Current XML definition for XML files that can be imported by Crash Magic. The purpose of this section is to document the XML structures used by the converter. Clients should not alter the XML directly. The XML defines how the data is queried and how the generated XML file is defined. All XML files generated by the Crash Magic Converter will begin with  "<pdroot>" as the root element.

 

<DbToXml>

 <General>

         <OutputDir>C:\Temp\XmlOutput</OutputDir>

 </General>

Exmaple start of the XML file

 

OutputDir - Specifies the output directory for the XML files generated.

 

Defining XML structure of the the file to be created.

 <TableSpecs>

         <TableSpec>

                 <Name>Accidents</Name>

                 <Primary>True</Primary>

                 <ConnectionString>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ImportData;

Extended Properties="text;HDR=NO;FMT=Delimited"</ConnectionString>

                 <Login/>

                 <Password/>

                 <RequiredFiles>

                         <RequiredFile>Import schema.ini</RequiredFile>

                 </RequiredFiles>

                 <BaseName>CrashRecord</BaseName>

                 <GroupName/>

                 <ItemName>Environment</ItemName>

                 <QueryLines>

                         <QueryLine>SELECT</QueryLine>

                         <QueryLine>IncidentID,</QueryLine>

                         <QueryLine>IncidentDate,</QueryLine>

                         <QueryLine>IncidentDateTime,</QueryLine>

                         <QueryLine>CollisionManner,</QueryLine>

                         <QueryLine>LightCondition,</QueryLine>

                         <QueryLine>FirstHarmfulEvent,</QueryLine>

                         <QueryLine>FirstHarmfulLocation,</QueryLine>

                         <QueryLine>TotalUnits,</QueryLine>

                         <QueryLine>TotalInjuries,</QueryLine>

                         <QueryLine>TotalFatalities,</QueryLine>

                         <QueryLine>InjurySeverity,</QueryLine>

                         <QueryLine>AlcoholInvolvementFlag,</QueryLine>

                         <QueryLine>DrugInvolvementFlag,</QueryLine>

                         <QueryLine>HazardousFlag,</QueryLine>

                         <QueryLine>HitAndRunFlag,</QueryLine>

                         <QueryLine>Onroad,</QueryLine>

                         <QueryLine>CrossingFeature,</QueryLine>

                         <QueryLine>MPNum,</QueryLine>

                         <QueryLine>CityId,</QueryLine>

                         <QueryLine>CountyId,</QueryLine>

                         <QueryLine>StateId,</QueryLine>

                         <QueryLine>StateCode,</QueryLine>

                         <QueryLine>CountryCode,</QueryLine>

                         <QueryLine>Latitude,</QueryLine>

                         <QueryLine>Longitude,</QueryLine>

                         <QueryLine>IntersectionType,</QueryLine>

                         <QueryLine>JunctionRelation,</QueryLine>

                         <QueryLine>Weather</QueryLine>

                         <QueryLine>FROM CrashEnvironment#txt</QueryLine>

                         <QueryLine>WHERE IncidentDate BETWEEN '1/1/2012' AND '1/15/2012'</QueryLine>

                         <QueryLine>ORDER BY IncidentID</QueryLine>

                 </QueryLines>

                 <UniqueFields>

                         <UniqueField>IncidentID</UniqueField>

                 </UniqueFields>

                 <ChildNames>

                         <ChildName>Vehicles</ChildName>

                 </ChildNames>

         </TableSpec>

Example specification of the primary XML element

 

 

TableSpec - Specifies the start of the xml structure that will be created.

Name - Name of the of the table specification

Primary - Boolean value that indicates if this is the primary XML node.

ConnectionString - Defines the connection to the data source.

Login - Login name if required by the data source.

Password - Password for the login if required by the data source.

RequiredFile - Name of and required Utility - Text lines PSRattr for import (In this example a schema.ini file has been added to a Utility -Text line with the name of "Import schema.ini").

BaseName - Starting node of the XML crash record

GroupName - Used to define a group of XML nodes for example a value of Vehicles can be used to define a group of Vehicle children records

ItemName - The name of the XML node that will contain elements from the select statement.

QueryLine - Query to extract records from source. Each field returned from the select statement creates an XML element.

UniqueField - The primary identifier for the record. This field will also be used for name of the XML file that is created.

ChildName - The TableSpec name of XML children that will be included in the XML file.