帮助我为mssql数据库生成xml架构的工具?

时间:2021-06-12 12:49:35

I'd like to be able generate an xsd of my MSSQL database's structure. Are there any tools or libraries that help me to this?

我希望能够生成我的MSSQL数据库结构的xsd。是否有任何工具或库可以帮助我实现这一目标?

The VS designer for typed datasets come's close, but I'm looking for a programmatic approach.

用于类型化数据集的VS设计师已经接近尾声,但我正在寻找一种程序化方法。

3 个解决方案

#1


Since there's no standard approach that works for exporting relational data into XML documents, there's also no one approach for generating an XSD for that data.

由于没有标准方法可以将关系数据导出到XML文档中,因此也没有一种方法可以为该数据生成XSD。

However... I got past a similar roadblock a while back by creating a small model of the database using Access, and then exporting from Access into XML data and XSD schema files. (I don't remember the exact menu commands for this; they weren't obvious, but they do exist.) The generated XML and XSD weren't suitable for my application, but just having that example to work with was enough to get me started.

但是......我通过使用Access创建一个小型数据库模型,然后从Access导出到XML数据和XSD架构文件,我不久前遇到了类似的障碍。 (我不记得确切的菜单命令;它们并不明显,但它们确实存在。)生成的XML和XSD不适合我的应用程序,但只是让这个例子可以使用就足够了我开始了。

I hope this helps.

我希望这有帮助。

#2


Altova's latest version of XMLSpy can do it. The option is at Convert|Create XML Schema from DB Structure. It wasn't great (the generated schema wasn't one that it'd actually accept as valid due to a bit of cruft it includes—which is weird) but it included both primary and foreign keys. This isn't exactly a programmatic approach, but it might get you started.

Altova的最新版本的XMLSpy可以做到这一点。该选项位于转换|从DB结构创建XML架构。它不是很好(生成的模式不是它实际上接受的有效因为它包含的一点点 - 这很奇怪)但它包括主键和外键。这不是一个程序化的方法,但它可能会让你开始。

#3


Deeno, Have you tried this?

Deeno,你试过这个吗?

SELECT col1, col2 from YourTable for xml AUTO, ELEMENTS

Here's another decent example: http://codingsense.wordpress.com/2008/12/31/mssql-output-in-xml-using-for-xml/

这是另一个不错的例子:http://codingsense.wordpress.com/2008/12/31/mssql-output-in-xml-using-for-xml/

#1


Since there's no standard approach that works for exporting relational data into XML documents, there's also no one approach for generating an XSD for that data.

由于没有标准方法可以将关系数据导出到XML文档中,因此也没有一种方法可以为该数据生成XSD。

However... I got past a similar roadblock a while back by creating a small model of the database using Access, and then exporting from Access into XML data and XSD schema files. (I don't remember the exact menu commands for this; they weren't obvious, but they do exist.) The generated XML and XSD weren't suitable for my application, but just having that example to work with was enough to get me started.

但是......我通过使用Access创建一个小型数据库模型,然后从Access导出到XML数据和XSD架构文件,我不久前遇到了类似的障碍。 (我不记得确切的菜单命令;它们并不明显,但它们确实存在。)生成的XML和XSD不适合我的应用程序,但只是让这个例子可以使用就足够了我开始了。

I hope this helps.

我希望这有帮助。

#2


Altova's latest version of XMLSpy can do it. The option is at Convert|Create XML Schema from DB Structure. It wasn't great (the generated schema wasn't one that it'd actually accept as valid due to a bit of cruft it includes—which is weird) but it included both primary and foreign keys. This isn't exactly a programmatic approach, but it might get you started.

Altova的最新版本的XMLSpy可以做到这一点。该选项位于转换|从DB结构创建XML架构。它不是很好(生成的模式不是它实际上接受的有效因为它包含的一点点 - 这很奇怪)但它包括主键和外键。这不是一个程序化的方法,但它可能会让你开始。

#3


Deeno, Have you tried this?

Deeno,你试过这个吗?

SELECT col1, col2 from YourTable for xml AUTO, ELEMENTS

Here's another decent example: http://codingsense.wordpress.com/2008/12/31/mssql-output-in-xml-using-for-xml/

这是另一个不错的例子:http://codingsense.wordpress.com/2008/12/31/mssql-output-in-xml-using-for-xml/