Export to XML format (Db2Xml)     

Description:
Db2Xml allows you to export all the data from one or all tables in a database
in XML format. Db2Xml writes the output by default to 'table.xml' unless you
specify with the '-o' option a different output file.
Db2Xml also create the XML DTD file "table.dtd" referenced from "table.xml"
unless you specify the "-n" option to write the XML without the DTD.reference.
If you don't specify a table with the "-t" option Db2Xml will export all tables.
Db2Xml writes all diagnostics to a log file "logs/yyyymmdd/db2xml.log"
The exported XML data can be transmitted to other clients or imported to any
other database with the DbLoad utility.
Note that In demo mode up to 100 records can be exported.

Unless you have a XML editor we suggest the free Microsoft XML Notepad (backup)

Syntax:
-usage: db2xml [-sn] [-d{db}] [-o{out}] [-t{tab}]
-d = DATABASE: Specify database input file (default Sample.mdb)
-o = OUTPUT  : Specify output filename (default Table.{xml|txt|csv|htm})
                 -o STDOUT writes directly to standard output not a file
-t = TABLE   : Specify Table name (default is all tables)
                 or table number ('#3' = 3rd table)
-s = SILENT  : Dont show diagnostics (XX Records written..)
-n = NOHEADER: Dont write DTD (XML), header line (TXT, CSV, HTML)

Example:
db2xml -d Sample.mdb -t Employees -o emp.XML
9 'Employees' Record(s) written to 'emp.xml'

Exports all data from the " Employees" table from database "Sample.mdb".
The output is written to "emp.XML" and the XML DTD file to "emp.DTD"

Example XML Output (emp.xml)
<?xml version="1.0"?>
<!-- Database Location: Sample.mdb -->
<!DOCTYPE Sample SYSTEM "emp.dtd">
<ROOT Database="Sample.mdb">
    <Employees>
        <EmployeeID>1</EmployeeID>
        <LastName>Davolio</LastName>
        <FirstName>Nancy</FirstName>
        <Title>Sales Representative</Title>
        <TitleOfCourtesy>Ms.</TitleOfCourtesy>
        <BirthDate>12/08/48</BirthDate>
        <HireDate>05/01/92</HireDate>
        <Address>507 - 20th Ave. E.&#x0D;&#x0A;Apt. 2A</Address>
        <City>Seattle</City>
        <Region>WA</Region>
        <PostalCode>98122</PostalCode>
        <Country>USA</Country>
        <HomePhone>(206) 555-9857</HomePhone>
        <Extension>5467</Extension>
        <Photo>Array of VT_UI1</Photo>
        <Notes>Education includes a BA in psychology from Colorado State University in 1970. She also completed &quot;The Art of the Cold Call.&quot; Nancy is a member of Toastmasters International.</Notes>
        <ReportsTo>2</ReportsTo>
    </Employees>
    <Employees>
        <EmployeeID>2</EmployeeID>
        <LastName>Fuller</LastName>
        <FirstName>Andrew</FirstName>
        <Title>Vice President, Sales</Title>
        <TitleOfCourtesy>Dr.</TitleOfCourtesy>
        <BirthDate>02/19/52</BirthDate>
        <HireDate>08/14/92</HireDate>
        <Address>908 W. Capital Way</Address>
        <City>Tacoma</City>
        <Region>WA</Region>
        <PostalCode>98401</PostalCode>
        <Country>USA</Country>
        <HomePhone>(206) 555-9482</HomePhone>
        <Extension>3457</Extension>
        <Photo>Array of VT_UI1</Photo>
        <Notes>Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.</Notes>
        <ReportsTo></ReportsTo>
    </Employees>
</ROOT>

XML DTD Data description (emp.dtd):
<!-- Database Location: Sample.mdb -->
<!-- .DTD file generated by DbTkXml (Version 1.2a) (C) Copyright 2000-2002 B. Eichberger http://www.ProfSoftware.com -->
<!ELEMENT Sample (Employees)+>
<!ELEMENT Employees (EmployeeID,LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo)>
<!ELEMENT EmployeeID (#PCDATA)>
<!ELEMENT LastName (#PCDATA)>
<!ELEMENT FirstName (#PCDATA)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT TitleOfCourtesy (#PCDATA)>
<!ELEMENT BirthDate (#PCDATA)>
<!ELEMENT HireDate (#PCDATA)>
<!ELEMENT Address (#PCDATA)>
<!ELEMENT City (#PCDATA)>
<!ELEMENT Region (#PCDATA)>
<!ELEMENT PostalCode (#PCDATA)>
<!ELEMENT Country (#PCDATA)>
<!ELEMENT HomePhone (#PCDATA)>
<!ELEMENT Extension (#PCDATA)>
<!ELEMENT Photo (#PCDATA)>
<!ELEMENT Notes (#PCDATA)>
<!ELEMENT ReportsTo (#PCDATA)>

Logfile:
If you run this command on Feb 18th, 2001 the logfile would be created in:
logs/20010218/db2xml.log
INIT    |13:35:03.438 |====== Opening c:/dbtkxml/logs/20010218/db2xml.log ======
DbTkXml |13:35:03.549 |ExecCmd: opendb Sample.mdb
DbTkXml |13:35:03.599 |ExecCmd: table Employees
DbTkXml |13:35:03.619 |ExecCmd: XMLEXPORT emp.XML
DbTkXml |13:35:03.639 |9 'Employees' Record(s) written to 'emp.XML'

DbTkXml,DbXmlTools,DbXml,Database,Export,Import,SQL,MDB,XML,DTD,HTML,CSV,Access,Toolkit,
Table,Column,Field,Record,Index,Query,External Data,Save As,merge,synchronize,explorer,
Db2XML,Db2CSV,Db2Txt,Db2Html,DbLoad,DbExplorer,DbSql,DbQuery,DbScript,
Conversion,Automate,API,Windows,Microsoft,utilities,file,management,administration,
command,line,batch scipts, shareware