使用XML/XSD在C#中生成Intellisense [英] Using XML/XSD to generate Intellisense in C#

查看:88
本文介绍了使用XML/XSD在C#中生成Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个xml文档,其中包含一个我称为Control的序列化结构的列表.

公共结构控制
{
    公共FindItBy定位器;
    公共字符串ControlLocation;
    公共字符串标签;
} 

FindItBy是枚举.

理想情况下,我希望有多个列表,其中每个控件都有一个唯一的名称(按其所在的列表).我要寻找的是Intellisense,它能够从这些XML文档中读取并显示其中包含哪些控件.

我正在做的是编写一个测试框架,而Control结构是一种在页面上映射静态html元素的方法.为了节省时间,我想以编程方式在XML或Intellisense可以读取的某些文档上创建这些控件,以便 测试人员可以轻松找到控件,而无需浏览XML即可找到正确的控件.

这可能吗?

谢谢

解决方案

XSD可以向支持它的编辑器提供智能感知,以了解文档中的有效条目是什么,但是做诸如解释文档之类的事情,这听起来就像您想要一个XML样式表(XSLT).独特的命名要求 这将是序列化过程的功能,您可能希望在结构中添加一个字段以简化此操作,因为默认情况下,序列化过程不会为yoru控件的每个控件提供唯一的名称.


I am looking to create an xml document that contains a list of a serialized struct I called Control.

public struct Control
{
    public FindItBy Locator;
    public string ControlLocation;
    public string Tag;
}

Where FindItBy is an enum.

Ideally I want to have multiple lists where each Control has a unique name by the list it is on. What I am looking for is Intellisense to be able to read from these XML documents and show what Controls there are.

What I am doing is writing a test framework and the Control struct is a way to map the static html elements on a page. To save myself time, I want to create these Controls programmatically on an XML, or some document that Intellisense can read from, so that a tester can easily find the Control without having to browse the XML to find the correct Control.

Is this possible?

Thanks

解决方案

An XSD can provide intellisense, to editors that support it, for what are valid entries within the document, but to do something like interpret the document, which is what it sounds like you want an XML stylesheet (XSLT).  The unique naming requirement would be a function of the serialization process and you may want to add a field to your structure to facilitate this, because the process of serialization is not going to, by default, provide yoru control with a unique name for each individual control.


这篇关于使用XML/XSD在C#中生成Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆