xml 如何将 xsd 转换为人类可读的文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/237938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 12:11:02  来源:igfitidea点击:

How to convert xsd to human readable documentation?

xmlxsd

提问by Jonas Pegerfalk

We have a few XML based interfaces that is quite well documented in XSD schemas. The interfaces are now going to be publicly available and we would like to create reference documentation for them.

我们有一些基于 XML 的接口,它们在 XSD 模式中得到了很好的记录。这些接口现在将公开可用,我们希望为它们创建参考文档。

Is there a tool that can automatically convert XSD files into some more readable format?

有没有可以自动将 XSD 文件转换为更易读的格式的工具?

回答by Andrew Kennan

xs3pmight do what you want (see also their SourceForce page).

xs3p可能会做您想做的事情(另请参阅他们的 SourceForce 页面)。

回答by Andrew Kennan

Insert this at the top of the XSD

将其插入 XSD 的顶部

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xs3p.xsl"?>

Then you can directly view the XSD file using a web-browser. The web browser does the conversion to HTML using the specified XSLT.

然后您可以使用网络浏览器直接查看 XSD 文件。Web 浏览器使用指定的 XSLT 转换为 HTML。

You don'tneed an XSL processor, but stylesheets like xs3p won't generate links using this approach. I use the Firefox web-browser, IE8 seems useless for this.

并不需要一个XSL处理器,但像xs3p样式表不会产生使用这种方法的链接。我使用 Firefox 网络浏览器,IE8 对此似乎没用。

I've tried these xsl stylesheets: https://sourceforge.net/projects/xs3p/files/xs3p-1.1.3.zip/downloadhttp://crism.maden.org/consulting/pub/xsl/xsd2html.xsl

我试过这些 xsl 样式表:https: //sourceforge.net/projects/xs3p/files/xs3p-1.1.3.zip/download http://crism.maden.org/consulting/pub/xsl/xsd2html.xsl

I think I prefer xs3p.

我想我更喜欢 xs3p。

回答by Mads Hansen

oXygenhas very nice XSD schema documentation toolthat allows for easy customization through options and additional CSS files.

oXygen有非常好的XSD 模式文档工具,允许通过选项和附加 CSS 文件轻松定制。

I haven't used it before, but FlexDoc/XMLis an XML documentation tool with an XSD documentation component called XSDDocthat looks interesting.

我以前没有使用过它,但FlexDoc/XML是一个 XML 文档工具,带有一个名为XSDDoc的 XSD 文档组件,看起来很有趣。

Of course, as pointed out in on of the other answers, XSD is just an XML file so a custom XSLT could be written to generate any documentation output you like.

当然,正如其他答案中所指出的,XSD 只是一个 XML 文件,因此可以编写自定义 XSLT 来生成您喜欢的任何文档输出。

回答by Robert Rossney

The odds are pretty good that you don't want to use a generic tool for documenting your schema. Schema documentation tools (I'm most familiar with the one in XML Spy) are designed to make schemas readable. From your description, it sounds like that's not really what you want; what you want is to use the information in your schema to as the basis of software documentation.

您很可能不想使用通用工具来记录您的架构。模式文档工具(我最熟悉 XML Spy 中的工具)旨在使模式可读。从你的描述来看,这听起来不是你真正想要的;您想要的是使用架构中的信息作为软件文档的基础。

When I've needed to do this, the approach I took was to design HTML that looked the way I needed the documentation to look, and then figure out what information in the schema I'd need to grab to populate it. Using that as a template, it's pretty straightforward to pull in relevant information from the schema using XSLT.

当我需要这样做时,我采用的方法是设计 HTML,使其看起来像我需要的文档外观,然后找出我需要获取模式中的哪些信息来填充它。使用它作为模板,使用 XSLT 从模式中提取相关信息非常简单。

回答by rjray

I have generated documentation in the past using a tool I found on Freshmeat.net called xsddoc. Looking it up just now (to get the direct link), I see that it has been superceded by its developers with a tool called xnsdoc. The newer one is free for use by open-source projects, but if you are using this for a commercial product you may have to license it. If the last version released under the "xsddoc" banner suits your purposes, then you can just use that one.

我过去曾使用在 Freshmeat.net 上找到的名为xsddoc的工具生成文档。刚刚查看它(以获取直接链接),我发现它的开发人员已使用名为xnsdoc的工具取代了它。较新的版本可供开源项目免费使用,但如果您将其用于商业产品,则可能需要获得许可。如果在“xsddoc”旗帜下发布的最后一个版本适合您的目的,那么您可以使用那个。

The documentation it produces has the look and feel of Javadoc, and allows for some degree of control in the stylesheet, etc.

它生成的文档具有 Javadoc 的外观和感觉,并允许对样式表等进行某种程度的控制。

回答by Mac

If you are ready to delve into the intricacies of Sandcastle, I highly recommend XML Schema Documenterwhich is a plugin for the excellent Sandcastle Help File Builder.

如果您准备深入了解Sandcastle的复杂性,我强烈推荐XML Schema Documenter,它是出色的Sandcastle Help File Builder的插件。

Possible outputs are the same as Sandcastle: a website, a HTML Help (CHM) file, MS Help 2content, MS Help Viewer 1...

可能的输出与 Sandcastle 相同:网站、HTML 帮助 (CHM) 文件、MS 帮助 2内容、MS 帮助查看器 1...

回答by Ather

An XSLT script can do the job.

XSLT 脚本可以完成这项工作。

回答by Ilya

It's should not be to hard to convert it (or write in advance) to docbookformat.

将它(或提前编写)转换为docbook格式应该不难。