<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FXML%2FXmlSchema</id>
		<title>Csharp/CSharp Tutorial/XML/XmlSchema - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FXML%2FXmlSchema"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/XML/XmlSchema&amp;action=history"/>
		<updated>2026-04-29T19:34:34Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/XML/XmlSchema&amp;diff=5848&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/XML/XmlSchema&amp;diff=5848&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/XML/XmlSchema&amp;diff=5849&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/XML/XmlSchema&amp;diff=5849&amp;oldid=prev"/>
				<updated>2010-05-26T12:17:31Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Create Xml schema==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using System.Xml.Schema;&lt;br /&gt;
    public class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        public static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            XmlSchema schema = new XmlSchema();&lt;br /&gt;
            XmlSchemaSimpleType nametype = new XmlSchemaSimpleType();&lt;br /&gt;
            XmlSchemaSimpleTypeRestriction nameRes = new XmlSchemaSimpleTypeRestriction();&lt;br /&gt;
            nameRes.BaseTypeName = new XmlQualifiedName(&amp;quot;string&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;);&lt;br /&gt;
            XmlSchemaMinLengthFacet nameFacet1 = new XmlSchemaMinLengthFacet();&lt;br /&gt;
            nameFacet1.Value = &amp;quot;3&amp;quot;;&lt;br /&gt;
            XmlSchemaMaxLengthFacet nameFacet2 = new XmlSchemaMaxLengthFacet();&lt;br /&gt;
            nameFacet2.Value = &amp;quot;255&amp;quot;;&lt;br /&gt;
            nameRes.Facets.Add(nameFacet1);&lt;br /&gt;
            nameRes.Facets.Add(nameFacet2);&lt;br /&gt;
            nametype.Content = nameRes;&lt;br /&gt;
            XmlSchemaSimpleType phonetype = new XmlSchemaSimpleType();&lt;br /&gt;
            XmlSchemaSimpleTypeRestriction phoneRes = new XmlSchemaSimpleTypeRestriction();&lt;br /&gt;
            phoneRes.BaseTypeName = new XmlQualifiedName(&amp;quot;string&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;);&lt;br /&gt;
            XmlSchemaMaxLengthFacet phoneFacet1 = new XmlSchemaMaxLengthFacet();&lt;br /&gt;
            phoneFacet1.Value = &amp;quot;20&amp;quot;;&lt;br /&gt;
            phoneRes.Facets.Add(phoneFacet1);&lt;br /&gt;
            phonetype.Content = phoneRes;&lt;br /&gt;
            XmlSchemaSimpleType notestype = new XmlSchemaSimpleType();&lt;br /&gt;
            XmlSchemaSimpleTypeRestriction notesRes = new XmlSchemaSimpleTypeRestriction();&lt;br /&gt;
            notesRes.BaseTypeName = new XmlQualifiedName(&amp;quot;string&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;);&lt;br /&gt;
            XmlSchemaMaxLengthFacet notesFacet1 = new XmlSchemaMaxLengthFacet();&lt;br /&gt;
            notesFacet1.Value = &amp;quot;500&amp;quot;;&lt;br /&gt;
            notesRes.Facets.Add(notesFacet1);&lt;br /&gt;
            notestype.Content = notesRes;&lt;br /&gt;
            XmlSchemaComplexType employeetype = new XmlSchemaComplexType();&lt;br /&gt;
            XmlSchemaSequence sequence = new XmlSchemaSequence();&lt;br /&gt;
            XmlSchemaElement firstname = new XmlSchemaElement();&lt;br /&gt;
            firstname.Name = &amp;quot;firstname&amp;quot;;&lt;br /&gt;
            firstname.SchemaType = nametype;&lt;br /&gt;
            XmlSchemaElement homephone = new XmlSchemaElement();&lt;br /&gt;
            homephone.Name = &amp;quot;homephone&amp;quot;;&lt;br /&gt;
            homephone.SchemaType = phonetype;&lt;br /&gt;
            XmlSchemaElement notes = new XmlSchemaElement();&lt;br /&gt;
            notes.Name = &amp;quot;notes&amp;quot;;&lt;br /&gt;
            notes.SchemaType = notestype;&lt;br /&gt;
            sequence.Items.Add(firstname);&lt;br /&gt;
            sequence.Items.Add(homephone);&lt;br /&gt;
            sequence.Items.Add(notes);&lt;br /&gt;
            employeetype.Particle = sequence;&lt;br /&gt;
            XmlSchemaAttribute employeeid = new XmlSchemaAttribute();&lt;br /&gt;
            employeeid.Name = &amp;quot;employeeid&amp;quot;;&lt;br /&gt;
            employeeid.SchemaTypeName = new XmlQualifiedName(&amp;quot;int&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;);&lt;br /&gt;
            employeeid.Use = XmlSchemaUse.Required;&lt;br /&gt;
            employeetype.Attributes.Add(employeeid);&lt;br /&gt;
            XmlSchemaComplexType complextype = new XmlSchemaComplexType();&lt;br /&gt;
            XmlSchemaSequence sq = new XmlSchemaSequence();&lt;br /&gt;
            XmlSchemaElement employee = new XmlSchemaElement();&lt;br /&gt;
            employee.Name = &amp;quot;employee&amp;quot;;&lt;br /&gt;
            employee.SchemaType = employeetype;&lt;br /&gt;
            employee.MinOccurs = 0;&lt;br /&gt;
            employee.MaxOccursString = &amp;quot;unbounded&amp;quot;;&lt;br /&gt;
            sq.Items.Add(employee);&lt;br /&gt;
            complextype.Particle = sq;&lt;br /&gt;
            XmlSchemaElement employees = new XmlSchemaElement();&lt;br /&gt;
            employees.Name = &amp;quot;employees&amp;quot;;&lt;br /&gt;
            employees.SchemaType = complextype;&lt;br /&gt;
            schema.Items.Add(employees);&lt;br /&gt;
            XmlSchemaSet set = new XmlSchemaSet();&lt;br /&gt;
            set.Add(schema);&lt;br /&gt;
            set.rupile();&lt;br /&gt;
            XmlTextWriter writer=new XmlTextWriter(&amp;quot;yourvalue&amp;quot;,null);&lt;br /&gt;
            schema.Write(writer);&lt;br /&gt;
            writer.Close();&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Register Schema validation event==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using System.Xml.Schema;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
&lt;br /&gt;
    class Program&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            XmlDocument items = new XmlDocument();&lt;br /&gt;
            items.Load(&amp;quot;items.xml&amp;quot;);&lt;br /&gt;
            XmlSchema schema = XmlSchema.Read(new FileStream(&amp;quot;items.xsd&amp;quot;,FileMode.Open), new ValidationEventHandler(OnSchemaValidate));&lt;br /&gt;
            items.Schemas.Add(schema);&lt;br /&gt;
            items.Validate(new ValidationEventHandler(OnValidate));&lt;br /&gt;
            &lt;br /&gt;
        }&lt;br /&gt;
        static void OnValidate(object sender, ValidationEventArgs vargs)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(vargs.Message);&lt;br /&gt;
        }&lt;br /&gt;
        static void OnSchemaValidate(object sender, ValidationEventArgs vargs)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(vargs.Message);&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Schema Validation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using System.Xml.Schema;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
&lt;br /&gt;
    class Program&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            XmlDocument items = new XmlDocument();&lt;br /&gt;
            items.Load(&amp;quot;items.xml&amp;quot;);&lt;br /&gt;
            XmlSchema schema = XmlSchema.Read(new FileStream(&amp;quot;items.xsd&amp;quot;,FileMode.Open), new ValidationEventHandler(OnSchemaValidate));&lt;br /&gt;
            items.Schemas.Add(schema);&lt;br /&gt;
            items.Validate(new ValidationEventHandler(OnValidate));&lt;br /&gt;
            &lt;br /&gt;
        }&lt;br /&gt;
        static void OnValidate(object sender, ValidationEventArgs vargs)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(vargs.Message);&lt;br /&gt;
        }&lt;br /&gt;
        static void OnSchemaValidate(object sender, ValidationEventArgs vargs)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(vargs.Message);&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>