Xsd文档值

时间:2012-11-07 14:03:10

标签: c# xsd annotations element

如何以编程方式创建xsd文档? 例如:

<xs:annotation>
<xs:documentation>Documentation</xs:documentation>
</xs:annotation>

我用过:

 XmlSchemaElement element = new XmlSchemaElement();
    XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
    XmlSchemaDocumentation doc = new XmlSchemaDocumentation();

    //doc.Value = "Documentation"; ??
    annotation.Items.Add(doc);
    element.Annotation = annotation;

但如何设置文档值? XmlSchemaDocumentation类型中没有此类属性。谢谢!

1 个答案:

答案 0 :(得分:1)

我认为你错过了一件小事,比如

annotation.Items.Add(doc);
doc.Markup = TextToNodeArray("Your text you need");

你可以尝试一下,看看这有什么帮助?

另请参阅http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschemadocumentation.aspx,这应该给你很好的例子,否则如何使用它。

相关问题