简体   繁体   English

我不知道如何在Android上处理这种xml结构

[英]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.

相关问题 我不知道如何在Android中对JSON数据进行分类 - I don't know how to classify JSON data in Android 我不知道如何在android中传输变量 - I don't know how transfer my variable in android 我很困惑如何处理 Android Studio 中的 xml 代码无法处理 Java 代码 [暂停] - I'm confused how to deal with the xml code in Android Studio can't deal with Java code [on hold] 我想检索数据。 但我不知道如何使用这种数据结构 - I wanted to retrieve data . But I don't know how to do it with this data structure Android:相同的xml行为不同,取决于我膨胀它的位置,我不知道为什么 - Android: Same xml acts differently depending on where I inflate it and I don't know why android NullPointerException,但我不知道什么 - android NullPointerException but I don't know on what 我不知道Android上的dlopen()路径 - I don't know the dlopen() path on Android 我不知道如何解决此NullPointerException - I don't know how to fix this NullPointerException 我正在用Java编写一个Android应用程序,我认为这是内存泄漏,并且不知道如何解决它 - I am writing an Android app in java with what I believe to be a memory leak and don't know how to fix it 我在android应用程序中有异常,我不知道原因吗? - I have an exception in android application and i don't know the reason?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM