XmlDataSource Class

Provides access to data of an XML file or stream to be used within a report.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.Words.ReportingXmlDataSource

Namespace:  Aspose.Words.Reporting
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.10.0

ExpandedSyntax

public class XmlDataSource

The XmlDataSource type exposes the following members.

ExpandedConstructors

  NameDescription
Public methodXmlDataSource(Stream)
Creates a new data source with data from an XML stream using default options for XML data loading.
Public methodXmlDataSource(String)
Creates a new data source with data from an XML file using default options for XML data loading.
Public methodXmlDataSource(Stream, XmlDataLoadOptions)
Creates a new data source with data from an XML stream using the specified options for XML data loading.
Public methodXmlDataSource(Stream, Stream)
Creates a new data source with data from an XML stream using an XML Schema Definition stream. Default options are used for XML data loading.
Public methodXmlDataSource(String, XmlDataLoadOptions)
Creates a new data source with data from an XML file using the specified options for XML data loading.
Public methodXmlDataSource(String, String)
Creates a new data source with data from an XML file using an XML Schema Definition file. Default options are used for XML data loading.
Public methodXmlDataSource(Stream, Stream, XmlDataLoadOptions)
Creates a new data source with data from an XML stream using an XML Schema Definition stream. The specified options are used for XML data loading.
Public methodXmlDataSource(String, String, XmlDataLoadOptions)
Creates a new data source with data from an XML file using an XML Schema Definition file. The specified options are used for XML data loading.

ExpandedMethods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedRemarks

To access data of the corresponding file or stream while generating a report, pass an instance of this class as a data source to one of ReportingEngine.BuildReport overloads.

In template documents, if a top-level XML element contains only a list of elements of the same type, an XmlDataSource instance should be treated in the same way as if it was a DataTable instance. Otherwise, an XmlDataSource instance should be treated in the same way as if it was a DataRow instance. For more information, see template syntax reference (https://docs.aspose.com/display/wordsnet/Template+Syntax).

When XML Schema Definition is passed to a constructor of this class, data types of values of simple XML elements and attributes are determined according to the schema. So in template documents, you can work with typed values rather than just strings.

When XML Schema Definition is not passed to a constructor of this class, data types of values of simple XML elements and attributes are determined automatically upon their string representations. So in template documents, you can work with typed values in this case as well. The engine is capable to automatically recognize values of the following types:

Note that for automatic recognition of data types to work, string representations of values of simple XML elements and attributes should be formed using invariant culture settings.

To override default behavior of XML data loading, initialize and pass a XmlDataLoadOptions instance to a constructor of this class.

ExpandedSee Also