Solved

Tools to create .xsd and sql schema from .xml file

Posted on 2003-12-02
7
994 Views
Last Modified: 2013-11-19

Hello,

I am trying to use SqlXML 3.0 SP2 to "Bulk Upload" an XML Document directly to my sql database.

I, however, have the following questions:

1. Given an .xml file, how do I generate an .xsd for it?  I have explored using the Microsoft XSD Inference Tool "infer.exe" and using the XML Schema Definition Tool (Xsd.exe from VS.Net 2003).  Both produce .xsd files, but do not seem to encapsulate relationships (e.g., sql:relation= or sql:relationship=) between the elements.

2. Given an .xsd file, are there any tools to create a sql schema from the .xsd file?

I am primarily interested in Microsoft tools for the above.

TIA,

-RD



0
Comment
Question by:rdefuria
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:dualsoul
ID: 9861419
the answer to both your questions (generations of xsd and sql schema by this xsd) is XMLSpy from Altova corporation - it's a very cool, and have both functions you need.

      But it's not Microsoft tool, but anyway you can try it, and solve does it suite your needs.
   You can download free trial from www.altova.com or www.xmlspy.com

Hope it helps.
0
 

Author Comment

by:rdefuria
ID: 9866227

Thanks for the tip.  I have downloaded an eval version of XMLSpy Enterprise version.  If you are familiar with it, how do I generate xsd from xml, and how do I then generate a sql schema from that?


0
 
LVL 15

Expert Comment

by:dualsoul
ID: 9866898
menu->DTD/Schema->generate DTD/Schema, as i remember, i take a look at it ealier and say you more precisely
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:dualsoul
ID: 9869371
ok, here i am :) so:
 to generate W3C schema:
        open your xml file in XMLSpy and then DTD/Shema (from menu)->Generate DTD/Schema...
               then select schema type you want (DTD or W3C or what you want)
       
 to generate Databse schema:
      Convert (from menu)->Create Database Schema, then select DB, XMLSpy supports Oracle, MS SQL,  you will see. Please note you should point how to connect to your Database instance then.

Hope it help
0
 

Author Comment

by:rdefuria
ID: 9882195
Hi, dualsoul,

i have tried to use xmlspy.

i have generated an xsd file from my xml file.

however, the Convert -> "create database schema" option you suggested to import to sql server seems to require that a database with a schema already exist.

did you mean Convert -> "Create DB Structure based on Schema" ?

Remember, I am looking for a way to create the sql schema for an xml file so I can use SqlXML 3.0 SP2 to "Bulk Upload" an XML Document directly to sql server.

Even though this is not a MS solution, you'll get the points if we can clear up this last piece.

-RD
0
 
LVL 15

Accepted Solution

by:
dualsoul earned 300 total points
ID: 9885066
>Even though this is not a MS solution
hm....you know, you can download XMLSpy VisualStudio .NET edition, to embed XMLSpy in VS.NET if you need this.

did you mean Convert -> "Create DB Structure based on Schema" ?
hm... you generate Schema from xml, and do Convert -> "Create DB Structure based on Schema" (it won't be enabled option for xml file, only for Schemas)->select some DB (i've just tried it with Access, cause i haven't Oracle or MSSQL installed for now), and then it creates for you new Database with tables and relational based on your Schema. It's works fine, i've just checked it up :)

or may be i didn't get what you exactly want?
0
 

Author Comment

by:rdefuria
ID: 9896224

No, that is what I want.  But I find that XMLSpy does not create any relationships between the tables.
That is, no parent-child relationships.

How do I get the database schema it creates to reflect the relationships between various tables?

Do I have to add those by hand?

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question