I have a large XML schema that has elements that look like this:
<xs:element name="Tmats">
<xs:complexType>
<xs:sequence>
<xs:element name="ProgramName" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>PN</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="TestItem" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>TA</xs:documentation>
</xs:annotation>
</xs:element>
To use it effectively, I need an association between the element name
attribute, and the documentation
element, as in:
TestItem <==> TA
My first thought was that the elements should have attributes to capture the documentation elements, like this:
public partial class Tmats
{
[Documentation("PN")]
public string ProgramName { get; set; }
[Documentation("TA")]
public string TestItem { get; set; }
}
...but I am concerned about performance, as these attributes will be scanned pretty extensively during normal usage.
I took a first stab at creating C# classes using XSD.EXE, but that tool doesn't appear to capture the annotation elements at all. Plus, the code it creates is pretty ugly.
Suggestions? Is there a better way to approach this?