I have an XML Schema that I'm trying to create C# classes with. At the moment, I'm working with XSD2Code to create the classes. The original schemas have elements that look something like this:
<xs:element name="NumberOfTags" type="xs:positiveInteger" minOccurs="0">
<xs:annotation>
<xs:documentation>ALT\N</xs:documentation>
</xs:annotation>
</xs:element>
XSD2Code produces code that looks something like this:
/// <summary>
/// ALT\N
/// </summary>
public string NumberOfTags { get; set; }
The XML comment refers to a TMATS CODE that maps to a different data representation. I need to capture these codes in some sort of runtime-readable representation so that I can perform this mapping programmatically. My best idea to achieve this so far is to translate these XML comments to C# Attributes, and write additional code to reflect over them.
So here is my question. I would like to do a regex-style replace on the code generated by XSD2Code, using Visual Studio Find and Replace, so that the resulting code looks like this:
[TmatsCode(@"ALT\N")]
public string NumberOfTags { get; set; }
What is the regex that would achieve this?