[dba-VB] XML

jwcolby jwcolby at colbyconsulting.com
Mon Mar 31 09:01:26 CDT 2008

I am using the VB.Net built-in XML serializer to serialize a class to XML.
I gather a bunch of data into class properties and then when the class is
filled out I write it to a file.  Each class represents the process of
importing a single file of text data, in this case CSV data.  Thus I have
one XML log file per CSV file imported into a temp table.

The data looks like:

  <?xml version="1.0" ?> 
- <clsCSVDataImportLogData
  <pMemo>228716234 : 3/31/2008 1:11:59 AM : Move to Archive:
228716250 : 3/31/2008 1:11:59 AM : Loading CSVReader3/31/2008 1:11:59 AM
228716250 : 3/31/2008 1:11:59 AM : Read File:
E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 :
3/31/2008 1:11:59 AM : File Loaded:
E:\PSM\Data\FirstAmerican\TaxRolls\PartnerShipTax20070824.txt 228716265 :
3/31/2008 1:11:59 AM : Bulk Copy: tblTaxRollsUpdate 228845875 : 3/31/2008
1:14:08 AM : Bulk Copy FAILED: Maximum column length of 100,000 exceeded in
column 7 in record 842,847. Set the SafetySwitch property to false if you're
expecting column lengths greater than 100,000 characters to avoid this
error. 228845890 : 3/31/2008 1:14:08 AM : Bulk Copy Finished:
tblTaxRollsUpdate 228845890 : 3/31/2008 1:14:08 AM : RECORDS READ: 842847
228845906 : 3/31/2008 1:14:08 AM : RECORDS BULK COPIED: 840000 228845906 :
3/31/2008 1:14:08 AM : Individual table: tblPartnerShipTax20070824 IMPORT

I like writing the data to XML files, one xml file per import file because
it allows me to go to a know location, look for a specific file, open it and
scan what happened.  For example this file failed to import.  Knowing the
file name I can go look for a matching log file and just read it.

I read a bunch of files, as many as are in a process directory.  As I finish
filling out the class instance information I store the classes that into a
collection, so at the end of the overall process I have a collection of
every file that was processed.  

What I am trying to figure out is whether the data from each class can be
stored in a common XML file?  The serializer appears to build an entire file
just for that class, with all the header info etc.  It seems that once you
get that stuff, you really just want the <pTblName> through <pMemo> written
for each class.

Also, is it possible to coerce the serializer to write the data type of the
property into the XML file?  It seems like this should be possible but I
can't see how.

John W. Colby
Colby Consulting

More information about the dba-VB mailing list