Main Content

matlab.io.xml.transform.SourceFile class

Package:matlab.io.xml.transform

XML source file for transformation

Description

Use an object of thematlab.io.xml.transform.SourceFileclass to specify a file as the source XML markup for a transformation. You can provide aSourceFileobject as an input to thetransformortransformToStringmethod of amatlab.io.xml.transform.Transformerobject.

Thematlab.io.xml.transform.SourceFileclass is ahandleclass.

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, seeClass Attributes.

Creation

Description

example

sourceObj = matlab.io.xml.transform.SourceFile(path)creates amatlab.io.xml.transform.SourceFileobject with thePathproperty set to the specified path.

Properties

expand all

Path of XML file, specified as a string scalar or character vector.

Attributes:

GetAccess
public
SetAccess
public
GetObservable
true
SetObservable
true

Examples

collapse all

This example transforms the XML markup for countries and their capital cities into an HTML table. The example specifies the input XML as amatlab.io.xml.transform.SourceFileobject.

The example uses these files:

  • capitals.xml

CanadaOttawaFranceParisPeruLima
  • capitals.xsl

      
Country Capital

创建一个SourceFileobject,sourceObj, that contains the XML source for the transformation.

importmatlab.io.xml.transform.*sourceObj = SourceFile("capitals.xml");

Perform the transformation and provide sourceObj as the XML source,capitals.xslas the stylesheet, andcapitals.htmlas the name of the output file.

sourceObj变换(变压器,"capitals.xsl","capitals.html");

Opencapitals.htmlin a Web browser.

web("capitals.html")

Here is the HTML table:

Version History

Introduced in R2021a