从xsd动态创建winform
我正在编写一个 XSD 解析器,它动态构建简单的 WinForm(基于输入 XSD 方案)。
我只想使用 xsd 定义的结构,而不添加 xsd 标准元素之外的任何内容。
问题:
- 我希望 xsd:element 定义一个控件。如何区分哪个 xsd:element 定义了哪种控件类型(尤其是粗体的)? (基本有 TextBox、TextArea(多行文本框)、ComboBox、RadioGroup(单选按钮组)、DateTimePicker、CheckBox、Panel< /strong>、按钮)。
- 标签怎么样 - 也许最好在包含数据的其他控件(文本框等)的 xsd:element 中定义它们?如何 ?
我需要这个解析器来使客户端能够通过第 3 方工具生成架构,然后将 XSD 填充到我的应用程序中并打开 WinForm(无需对其进行编程),并在进一步的步骤中生成包含数据和一些输出的 xml。
I am writing an XSD parser which dynamically builds simple WinForm (based on input XSD scheme).
I want to use only xsd defined structures, not adding anything beyond xsd standard elements.
Questions:
- I want xsd:element to define a control. How to distinguish which xsd:element defines which control type (especially the bolded ones)? (basic are TextBox, TextArea(multiline textbox), ComboBox, RadioGroup(group of radiobuttons), DateTimePicker, CheckBox, Panel, Button).
- How about labels - maybe is it better to define them inside xsd:element of other control containing data (TextBox, etc.)? How ?
I need this parser to enable the clients to generate a schema by 3rd party tool then populate the XSD into my app and open WinForm (without need of programming it) and in further steps produce xml with data and some output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以通过查看 XMLSpy 获得很多想法。具体来说,他们的 Stylevision 技术可能与您想要实现的目标非常相似。
我认为它还突出了您的概念的一个总体问题 - XSD 不包含有关如何捕获 XML 将表示的数据的所有必要信息。您可以假设特定类型的默认编辑器等,但很快您就会遇到有人希望某些东西以不同的方式工作的情况,而 XSD 默认情况下不会支持它。我非常确定您最终会得到一些非标准扩展,没有开箱即用的工具会支持这些扩展,或者您自己的用于定义屏幕的 XML 语言。不过,我建议看一下 XMLSpy,他们的一些工具非常出色,应该会给您一些想法。
I think you can get a lot of ideas by having a look at XMLSpy. Specifically, their Stylevision technology is probably very similar to what you are trying to achieve.
I think it also highlights a bit of an issue with your concept in general - an XSD does not contain all the necessary information regarding how to capture the data that the XML will represent. You could assume default editors for specific types, etc, but pretty soon you will run into cases where someone wants something to work differently, and XSD will not, by default, support it. I am pretty sure you will end up with some non-standard extensions, which no out of the box tool will support, or your own XML-language for defining screens. Nevertheless, I suggest having a look at XMLSpy, some of their tooling is excellent and should give you some ideas.