Class ReportXmlSerializer
Serializes and deserializes objects into and from XML.
This class is dedicated for serializing and deserializing objects
only from the Telerik.
Inheritance
Namespace: Telerik.Reporting.XmlSerialization
Assembly: Telerik.Reporting.dll
Syntax
public class ReportXmlSerializer : IXmlSerializer
Constructors
ReportXmlSerializer()
Initializes a new instance of the Report
Declaration
public ReportXmlSerializer()
Methods
Deserialize(Stream)
Deserializes the XML document contained by the specified System.
Declaration
public object Deserialize(Stream stream)
Parameters
System. The System. |
Returns
System. The Telerik. |
Remarks
Use the stream parameter to specify an object that derives from the System.
Examples
The following example deserializes an object using a System.
using (System.IO.FileStream fileStream = new System.IO.FileStream("Report1.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
Telerik.Reporting.Report report = (Telerik.Reporting.Report)
xmlSerializer.Deserialize(fileStream);
}
Using fileStream As New System.IO.FileStream("Report1.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(fileStream), Telerik.Reporting.Report)
End Using
Deserialize(TextReader)
Deserializes the XML document contained by the specified System.
Declaration
public object Deserialize(TextReader reader)
Parameters
System. The System. |
Returns
System. The Telerik. |
Remarks
Classes that inherit from System.
Examples
The following example deserializes an object using a System.
using (System.IO.FileStream fileStream = new System.IO.FileStream("Report1.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
using (System.IO.TextReader textReader = new System.IO.StreamReader(fileStream))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
Telerik.Reporting.Report report = (Telerik.Reporting.Report)
xmlSerializer.Deserialize(textReader);
}
Using fileStream As New System.IO.FileStream("Report1.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read)
Using textReader As System.IO.TextReader = New System.IO.StreamReader(fileStream)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(textReader), Telerik.Reporting.Report)
End Using
End Using
Deserialize(String)
Deserializes the XML document from the specified URI.
Declaration
public object Deserialize(string inputUri)
Parameters
System. The URI for the file containing the XML data. |
Returns
System. The Telerik. |
Examples
The following example deserializes an object using a URI:
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
Telerik.Reporting.Report report = (Telerik.Reporting.Report)
xmlSerializer.Deserialize("Report1.xml");
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize("Report1.xml"), Telerik.Reporting.Report)
Deserialize(XmlReader)
Deserializes the XML document contained by the specified System.
Declaration
public object Deserialize(XmlReader reader)
Parameters
System. The System. |
Returns
System. The Telerik. |
Examples
The following example deserializes an object using a System.
System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
settings.IgnoreWhitespace = true;
using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create("Report1.xml", settings))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
Telerik.Reporting.Report report = (Telerik.Reporting.Report)
xmlSerializer.Deserialize(xmlReader);
}
Dim settings As New XmlReaderSettings()
settings.IgnoreWhitespace = True
Using xmlReader As System.Xml.XmlReader = System.Xml.XmlReader.Create("Report1.xml", settings)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
End Using
Serialize(Stream, Object)
Serializes the specified value and writes the XML document to the specified System.
Declaration
public void Serialize(Stream stream, object value)
Parameters
System. The System. |
System. The value to serialize. |
Remarks
Use the stream parameter to specify an object that derives from the abstract
System.
Examples
The following examples serializes an object using a System.
using (System.IO.Stream stream = new System.IO.FileStream("Report.xml", System.IO.FileMode.Create))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
xmlSerializer.Serialize(stream, report);
}
Using stream As System.IO.Stream = New System.IO.FileStream("Report.xml", System.IO.FileMode.Create)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
xmlSerializer.Serialize(stream, report)
End Using
Serialize(TextWriter, Object)
Serializes the specified value and writes the XML document to the specified System.
Declaration
public void Serialize(TextWriter writer, object value)
Parameters
System. The System. |
System. The value to serialize. |
Remarks
In the textWriter parameter, specify an object that derives from the abstract System.
Examples
The following examples serializes an object using a System.
using (System.IO.FileStream fs = new System.IO.FileStream("Report.xml", FileMode.Create))
using (System.IO.TextWriter writer = new System.IO.StreamWriter(fs, System.Text.Encoding.UTF8))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
xmlSerializer.Serialize(writer, report);
}
Using fs As New System.IO.FileStream("Report.xml", System.IO.FileMode.Create)
Using writer As System.IO.TextWriter = New System.IO.StreamWriter(fs, System.Text.Encoding.UTF8)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
xmlSerializer.Serialize(writer, report)
End Using
End Using
Serialize(String, Object)
Serializes the specified value and writes the XML document to a file with the specified file name.
Declaration
public void Serialize(string fileName, object value)
Parameters
System. The file which you want to write to. The Report |
System. The value to serialize. |
Examples
The following example serializes an object using a file path:
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
xmlSerializer.Serialize("Report.xml", report);
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
xmlSerializer.Serialize("Report.xml", report)
Serialize(XmlWriter, Object)
Serializes the specified value and writes the XML document to the specified System.
Declaration
public void Serialize(XmlWriter writer, object value)
Parameters
System. The System. |
System. The value to serialize. |
Remarks
In the xmlWriter parameter, specify an object that derives from the abstract
System.
Examples
The following example serializes an object using a System.
using (System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create("SerializedReport.xml"))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
xmlSerializer.Serialize(xmlWriter, report);
}
Using xmlWriter As System.Xml.XmlWriter = System.Xml.XmlWriter.Create("SerializedReport.xml")
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
xmlSerializer.Serialize(xmlWriter, report)
End Using