• Map SQL table to XML schema (SQL Server 2000)

    Home » Forums » Developers, developers, developers » DevOps Lounge » Map SQL table to XML schema (SQL Server 2000)

    Author
    Topic
    #422643

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #964562

      I also don’t know where this question belongs. smile

      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?

    • #964590

      I’m not sure whether this is a typo: [indent]


      must follow a schema not created by another party


      [/indent] 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.

      • #964692

        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!

        • #964698

          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.

    Viewing 1 reply thread
    Reply To: Map SQL table to XML schema (SQL Server 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: