YAML - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Web Features : MathML : YAML Package : YAML/ParseFile

YAML

  

ParseFile

  

read YAML data from a file

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ParseFile(source, opts)

Parameters

source

-

string; file or URL to read from

opts

-

(optional) options as specified below

Options

• 

output=name

either table, record, or DataSeries. Specifies the data structure to use for parsed data corresponding to YAML objects (collections of key/value pairs). With output=table (the default), an object is encoded as table; with output=record, it is encoded as a record; with output=DataSeries, it is encoded as a DataSeries.

Description

• 

The ParseFile(source) command reads YAML data from the file or URL source.

  

If source is a file, it is closed after it is read.

Examples

Parse an input YAML file to a Maple table

addressFileTools:-JoinPathexample/address.yaml,base=datadir:

YAML:-ParseFileaddress

tablephoneNumbers=tablenumber=+1 (519) 747-2373,type=local,tablenumber=+1 (800) 267-6583,type=toll-free,tablenumber=+1 (519) 747-5284,type=fax,companyName=Maplesoft,address=tablecity=Waterloo,postalCode=N2V 1K8,country=Canada,streetAddress=615 Kumpf Drive,province=ON,founded=1988

(1)

Parse the same input YAML file to a Maple record

YAML:-ParseFileaddress,output=record

RecordpackedphoneNumbers=Recordpacked...,Recordpacked...,Recordpacked...,companyName=Maplesoft,address=Recordpacked...,founded=1988

(2)

Compatibility

• 

The YAML[ParseFile] command was introduced in Maple 2017.

• 

For more information on Maple 2017 changes, see Updates in Maple 2017.

See Also

YAML

YAML[ParseString]

YAML[ToString]