Re: UPDATE a XML file problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Assuming SQL Server:
Run the XML into a stored procedure that prunes out items that are exactly
alike and only runs the changes. With OPEN XML, you can query XML like a
database table. ANother option is to do an XML bulk load into a "temp" table
and run the changes there.

Otherwise: You may have to run through the records one by one to get the
Customer IDs and then query the database to pull the same information. You
can then update those that have changed by looping through the records and
then calling Update() on the DataAdapter.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Ina" <roberta.inalbon@xxxxxxxxx> wrote in message
news:1151414051.966037.277500@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Good morning,

I have this code vbscript code for updata a xml file in to a database.
(sample) . I need to update a xml from a database1 to another
database2. As the results from the database1 generally changes a every
week, I need to export all the data to database2. I would like to
update this database3.

' VBScript source code

set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")

objBL.ConnectionString =
"provider=SQLOLEDB.1;datasource=localhost;database=MyDatabase;integrated
security=SSPI"

objBulkLoad.IgnoreDuplicateKeys = True
objBulkLoad.KeepIdentity = False
objBulkLoad.KeepNulls = True
objBulkLoad.ForceTableLock = True
objBulkLoad.SchemaGen = True
objBulkLoad.SGUseID = True
objBulkLoad.SGDropTables = True

objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "customersmapping.xml", "customers.xml"
Set objBL = Nothing


and I update this xml file and all is ok

<?xml version="1.0" encoding="utf-8" ?>
<ROOT xmlns="custommers.xsd">
<Customers>
<CustomerId>1111</CustomerId>
<CompanyName>Sean Chai</CompanyName>
<City>NY</City>
</Customers>
<Customers>
<CustomerId>1112</CustomerId>
<CompanyName>Tom Johnston</CompanyName>
<City>LA</City>
</Customers>
<Customers>
<CustomerId>1113</CustomerId>
<CompanyName>Institute of Art</CompanyName>
</Customers>
<Customers>
<CustomerId>1156</CustomerId>
<CompanyName>School</CompanyName>
</Customers>
<Customers>
<CustomerId>189</CustomerId>
<CompanyName>TOTO</CompanyName>
</Customers>
</ROOT>

Now i would like to upload this file

<?xml version="1.0" encoding="utf-8" ?>
<ROOT xmlns="custommers.xsd">
<Customers>
<CustomerId>1111</CustomerId>
<CompanyName>Sean Chai</CompanyName>
<City>NY</City>
</Customers>
<Customers>
<CustomerId>1112</CustomerId>
<CompanyName>Tom Johnston</CompanyName>
<City>LA</City>
</Customers>
<Customers>
<CustomerId>1113</CustomerId>
<CompanyName>Institute of Art</CompanyName>
</Customers>
<Customers>
<CustomerId>1156</CustomerId>
<CompanyName>School</CompanyName>
</Customers>
<Customers>
<CustomerId>189</CustomerId>
<CompanyName>Laria</CompanyName>
</Customers>
<Customers>
<CustomerId>156</CustomerId>
<CompanyName>Jonathan</CompanyName>
<City>NY</City>

</Customers>

</ROOT>

and I cannot do it! because it doesn't take on consideration the
changes on this file... How can I update this the changes into my
database3.

Any suggestion.

Ina



.



Relevant Pages

  • Re: XML parser and writer
    ... them on a calendar. ... Therefore I will need to both easily parse and write new XML files. ... why not some database technology? ... an advanced user can edit the XML file directly at ...
    (comp.lang.java.programmer)
  • Re: Special Characters not resolving
    ... starting data at the origin in an ORacle database is 2000 characters. ... When the XML isdelivered to me on disk and I load an ... Obviously I need to find either a way to have the XML file provider strip ...
    (microsoft.public.dotnet.xml)
  • Re: dynamic class instantiation
    ... I think mixing XML, ... LDF to python parser is a LOT ... This xml file is then fed into the database at the ...
    (comp.lang.python)
  • Re: XML and the Datagrid
    ... I find it, when it is in memory, exactly as good as the database, because it ... I wished that the complexity from an XML file was in a real database system. ... It is in my opinion the best thing to describe and hold data until now and I ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [PHP] Re: About Incorporating MySQL and XML/XSLT/PHP
    ... There is no great rationale to convert data from the form into XML prior to ... the application database. ... Those PHP files will process the data as i just ... > information from the customers? ...
    (php.general)