DataSet.ReadXmlSchema Método

Definición

Lee un esquema XML en .DataSet

Sobrecargas

Nombre Description
ReadXmlSchema(Stream)

Lee el esquema XML del especificado Stream en .DataSet

ReadXmlSchema(TextReader)

Lee el esquema XML del especificado TextReader en .DataSet

ReadXmlSchema(String)

Lee el esquema XML del archivo especificado en .DataSet

ReadXmlSchema(XmlReader)

Lee el esquema XML del especificado XmlReader en .DataSet

ReadXmlSchema(Stream)

Lee el esquema XML del especificado Stream en .DataSet

public:
 void ReadXmlSchema(System::IO::Stream ^ stream);
public void ReadXmlSchema(System.IO.Stream stream);
member this.ReadXmlSchema : System.IO.Stream -> unit
Public Sub ReadXmlSchema (stream As Stream)

Parámetros

stream
Stream

desde el Stream que se va a leer.

Ejemplos

En el ejemplo siguiente se crea un FileStream objeto con el que se lee un esquema XML y se invoca el ReadXmlSchema método con el objeto .

private void ReadSchemaFromFileStream(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,
    // and set to open the file.
    System.IO.FileStream stream =
        new System.IO.FileStream(filename,System.IO.FileMode.Open);

    // Read the schema into the DataSet.
    thisDataSet.ReadXmlSchema(stream);

    // Close the FileStream.
    stream.Close();
}
Private Sub ReadSchemaFromFileStream(thisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Create the FileStream object with the file name, 
    ' and set to open the file
    Dim stream As New System.IO.FileStream _
        (filename, System.IO.FileMode.Open)

    ' Read the schema into the DataSet.
    thisDataSet.ReadXmlSchema(stream)

    ' Close the FileStream.
    stream.Close()
End Sub

Comentarios

Use el ReadXmlSchema método para crear el esquema para .DataSet El esquema incluye definiciones de tabla, relación y restricción. Para escribir un esquema en un documento XML, use el WriteXmlSchema método .

El esquema XML se escribe mediante el estándar XSD.

Note

Los datos dañados pueden producirse si los tipos msdata:DataType y xs:type no coinciden. No se producirá ninguna excepción.

Por ReadXmlSchema lo general, se invoca el método antes de invocar el ReadXml método que se usa para rellenar .DataSet

Las clases que derivan de la Stream clase incluyen BufferedStream, FileStream, MemoryStreamy NetworkStream.

Note

Si el esquema de contiene DataSet elementos del mismo nombre, pero de un tipo diferente, en el mismo espacio de nombres, se produce una excepción cuando se intenta leer el esquema en DataSet con ReadXmlSchema. Esta excepción no se produce si usa .NET Framework versión 1.0.

Consulte también

Se aplica a

ReadXmlSchema(TextReader)

Lee el esquema XML del especificado TextReader en .DataSet

public:
 void ReadXmlSchema(System::IO::TextReader ^ reader);
public void ReadXmlSchema(System.IO.TextReader reader);
member this.ReadXmlSchema : System.IO.TextReader -> unit
Public Sub ReadXmlSchema (reader As TextReader)

Parámetros

reader
TextReader

desde el TextReader que se va a leer.

Ejemplos

En el ejemplo siguiente se crea un StreamReader objeto con el que se lee un esquema y se invoca el ReadXmlSchema método con el objeto .

private void ReadSchemaFromStreamReader()
{
    // Create the DataSet to read the schema into.
    DataSet thisDataSet = new DataSet();

    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Create a StreamReader object with the file path and name.
    System.IO.StreamReader readStream =
        new System.IO.StreamReader(filename);

    // Invoke the ReadXmlSchema method with the StreamReader object.
    thisDataSet.ReadXmlSchema(readStream);

    // Close the StreamReader
    readStream.Close();
}
Private Sub ReadSchemaFromStreamReader()
    ' Create the DataSet to read the schema into.
    Dim thisDataSet As New DataSet()

    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Create a StreamReader object with the file path and name.
    Dim readStream As New System.IO.StreamReader(filename)

    ' Invoke the ReadXmlSchema method with the StreamReader object.
    thisDataSet.ReadXmlSchema(readStream)

    ' Close the StreamReader
    readStream.Close()
End Sub

Comentarios

Use el ReadXmlSchema método para crear el esquema para .DataSet El esquema incluye definiciones de tabla, relación y restricción. Para escribir un esquema en un documento XML, use el WriteXmlSchema método .

El esquema XML se escribe mediante el estándar XSD.

Note

Los datos dañados pueden producirse si los tipos msdata:DataType y xs:type no coinciden. No se producirá ninguna excepción.

Por ReadXmlSchema lo general, se invoca el método antes de invocar el ReadXml método que se usa para rellenar .DataSet

Las clases que heredan de la TextReader clase incluyen las StreamReader clases y StringReader .

Note

Si el esquema de contiene DataSet elementos del mismo nombre, pero de un tipo diferente, en el mismo espacio de nombres, se produce una excepción cuando se intenta leer el esquema en DataSet con ReadXmlSchema. Esta excepción no se produce si usa .NET Framework versión 1.0.

Consulte también

Se aplica a

ReadXmlSchema(String)

Lee el esquema XML del archivo especificado en .DataSet

public:
 void ReadXmlSchema(System::String ^ fileName);
public void ReadXmlSchema(string fileName);
member this.ReadXmlSchema : string -> unit
Public Sub ReadXmlSchema (fileName As String)

Parámetros

fileName
String

Nombre de archivo (incluida la ruta de acceso) desde la que se va a leer.

Excepciones

FileIOPermission no está establecido en Read.

Ejemplos

private void ReadSchemaFromFile(){
   // Create the DataSet to read the schema into.
   DataSet thisDataSet = new DataSet();

   // Set the file path and name. Modify this for your purposes.
   string filename="Schema.xml";

   // Invoke the ReadXmlSchema method with the file name.
   thisDataSet.ReadXmlSchema(filename);
}
Private Sub ReadSchemaFromFile()
    ' Create the DataSet to read the schema into.
    Dim thisDataSet As New DataSet()

    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Invoke the ReadXmlSchema method with the file name.
    thisDataSet.ReadXmlSchema(filename)
End Sub

Comentarios

Use el ReadXmlSchema método para crear el esquema para .DataSet El esquema incluye definiciones de tabla, relación y restricción. Para escribir un esquema en un documento XML, use el WriteXmlSchema método .

El esquema XML se escribe mediante el estándar XSD.

Note

Los datos dañados pueden producirse si los tipos msdata:DataType y xs:type no coinciden. No se producirá ninguna excepción.

Por ReadXmlSchema lo general, se invoca el método antes de invocar el ReadXml método que se usa para rellenar .DataSet

Note

Si el esquema de contiene DataSet elementos del mismo nombre, pero de un tipo diferente, en el mismo espacio de nombres, se produce una excepción cuando se intenta leer el esquema en DataSet con ReadXmlSchema. Esta excepción no se produce si usa .NET Framework versión 1.0.

Consulte también

Se aplica a

ReadXmlSchema(XmlReader)

Lee el esquema XML del especificado XmlReader en .DataSet

public:
 void ReadXmlSchema(System::Xml::XmlReader ^ reader);
public void ReadXmlSchema(System.Xml.XmlReader reader);
member this.ReadXmlSchema : System.Xml.XmlReader -> unit
Public Sub ReadXmlSchema (reader As XmlReader)

Parámetros

reader
XmlReader

desde el XmlReader que se va a leer.

Ejemplos

En el ejemplo siguiente se crea un nuevo DataSet objeto y System.IO.FileStream . El FileStream objeto, creado con una ruta de acceso de archivo y un nombre de archivo, se usa para crear un System.Xml.XmlTextReader objeto que se pasa como argumento al ReadXmlSchema método .

private void ReadSchemaFromXmlTextReader()
{
    // Create the DataSet to read the schema into.
    DataSet thisDataSet = new DataSet();

    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

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

    // Create a new XmlTextReader object with the FileStream.
    System.Xml.XmlTextReader xmlReader=
        new System.Xml.XmlTextReader(stream);

    // Read the schema into the DataSet and close the reader.
    thisDataSet.ReadXmlSchema(xmlReader);
    xmlReader.Close();
}
Private Sub ReadSchemaFromXmlTextReader()
    ' Create the DataSet to read the schema into.
    Dim thisDataSet As New DataSet()

    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Create a FileStream object with the file path and name.
    Dim stream As New System.IO.FileStream _
       (filename, System.IO.FileMode.Open)

    ' Create a new XmlTextReader object with the FileStream.
    Dim xmlReader As New System.Xml.XmlTextReader(stream)

    ' Read the schema into the DataSet and close the reader.
    thisDataSet.ReadXmlSchema(xmlReader)
    xmlReader.Close()
End Sub

Comentarios

Use el ReadXmlSchema método para crear el esquema para .DataSet El esquema incluye definiciones de tabla, relación y restricción.

El esquema XML se escribe mediante el estándar XSD.

Note

Los datos dañados pueden producirse si los tipos msdata:DataType y xs:type no coinciden. No se producirá ninguna excepción.

Por ReadXmlSchema lo general, se invoca el método antes de invocar el ReadXml método que se usa para rellenar .DataSet

La System.Xml.XmlReader clase es abstracta. Una clase que hereda de es XmlReader la System.Xml.XmlTextReader clase .

Note

Si el esquema de contiene DataSet elementos del mismo nombre, pero de un tipo diferente, en el mismo espacio de nombres, se produce una excepción cuando se intenta leer el esquema en DataSet con ReadXmlSchema. Esta excepción no se produce si usa .NET Framework versión 1.0.

Consulte también

Se aplica a