[英]I don't know how to deal with this kind of xml structure on android
<gesmes:Envelope>
<gesmes:subject>Reference rates</gesmes:subject>
<gesmes:Sender>
<gesmes:name>European Central Bank</gesmes:name>
</gesmes:Sender> <Cube>
<Cube time="2010-03-26">
<Cube currency="USD" rate="1.3353"/>
<Cube currency="JPY" rate="124.00"/>
<Cube currency="BGN" rate="1.9558"/>
<Cube currency="CZK" rate="25.418"/>
... ...
</Cube>
</Cube>
</gesmes:Envelope>
What can I do with this kind of structure? 这种结构我该怎么办?
You can read the information from it by traversing it. 您可以通过遍历从中读取信息。 You can also make it into an object.
您也可以使其成为一个对象。
I don't know what you want to do with the data, so I'm guessing you're asking how to get a certain rate from a string like that? 我不知道您想对数据做什么,所以我猜您在问如何从这样的字符串中获得一定的速率?
I'd suggest you find an xml-parser for java and use that. 我建议您为Java找到一个XML解析器并使用它。 You can then do whatever you like with the information contained in that xml file.
然后,您可以使用该xml文件中包含的信息进行任何操作。
A semi-random googled url for parsing: http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html 用于解析的半随机Google网址: http : //www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.