将XDR转换为XSD

时间:2012-11-29 12:32:26

标签: c# xml xsd schema

我有一个this格式

的xml架构文档
<Schema xmlns="urn:schemas-microsoft-com:xml-data" 
  xmlns:dt="urn:schemas-microsoft-com:datatypes">
  <AttributeType name="scale" default="4.0"/>
  <ElementType name="GPA" content="textOnly" dt:type="float">
    <attribute type="scale"/>
  </ElementType>
  <AttributeType name="studentID"/>
  <ElementType name="student" content="eltOnly" model="open" order="many">
    <attribute type="studentID"/>
    <element type="GPA"/>
  </ElementType>
</Schema>

我想从给定的模式生成C#中的类。我在网上查了一下XSD.exe 只能从W3C XML Schema生成类。 是否有办法将此格式转换为W3C?

我是XSD的新手并尝试重写它,但却出现了很多错误。 请帮忙。 在此先感谢

1 个答案:

答案 0 :(得分:0)

你可以试试这个:

C# Auto generation of class objects from XSD

或者,我刚写了一个开源的通用建模器。您可以使用它以您喜欢的任何语言生成类。

https://github.com/homer6/modeler

如果你fork了crudecppmodeler分支,它就类似于C#。不管怎样,或者我可以专门为你设计它。

它不是基于XSD,但我可以适应它。我打算在接下来的几天内写下对多重性的支持。

以下为示例格式:https://github.com/homer6/modeler/blob/crudecppmodeler/simple.jm

希望有帮助...