CSharp examples for System.Xml:XML Schema
Get all simple types from the XML schema.
using System.Xml.Schema; using System.Xml; using System.Text; using System.Linq; using System.Diagnostics; using System.Collections.Generic; using System.Collections; using System;//from w ww. j a va2s . c o m public class Main{ /// <summary> /// Get all simple types from the schema. /// </summary> /// <param name="schema"></param> /// <returns></returns> public static List<XmlSchemaAttribute> GetAllAttributes(XmlSchema schema) { List<XmlSchemaAttribute> attributes = new List<XmlSchemaAttribute>(); foreach (XmlSchemaObject item in schema.Items) { if (item is XmlSchemaAttribute) attributes.Add((XmlSchemaAttribute)item); } return attributes; } }