如何在xml中查找某些项目? [英] How to find certain items in an xml?

查看:79
本文介绍了如何在xml中查找某些项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 xml 和所有的东西,好消息是,我可以在处理中运行它.所以当我按下 run 时,在底部的框中​​我会得到所有球队的所有分数.为什么,这是代码:

I have an xml and all, and the good thing is, I can run it in processing. So when I press run, in the box in the bottom I get all the scores of all the teams. Why, here's the code:

XML xml;

void setup() {
  xml = loadXML("http://www.scorespro.com/rss2/live-basketball.xml");
  XML[] channel = xml.getChildren("channel");
   //println(xml);
  for (int i = 0; i < channel.length; i++) {
    String item = channel[i].getString("title");
    String name = channel[i].getContent();
    println(channel);
  }
}

现在我想知道.我只想得到例如迈阿密热火队的得分.这可能吗?

Now I am wondering. I only want to get for example the Miami Heat's score. Is that possible?

推荐答案

Processing 有一个 内置 XML 库 可以完全满足您的需求.

Processing has a built-in XML library that can do exactly what you're looking for.

这篇关于如何在xml中查找某些项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆