HomeActive Query BuilderLoad from xml programmatically?

Load from xml programmatically?


How to load from an XML file programmatically? Can you show some code? It will be deeply appreciated.
Daniel | email
August 7 2007, 06:40 AM
Here is the procedure of saving and loading Metadata Container to/from XML file for the ActiveX Edition. The procedure for other editions has much in common with this one, except the connection procedure.

// =========================
// Part one: creation of initial XML file
// ========================

// set this option to True BEFORE retrieving metadata from the database.
// setting this option will slower metadata retrieval procedure,
// but allows you to extract fields of all database objects at once.
ActiveQueryBuilderX1.WorkOffline = True; // This property is called "OfflineMode" in the .NET Edition

// setup database connection
ActiveQueryBuilderX1.ConnectionString = 'your ADO connection string here';

// Retrieve metadata from the database and load it to the Metadata Container
ActiveQueryBuilderX1.Connect; //Other editions should use the RefreshMetadata method instead

// save metadata container content to the XML file
ActiveQueryBuilderX1.MetadataContainer.SaveToXMLFile('your filename.xml');

// or retrieve the same information as a string:
mystring = ActiveQueryBuilderX1.MetadataContainer.XML;

// =========================
// Part two: loading metadata from XML file
// ========================

// you should also set the offline mode when working without database connection
// to prevent retrieval of additional metadata information from the database
ActiveQueryBuilderX1.WorkOffline = True;

// load metadata container container from XML file or from URL
ActiveQueryBuilderX1.MetadataContainer.LoadFromXMLFile('your filename or URL.xml');

// or load the same information from string
ActiveQueryBuilderX1.MetadataContainer.XML = mystring;
Sergey Smagin | email
1 month, 2 weeks since original post
This topic is closed