没有xsd.exe的XML序列化和架构 [英] XML Serialization and Schema without xsd.exe
问题描述
我使用XML序列化读取我的Config-POCO。
I use XML serialization for the reading of my Config-POCOs.
要在Visual Studio中获得对XML文件的智能支持,我需要一个模式文件。我可以使用xsd.exe mylibrary.dll创建架构,并且工作正常。
To get intellisense support in Visual Studio for XML files I need a schema file. I can create the schema with xsd.exe mylibrary.dll and this works fine.
但是我希望如果将对象序列化到文件系统中,则始终创建架构。有没有不用xsd.exe的方法吗?
But I want that the schema is always created if I serialize an object to the file system. Is there any way without using xsd.exe?
推荐答案
查看 System.Xml.Serialization.XmlSchemaExporter
类。我不记得确切的细节,但是该命名空间中有足够的功能来满足您的要求。
Look at the System.Xml.Serialization.XmlSchemaExporter
class. I can't recall the exact details, but there is enough functionality in that namespace to do what you require.
这篇关于没有xsd.exe的XML序列化和架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!