C# 中的 Jaxb 等效项 [英] Jaxb equivalent in C#

查看:25
本文介绍了C# 中的 Jaxb 等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Java 中使用 JAXB 很容易从 xml 模式文件生成一组 Java 类,符合该模式的 xml 可以反序列化为.

Using JAXB in Java it is easy to generate from a xml schema file a set of Java classes that xml conforming to that schema can be deserialized to.

是否有一些 C# 等效于 JAXB?我知道 Linq 可以序列化和反序列化与 xml 文件之间的类.但是如何从 xml 模式文件生成 C# 类,然后将这些类与 linq 一起使用?

Is there some C# equivalent of JAXB? I know that Linq can serialize and deserialize classes to/from xml files. But how can I generate C# classes from xml schema file and then use this classes with linq?

推荐答案

如果您使用的是 Visual Studio, 试试 XML 架构定义工具.它采用您的模式定义并生成 C# 类——或者它可以采用另一种方式并从类中生成模式定义.它还有许多其他与 XML 相关的转换.

If you're using Visual Studio, try the XML Schema Definition Tool. It takes your schema definitions and produces C# classes -- or it can go the other way and produce schema definitions from classes. It also has a number of other XML-related transformations.

这篇关于C# 中的 Jaxb 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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