如何将(在线)XML文档解析为数组 [英] How do I parse an (online) XML document to an array

查看:85
本文介绍了如何将(在线)XML文档解析为数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下数组:

Hi, I have the following array:

items = new DisplayButton[10, 6];
items[0, 0] = time0; items[0, 1] = delay0; items[0, 2] = direction0; items[0, 3] = spoor0; items[0, 4] = type0; items[0, 5] = warning0;
items[1, 0] = time1; items[1, 1] = delay1; items[1, 2] = direction1; items[1, 3] = spoor1; items[1, 4] = type1; items[1, 5] = warning1;
items[2, 0] = time2; items[2, 1] = delay2; items[2, 2] = direction2; items[2, 3] = spoor2; items[2, 4] = type2; items[2, 5] = warning2;
items[3, 0] = time3; items[3, 1] = delay3; items[3, 2] = direction3; items[3, 3] = spoor3; items[3, 4] = type3; items[3, 5] = warning3;
items[4, 0] = time4; items[4, 1] = delay4; items[4, 2] = direction4; items[4, 3] = spoor4; items[4, 4] = type4; items[4, 5] = warning4;
items[5, 0] = time5; items[5, 1] = delay5; items[5, 2] = direction5; items[5, 3] = spoor5; items[5, 4] = type5; items[5, 5] = warning5;
items[6, 0] = time6; items[6, 1] = delay6; items[6, 2] = direction6; items[6, 3] = spoor6; items[6, 4] = type6; items[6, 5] = warning6;
items[7, 0] = time7; items[7, 1] = delay7; items[7, 2] = direction7; items[7, 3] = spoor7; items[7, 4] = type7; items[7, 5] = warning7;
items[8, 0] = time8; items[8, 1] = delay8; items[8, 2] = direction8; items[8, 3] = spoor8; items[8, 4] = type8; items[8, 5] = warning8;
items[9, 0] = time9; items[9, 1] = delay9; items[9, 2] = direction9; items[9, 3] = spoor9; items[9, 4] = type9; items[9, 5] = warning9;





我想用以下XML文件中的信息填充它:

< a href =http://jecom.nl/ns-api-avt.xml> http://jecom.nl/ns-api-avt.xml [ ^ ]



我只需要确定项目(即< eindbestemming>来自xml文件应该进入directioni和VertrekSpoor = spoori)我怎么能以最简单的方式做到这一点?



And I want to populate it with information from the following XML file:
http://jecom.nl/ns-api-avt.xml[^]

I only need certain items (ie <eindbestemming> from the xml file should get into directioni and VertrekSpoor = spoori) How can I do this in the easiest way?

推荐答案

如果你真的知道你想要什么,你可以将xml作为文本阅读并解析它。



否则你必须使用 xml解析器

考虑尝试这一个。看起来它可以满足您的需求。
if you really know what you want, you can read the xml as text and parse it.

Else you must use a xml parser.
Consider trying out this one. Looks like it can suit your needs.


这篇关于如何将(在线)XML文档解析为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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