"data" property defines a data file as the data source. It has the following sub properties:
| 属性 | 説明 |
|---|---|
| "type" | データファイルのタイプ ("csvfile", "xmlfile", "jsonfile") |
| "filename" | ファイル名 |
| "record" | XML データのノード名 (xml ファイルの場合) |
| "items" | データ項目 |
このモデルは、csv ファイルから Title、Artist、Price を含むレコードを item 1, 2, 5 として取得(fetch)します:
{
"data": {
"type" : "csvfile",
"filename": "cd_catalog.txt",
"items" : [
{"name": "Title", "index": 1},
{"name": "Artist","index": 2},
{"name": "Price", "index": 5}
]
}
}
Try It Yourself »
例の説明:ケース テキストファイル。
このモデルは、XML ファイルの CD ノードから Title、Artist、Price を含むレコードを取得(fetch)します:
{
"data": {
"type" : "xmlfile",
"filename": "cd_catalog.xml",
"record" : "CD",
"items" : [
{"name": "Artist",
"nodename": "ARTIST"},
{"name": "Title", "nodename": "TITLE"},
{"name": "Country","nodename": "COUNTRY"}
]
}
}
Try It Yourself »
例の説明:ケース XML ファイル。
このモデルは、JSON ファイルの CD オブジェクトの配列から Title、Artist、Price を含むレコードを取得(fetch)します:
{
"data" : {
"type" : "jsonfile",
"filename" : "cd_catalog.js",
"record" : "cd",
"items" : [
{"name" : "Title",
"nodename" : "title"},
{"name"
: "Artist", "nodename" : "artist"},
{"name" : "Price", "nodename" : "price"}
]
}
}
Try It Yourself »
例の説明:ケース JSON ファイル。