使用 Visual Studio xsd.exe 生成代码时的 Pascal 大小写类名称
标题几乎说明了一切。 VS xsd.exe 以驼峰式大小写创建类。有没有办法生成帕斯卡大小写的类?
如果没有,有人知道有一个好工具可以将大量类名从驼峰式大小写转换为帕斯卡式大小写。
谢谢
编辑:
xsd.exe 不会按照标准生成驼峰式大小写的类名 - 它只是遵循架构的约定 - 但是,我有兴趣覆盖此行为,因此 XmlElement name 属性仍然会遵循模式定义的约定,但类名采用 pascal 大小写。
Title pretty much says it all. VS xsd.exe creates classes in camel case. Is there a way of generating the classes in pascal case?
If not does anyone know of a good tool to convert a load of class names from camel case to pascal case.
Thanks
EDIT:
xsd.exe doesn't generate class names in camel case as standard - it just follows the convention of the schema - however, I am interested in overriding this behaviour so the XmlElement name attribute will still follow the conventions defined by the schema, but the class name is pascal case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道 xsd.exe 这样做了,您确定架构中的类型也没有在驼峰命名法中定义吗?
我的建议是使用 xsd2code,它在各方面都远远优于 xsd.exe。
I wasn't aware that xsd.exe did that, are you sure the types in the schema are not defined in camelCase also?
My suggestion would be to use xsd2code, which is far superior to xsd.exe in every way..
查看 XmlSchemaClassGenerator,这是一个开源控制台应用程序,其功能包括 PascalCasing。 (我在 xsd2code 的 15 天试用期结束后发现了这一点。)
就我而言,在让控制台应用程序正常工作之前,我必须修改 xsd 文档以包含
targetNamespace
字段如下:原始:
修改:
我的最终用法如下所示:
Check out XmlSchemaClassGenerator, an open source console application that includes PascalCasing among its features. (I found this after the 15-day trial of xsd2code expired.)
In my case, before I could get the console app to work, I had to modify the xsd document to include a
targetNamespace
field as follows:Original:
Modified:
My final usage looked something like this: