Lire en anglais

Partager via


DataSet.WriteXmlSchema Méthode

Définition

Écrit la structure DataSet sous la forme d'un schéma XML.

Surcharges

WriteXmlSchema(String, Converter<Type,String>)

Écrit la structure DataSet sous la forme d'un schéma XML dans un fichier.

WriteXmlSchema(Stream)

Écrit la structure DataSet en tant que schéma XML dans l’objet Stream spécifié.

WriteXmlSchema(TextWriter)

Écrit la structure DataSet en tant que schéma XML dans l’objet TextWriter spécifié.

WriteXmlSchema(String)

Écrit la structure DataSet sous la forme d'un schéma XML dans un fichier.

WriteXmlSchema(XmlWriter)

Écrit la structure DataSet sous la forme d'un schéma XML dans un objet XmlWriter.

WriteXmlSchema(Stream, Converter<Type,String>)

Écrit la structure DataSet en tant que schéma XML dans l’objet Stream spécifié.

WriteXmlSchema(TextWriter, Converter<Type,String>)

Écrit la structure de DataSet sous la forme d'un schéma XML dans le TextWriter spécifié.

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Écrit la structure de DataSet sous la forme d'un schéma XML dans le XmlWriter spécifié.

WriteXmlSchema(String, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure DataSet sous la forme d'un schéma XML dans un fichier.

C#
public void WriteXmlSchema (string fileName, Converter<Type,string> multipleTargetConverter);

Paramètres

fileName
String

Nom du fichier dans lequel écrire.

multipleTargetConverter
Converter<Type,String>

Délégué servant à convertir Type en une chaîne.

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(Stream)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure DataSet en tant que schéma XML dans l’objet Stream spécifié.

C#
public void WriteXmlSchema (System.IO.Stream? stream);
C#
public void WriteXmlSchema (System.IO.Stream stream);

Paramètres

stream
Stream

Objet Stream utilisé pour écrire dans un fichier.

Exemples

L’exemple suivant crée un FileStream objet qui est passé à la WriteXmlSchema méthode pour écrire le schéma sur le disque.

C#
private void WriteSchemaWithFileStream(DataSet thisDataSet)
{
    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Create the FileStream object with the file name.
    // Use FileMode.Create.
    System.IO.FileStream stream =
        new System.IO.FileStream(filename,System.IO.FileMode.Create);

    // Write the schema to the file.
    thisDataSet.WriteXmlSchema(stream);

    // Close the FileStream.
    stream.Close();
}

Remarques

Utilisez la WriteXmlSchema méthode pour écrire le schéma d’un DataSet dans un document XML. Le schéma comprend des définitions de table, de relation et de contrainte. Pour écrire un schéma dans un document XML, utilisez la WriteXmlSchema méthode .

Le schéma XML est écrit à l’aide de la norme XSD.

Pour écrire les données dans un document XML, utilisez la WriteXml méthode .

Les classes qui dérivent de la Stream classe incluent BufferedStream, FileStream, MemoryStreamet NetworkStream.

Voir aussi

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(TextWriter)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure DataSet en tant que schéma XML dans l’objet TextWriter spécifié.

C#
public void WriteXmlSchema (System.IO.TextWriter? writer);
C#
public void WriteXmlSchema (System.IO.TextWriter writer);

Paramètres

writer
TextWriter

ObjetTextWriter avec lequel écrire.

Exemples

L’exemple suivant crée un System.Text.StringBuilder objet vers qui est utilisé pour créer un nouveau System.IO.StringWriter. le StringWriter est passé à la WriteXmlSchema méthode et la chaîne résultante est imprimée dans la fenêtre de console.

C#
private void WriteSchemaWithStringWriter(DataSet thisDataSet)
{
    // Create a new StringBuilder object.
    System.Text.StringBuilder builder = new System.Text.StringBuilder();

    // Create the StringWriter object with the StringBuilder object.
    System.IO.StringWriter writer = new System.IO.StringWriter(builder);

    // Write the schema into the StringWriter.
    thisDataSet.WriteXmlSchema(writer);

    // Print the string to the console window.
    Console.WriteLine(writer.ToString());
}

Remarques

Utilisez la WriteXmlSchema méthode pour écrire le schéma d’un DataSet dans un document XML. Le schéma comprend des définitions de table, de relation et de contrainte. Pour écrire un schéma dans un document XML, utilisez la WriteXmlSchema méthode .

Le schéma XML est écrit à l’aide de la norme XSD.

Pour écrire les données dans un document XML, utilisez la WriteXml méthode .

Les classes dérivées de la System.IO.TextWriter classe incluent , System.CodeDom.Compiler.IndentedTextWriterSystem.Web.HttpWriter, System.Web.UI.HtmlTextWriter, System.IO.StreamWriteret System.IO.StringWriter.

Voir aussi

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(String)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure DataSet sous la forme d'un schéma XML dans un fichier.

C#
public void WriteXmlSchema (string fileName);

Paramètres

fileName
String

Nom du fichier (chemin d'accès inclus) dans lequel effectuer l'écriture.

Exceptions

Exemples

C#
private void WriteSchemaToFile(DataSet thisDataSet)
{
    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Write the schema to the file.
    thisDataSet.WriteXmlSchema(filename);
}

Remarques

Utilisez la WriteXmlSchema méthode pour écrire le schéma d’un DataSet dans un document XML. Le schéma comprend des définitions de table, de relation et de contrainte. Pour écrire un schéma dans un document XML, utilisez la WriteXmlSchema méthode .

Le schéma XML est écrit à l’aide de la norme XSD.

Pour écrire les données dans un document XML, utilisez la WriteXml méthode .

Voir aussi

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(XmlWriter)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure DataSet sous la forme d'un schéma XML dans un objet XmlWriter.

C#
public void WriteXmlSchema (System.Xml.XmlWriter? writer);
C#
public void WriteXmlSchema (System.Xml.XmlWriter writer);

Paramètres

writer
XmlWriter

XmlWriter dans lequel écrire.

Exemples

L’exemple suivant crée un System.IO.FileStream objet avec le chemin spécifié. L’objet FileStream est utilisé pour créer un XmlTextWriter objet . La WriteXmlSchema méthode est ensuite appelée avec l’objet XmlTextWriter pour écrire le schéma sur le disque.

C#
private void WriteSchemaWithXmlTextWriter(DataSet thisDataSet)
{
    // Set the file path and name. Modify this for your purposes.
    string filename="SchemaDoc.xml";

    // Create a FileStream object with the file path and name.
    System.IO.FileStream stream = new System.IO.FileStream
        (filename,System.IO.FileMode.Create);

    // Create a new XmlTextWriter object with the FileStream.
    System.Xml.XmlTextWriter writer =
        new System.Xml.XmlTextWriter(stream,
        System.Text.Encoding.Unicode);

    // Write the schema into the DataSet and close the reader.
    thisDataSet.WriteXmlSchema(writer );
    writer.Close();
}

Remarques

Utilisez la WriteXmlSchema méthode pour écrire le schéma d’un DataSet dans un document XML. Le schéma comprend des définitions de table, de relation et de contrainte. Pour écrire un schéma dans un document XML, utilisez la WriteXmlSchema méthode .

Le schéma XML est écrit à l’aide de la norme XSD.

Pour écrire les données dans un document XML, utilisez la WriteXml méthode .

Une classe qui hérite de la System.Xml.XmlWriter classe est la XmlTextWriter classe .

Voir aussi

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(Stream, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure DataSet en tant que schéma XML dans l’objet Stream spécifié.

C#
public void WriteXmlSchema (System.IO.Stream? stream, Converter<Type,string> multipleTargetConverter);
C#
public void WriteXmlSchema (System.IO.Stream stream, Converter<Type,string> multipleTargetConverter);

Paramètres

stream
Stream

Objet Stream dans lequel écrire.

multipleTargetConverter
Converter<Type,String>

Délégué servant à convertir Type en une chaîne.

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(TextWriter, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure de DataSet sous la forme d'un schéma XML dans le TextWriter spécifié.

C#
public void WriteXmlSchema (System.IO.TextWriter? writer, Converter<Type,string> multipleTargetConverter);
C#
public void WriteXmlSchema (System.IO.TextWriter writer, Converter<Type,string> multipleTargetConverter);

Paramètres

writer
TextWriter

Objet TextWriter dans lequel écrire.

multipleTargetConverter
Converter<Type,String>

Délégué servant à convertir Type en une chaîne.

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Écrit la structure de DataSet sous la forme d'un schéma XML dans le XmlWriter spécifié.

C#
public void WriteXmlSchema (System.Xml.XmlWriter? writer, Converter<Type,string> multipleTargetConverter);
C#
public void WriteXmlSchema (System.Xml.XmlWriter writer, Converter<Type,string> multipleTargetConverter);

Paramètres

writer
XmlWriter

Objet XmlWriter dans lequel écrire.

multipleTargetConverter
Converter<Type,String>

Délégué servant à convertir Type en une chaîne.

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1