The Solution 1 given by
Dylan Morley is a good answer.
In case you want to check the above format without
XSD
schema then I think
Regex
can be used with the following format
string xmlString =@"<RPM>
<AI ID=""1918"" user=""xyzs "" Act=""T"" />
</RPM>";
bool isValid = Regex.IsMatch(xmlString, @"<RPM>\s*<AI\s+ID\s*=\s*""\d+""\s+" +
@"user\s*=\s*""[a-z]+\s*""\s+Act\s*=\s*""[A-Z]""\s*/>\s*</RPM>",
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase |
RegexOptions.Multiline);
The
Regex
pattern can be tested here
http://regexhero.net/tester/[
^]