CSharp examples for System.Xml:XML Schema
Get All Complex 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;// ww w . j av a2s. co m public class Main{ /// <summary> /// Get All Complex Types from the Schema. /// </summary> /// <param name="schema"></param> /// <returns></returns> public static List<XmlSchemaComplexType> GetAllComplexTypes(XmlSchema schema) { List<XmlSchemaComplexType> complexTypes = new List<XmlSchemaComplexType>(); foreach (XmlSchemaObject item in schema.Items) { if (item is XmlSchemaComplexType) complexTypes.Add((XmlSchemaComplexType)item); } return complexTypes; } }