Hi!

I'm working with an XSD Schema in C# and I have all of the classes imported through a C# code generator. Now I want to know if an element/property of a class is mandatory, optional and such. Any clues anyone?

using System;
using System.Collections.Generic;
using System.Text;
 
namespace XSDTest
{
    class Program
    {
        static void Main(string[] args)
        {
            System.IO.StreamReader str = new System.IO.StreamReader("webSearch.xml");
            System.Xml.Serialization.XmlSerializer xSerializer = new System.Xml.Serialization.XmlSerializer(typeof(ResultSet));
            ResultSet res = (ResultSet) xSerializer.Deserialize(str);
            foreach (ResultSetResult r in res.Result)
            {
                Console.WriteLine(r.Title);
                Console.WriteLine(r.Summary);
                Console.WriteLine();
            }
            str.Close();
 
            Console.ReadLine();
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.