RAD Studio for Microsoft .NET
ContentsIndex
PreviousUpNext
Creating Metadata for a DataSet

When you choose to use an XML file for a data source in an ASP.NET application using DB Web Controls, you may need to create the metadata to structure the XML data in your DataSet. If you chose to create an XML file without an XML schema file (.xsd), you need to manually create the metadata. This procedure assumes that you have already created an XML file containing data.

Note: DB Web Controls (Borland.Data.Web namespace) are being deprecated in 2007. You should use standard Web controls instead.

To set up the application

  1. Choose FileNewASP.NET Web Application for either Delphi for .NET.
  2. Drag and drop a DBWebDataSource control onto the form.
  3. Drag and drop a DataSet component onto the form.
  4. Click the ellipsis button (...) next to the XMLFileName property of the DBWebDataSource and locate your XML file.
  5. Select the DataSet component in the Component Tray.
  6. Click the Tables (Collection) property to display the Tables Collection Editor.

To create the metadata

  1. Click Add to add a new table to the collection. For the sake of illustration, we'll use the following XML records.

<?xml version="1.0" standalone="yes"> /// XML Declaration
<NewSongs>

 /// <song> becomes the table name in your DataSet.
    <song>      

    /// <songid> becomes Column1 in your DataSet.    
        <songid>1001</songid>  

 /// <title> becomes Column2 in your DataSet.
        <title>Mary Had a Little Lamb</title>  
    </song>
    <song>
        <songid>1003</songid>
        <title>Twinkle, Twinkle Little Star</title>
    </song>
</NewSongs>

  1. Change the TableName property to song.
  2. Click the Columns (Collection) property to display the Columns Collection Editor.
  3. Click Add to add a new column.
  4. Change the ColumnName property to songid.
  5. Click Add to add another new column.
  6. Change the ColumnName property to title.
  7. Click Close to close the Columns Collection Editor.
  8. Click Close to close the Tables Collection Editor. You have now created the metadata to match the XML file data.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!