YAML
ParseFile
read YAML data from a file
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
ParseFile(source, opts)
source
-
string; file or URL to read from
opts
(optional) options as specified below
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.
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.
Parse an input YAML file to a Maple table
address≔FileTools:-JoinPath⁡example/address.yaml,base=datadir:
YAML:-ParseFile⁡address
table⁡companyName=Maplesoft,address=table⁡streetAddress=615 Kumpf Drive,province=ON,postalCode=N2V 1K8,city=Waterloo,country=Canada,founded=1988,phoneNumbers=table⁡type=local,number=+1 (519) 747-2373,table⁡type=toll-free,number=+1 (800) 267-6583,table⁡type=fax,number=+1 (519) 747-5284
Parse the same input YAML file to a Maple record
YAML:-ParseFile⁡address,output=record
Recordpacked⁡companyName=Maplesoft,address=Recordpacked⁡...,founded=1988,phoneNumbers=Recordpacked⁡...,Recordpacked⁡...,Recordpacked⁡...
The YAML[ParseFile] command was introduced in Maple 2017.
For more information on Maple 2017 changes, see Updates in Maple 2017.
See Also
YAML[ParseString]
YAML[ToString]
Download Help Document
What kind of issue would you like to report? (Optional)