Using an XML Document as the Source for a Provider

From RAD Studio
Jump to: navigation, search

Go Up to Using XML in Database Applications Index


The TXMLTransformProvider component lets you use an XML document as if it were a database table. TXMLTransformProvider packages the data from an XML document and applies updates from clients back to that XML document. It appears to clients such as client datasets or XML brokers like any other provider component. For information on provider components, see Using Provider Components. For more information on using provider components with client datasets, see Using a Client Dataset with a Provider.

You can specify the XML document from which the XML provider provides data and to which it applies updates using the XMLDataFile property.

TXMLTransformProvider components use internal TXMLTransform components to translate between data packets and the source XML document: one to translate the XML document into data packets, and one to translate data packets back into the XML format of the source document after applying updates. These two TXMLTransform components can be accessed using the TransformRead and TransformWrite properties, respectively.

When using TXMLTransformProvider, you must specify the transformations that these two TXMLTransform components use to translate between data packets and the source XML document. You do this by setting the TXMLTransform component's TransformationFile or TransformationDocument property, just as when using a stand-alone TXMLTransform component.

In addition, if the transformation includes any user-defined nodes, you must supply an Xml.XmlTransform.TXMLTransform.OnTranslate event handler to the internal TXMLTransform components.

You do not need to specify the source document on the TXMLTransform components that are the values of TransformRead and TransformWrite. For TransformRead, the source is the file specified by the provider's XMLDataFile property (although, if you set XMLDataFile to an empty string, you can supply the source document using TransformRead.XmlSource or TransformRead.XmlSourceDocument). For TransformWrite, the source is generated internally by the provider when it applies updates.

See Also