我在Java中使用snakeYAML解析了一个YAML文件。以下是代码:
Yaml yaml = new Yaml();
String fileContent = readFile(folderPath+fileName, StandardCharsets.UTF_8);
Object obj = yaml.load(fileContent);
System.out.println(obj);
对象打印为:
{meta={data_version=0.5, created=Tue Sep 08 05:30:00 IST 2009, revision=1}, info={city=London, dates=[Fri Sep 04 05:30:00 IST 2009], match_type=ODI, outcome={by={runs=4}, winner=Australia}, overs=50, player_of_match=[CJ Ferguson], teams=[England, Australia], toss={decision=field, winner=England}, umpires=[AL Hill, NJ Llong], venue=Kennington Oval}, innings=[{1st innings={team=Australia, deliveries=[{0.1={batsman=SR Watson, bowler=JM Anderson, extras={wides=1}, ...
如何迭代节点以获得不同的值?