Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Map SQL table to XML schema (SQL Server 2000)

    I hope this is the right place to post this question.

    I have a table which I need to make into an XML document. But the XML document must follow a schema not created by another party. What is the best way to transfer the records in this table to an XML document and still follow the schema? The table is in a database on our SQL server. Thank you.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Map SQL table to XML schema (SQL Server 2000)

    I also don't know where this question belongs. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Using ADO, you can persist a recordset to disk as an XML document. The syntax for the method is:

    myRecordset.Save Complete_Path, adPersistXML

    This will not include schema information, to my knowledge. Does that help?

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Map SQL table to XML schema (SQL Server 2000)

    I'm not sure whether this is a typo:
    <hr>must follow a schema not created by another party<hr>
    Do you want to use a schema you generate, one you have had specified, or what? If you're doing this in .Net, there are a variety of ways of reading, writing, and using a schema, so you need to provide more information. If you're doing it from Access, your options are far more limited.
    Charlotte

  4. #4
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Map SQL table to XML schema (SQL Server 2000)

    oops. sorry. it is a typo. and yes, i need to follow the schema created by an outside party. I am a newbie in XML, SQL/XML as well .NET. Can you possibly point me to the correct way of aproaching this task. I don't know if I even know where to start! Not all of the fields in my table are on the schema. And of the fields that are on the schema, some are are defined as element, others as attributes etc. Help!

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Map SQL table to XML schema (SQL Server 2000)

    I'm not sure of your comfortability with coding. The best way will be to create a DataSet object based on the provided schema. Then populate the dataset with the data from the table. Finally, export the contents of the dataset as XML. Search the Visual Studio or MSDN site for help on the specific steps I've mentioned.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •