I'd like to generate the classes the xsd.exe way and not the linqtoxsd way.
我想生成xsd.exe方式的类而不是linqtoxsd方式。
Thanks, --Ran.
谢谢, - 兰。
4 个解决方案
#1
10
Look at the System.Xml.Serialization.XmlCodeExporter class.
查看System.Xml.Serialization.XmlCodeExporter类。
UPDATE (in case John Saunders didnt bother reading further)
更新(如果约翰桑德斯没有进一步阅读)
"Xsd.exe uses XmlCodeExporter to generate classes from XML Schema Definition (XSD) documents."
“Xsd.exe使用XmlCodeExporter从XML Schema Definition(XSD)文档生成类。”
#2
5
Try Xsd2Code
试试Xsd2Code
Seems to be the best free/Open source tool out there.
似乎是最好的免费/开源工具。
Good integration with VS2010
与VS2010良好集成
It's working great for me.
它对我很有用。
#3
3
You can call xsd.exe from your code using Process Class. I did it once and its fast and straightforward. You won't need to bored much :).
您可以使用Process Class从代码中调用xsd.exe。我做过一次而且快速而直接。你不需要太多无聊:)。
#4
1
Which part of the process do you not know how to do?
你不知道该怎么办?
You can load one or more instances of the XmlSchema class into an XmlSchemaSet. This will allow you to programmaticly examine all parts of the schema and other schemas it may reference. You can use this information to generate code, either as text that will later need to be compiled, or else using the CodeDOM. See Dynamic Source Code Generation and Compilation.
您可以将XmlSchema类的一个或多个实例加载到XmlSchemaSet中。这将允许您以编程方式检查模式的所有部分以及它可能引用的其他模式。您可以使用此信息生成代码,可以是以后需要编译的文本,也可以使用CodeDOM。请参阅动态源代码生成和编译。
If you are generating code in the context of Visual Studio, then I'd suggest you do so via T4 Templates. See Generating Artifacts By Using Text Templates.
如果您在Visual Studio的上下文中生成代码,那么我建议您通过T4模板执行此操作。请参阅使用文本模板生成工件。
#1
10
Look at the System.Xml.Serialization.XmlCodeExporter class.
查看System.Xml.Serialization.XmlCodeExporter类。
UPDATE (in case John Saunders didnt bother reading further)
更新(如果约翰桑德斯没有进一步阅读)
"Xsd.exe uses XmlCodeExporter to generate classes from XML Schema Definition (XSD) documents."
“Xsd.exe使用XmlCodeExporter从XML Schema Definition(XSD)文档生成类。”
#2
5
Try Xsd2Code
试试Xsd2Code
Seems to be the best free/Open source tool out there.
似乎是最好的免费/开源工具。
Good integration with VS2010
与VS2010良好集成
It's working great for me.
它对我很有用。
#3
3
You can call xsd.exe from your code using Process Class. I did it once and its fast and straightforward. You won't need to bored much :).
您可以使用Process Class从代码中调用xsd.exe。我做过一次而且快速而直接。你不需要太多无聊:)。
#4
1
Which part of the process do you not know how to do?
你不知道该怎么办?
You can load one or more instances of the XmlSchema class into an XmlSchemaSet. This will allow you to programmaticly examine all parts of the schema and other schemas it may reference. You can use this information to generate code, either as text that will later need to be compiled, or else using the CodeDOM. See Dynamic Source Code Generation and Compilation.
您可以将XmlSchema类的一个或多个实例加载到XmlSchemaSet中。这将允许您以编程方式检查模式的所有部分以及它可能引用的其他模式。您可以使用此信息生成代码,可以是以后需要编译的文本,也可以使用CodeDOM。请参阅动态源代码生成和编译。
If you are generating code in the context of Visual Studio, then I'd suggest you do so via T4 Templates. See Generating Artifacts By Using Text Templates.
如果您在Visual Studio的上下文中生成代码,那么我建议您通过T4模板执行此操作。请参阅使用文本模板生成工件。