http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Xml.Schema/XmlSchema&feed=atom&action=history
Csharp/C Sharp by API/System.Xml.Schema/XmlSchema - История изменений
2024-03-29T00:13:56Z
История изменений этой страницы в вики
MediaWiki 1.30.0
http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Xml.Schema/XmlSchema&diff=4036&oldid=prev
в 15:31, 26 мая 2010
2010-05-26T15:31:35Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<tr style="vertical-align: top;" lang="ru">
<td colspan="1" style="background-color: white; color:black; text-align: center;">← Предыдущая</td>
<td colspan="1" style="background-color: white; color:black; text-align: center;">Версия 15:31, 26 мая 2010</td>
</tr><tr><td colspan="2" style="text-align: center;" lang="ru"><div class="mw-diff-empty">(нет различий)</div>
</td></tr></table>
http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Xml.Schema/XmlSchema&diff=4037&oldid=prev
Admin: 1 версия
2010-05-26T12:08:54Z
<p>1 версия</p>
<p><b>Новая страница</b></p><div>==XmlSchema.Compile==<br />
<br />
<br />
<br />
<source lang="csharp"> <br />
using System;<br />
using System.IO;<br />
using System.Xml.Schema;<br />
public class ValidateSchema {<br />
public static void Main(string [] args) {<br />
ValidationEventHandler handler = new ValidationEventHandler(ValidateSchema.Handler);<br />
XmlSchema schema = XmlSchema.Read(File.OpenRead(args[0]),handler);<br />
schema.rupile(handler);<br />
}<br />
public static void Handler(object sender, ValidationEventArgs e) {<br />
Console.WriteLine(e.Message);<br />
}<br />
}<br />
<br />
<br />
</source><br />
<br />
<br />
==XmlSchema.Write==<br />
<br />
<br />
<br />
<source lang="csharp"> <br />
using System;<br />
using System.Linq;<br />
using System.Collections;<br />
using System.Collections.Generic;<br />
using System.Xml;<br />
using System.Xml.Schema;<br />
using System.Xml.Linq;<br />
public class MainClass {<br />
public static void Main() {<br />
XDocument xDocument = new XDocument(<br />
new XElement("Books",<br />
new XElement("Book",<br />
new XAttribute("type", "Author"),<br />
new XElement("FirstName", "A"),<br />
new XElement("LastName", "B")),<br />
new XElement("Book",<br />
new XAttribute("type", "Author"),<br />
new XElement("FirstName", "C"),<br />
new XElement("LastName", "D"))));<br />
Console.WriteLine(xDocument);<br />
xDocument.Save("bookparticipants.xml");<br />
XmlSchemaInference infer = new XmlSchemaInference();<br />
XmlSchemaSet schemaSet = infer.InferSchema(new XmlTextReader("bookparticipants.xml"));<br />
XmlWriter w = XmlWriter.Create("bookparticipants.xsd");<br />
foreach (XmlSchema schema in schemaSet.Schemas()) {<br />
schema.Write(w);<br />
}<br />
w.Close();<br />
XDocument newDocument = XDocument.Load("bookparticipants.xsd");<br />
Console.WriteLine(newDocument);<br />
}<br />
}<br />
<br />
<br />
</source></div>
Admin