0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

XMLファイルに記述したsymbolを読み込み=>TokenListにセット。

Last updated at Posted at 2019-03-12

TokenListにsymbolをセットしておくき、それをQuotesProviderとかに読み込ませて、updateで値を取得する(ような感じ)

まず、簡単なxmlファイル

sourceSymbol.xml
<root>
	<symbol>
		<name>7203-TS</name>
	</symbol>
	<symbol>
		<name>8798-TS</name>
	</symbol>
	<symbol>
		<name>4431-TS</name>
	</symbol>
	<symbol>
		<name>7048-TS</name>
	</symbol>
	<symbol>
		<name>7049-TS</name>
	</symbol>
	<symbol>
		<name>4293-JQ</name>
	</symbol>
</root>

で、これを読み込む関数ファイル

using elsystem.xml;		//xml
using tsdata.common;	//TokenList
input:FILE_URL(string);

var:
	xmlDocument Doc(null),
	xmlElement root(null), 
	xmlnodelist xmlList(null), 
	bool filefound(true) , 
	int n(0), 
	TokenList tList(null),
	string ret("");

tList = TokenList.Create();
Doc = xmlDocument.Create();
filefound = true;

Try
	Doc.Load(FILE_URL);
catch(elsystem.io.FileNotFoundException ex)
	filefound = false;
end;
	
if filefound then begin

	root = doc.DocumentElement;
	xmlList = root.GetElementsByTagName("symbol");

end;

for n = 0 to xmlList.Count - 1 begin
	tList.add(xmlList.ItemOf[n].Item["name"].innertext);
end;

ret = tList.ToString();

$$getStringFromXML = ret;


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?