Hi,
I am trying to add an annotation with a documentation, which contains
several nodes. So far, I having a problem on how to code this with C#.
Any help is appreciated.
<xsd:annotation>
<xsd:documentation>
<Description>my description</Description>
<Year>2004</Year>
<Level>Final Release</Level>
<Date>February 11, 2005</Date>
</xsd:documentation>
</xsd:annotation>
public XmlSchemaAnnotation CreateAnnotation(bool bAddDoc, bool
bAddDocElements, string strDocNodeName)
{
XmlSchemaAnnotation annot = new XmlSchemaAnnotation();
if (bAddDoc)
{
XmlSchemaDocumentation doc = new XmlSchemaDocumentation();
// add document node
annot.Items.Add(doc);
// Add elements under the document
if (bAddDocElements)
{
doc.Markup = CreateElementNodes();
}
else
{
doc.Markup = CreateDocumentNode(strDocNodeName);
}
}
return annot;
}
public static XmlElement[] CreateElementNodes()
{
XmlDocument doc = new XmlDocument();
return new XmlElement[1]{doc.CreateElement("prefix", "localname",
"nsURI")};
}