Java Android Xml检查Web服务是否返回true或false

Java Android Xml检查Web服务是否返回true或false,java,android,xml,ios,asmx,Java,Android,Xml,Ios,Asmx,我正在确定一条流是否是活动的。我有一个预处理文件,可以这样做()。这是流处于非活动状态时返回的内容: false 当流处于活动状态时,它返回以下内容: true 我需要帮助创建一个xml读取器来检查Web服务是否返回true或false。谢谢你的帮助 我最近在iOS上做了同样的事情,这就是我检查XML的方式 NSError * error = nil; NSString * responseString = [NSString stringWithContentsOfURL:[NSURL

我正在确定一条流是否是活动的。我有一个预处理文件,可以这样做()。这是流处于非活动状态时返回的内容:

false

当流处于活动状态时,它返回以下内容:

true


我需要帮助创建一个xml读取器来检查Web服务是否返回true或false。谢谢你的帮助

我最近在iOS上做了同样的事情,这就是我检查XML的方式

NSError * error = nil;
NSString * responseString = [NSString stringWithContentsOfURL:[NSURL        URLWithString:@"http://www.calvaryccm.com/ServiceTimes.asmx/IsServiceTime"] encoding:NSUTF8StringEncoding error:&error];    

NSRange range = [responseString rangeOfString : @"true"];

if (range.location != NSNotFound) {
    NSLog(@"%@", responseString); 
    /// Handle active content.
   hiddenVideo.hidden = FALSE;
    hiddenAudio.hidden = FALSE;
    noService.hidden = TRUE;
    }
    else {
        NSLog(@"%@", responseString);
        // Inform user that the content is unavailable
       hiddenVideo.hidden = TRUE;
        hiddenAudio.hidden = TRUE;
        noService.hidden = FALSE;
        // Inform user that the content is unavailable
       UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle: @"Live Service"
                             message: @"There is no service going on at this time"
                             delegate: nil
                             cancelButtonTitle:@"OK"
                             otherButtonTitles:nil];
        [alert show];
        [alert release];
        HasShownAlert = TRUE; //let the other event know that the alert has already been shown.
   } 

在Android中有没有类似的方法?

似乎您正在尝试解析xml。如果是这种情况,您可以使用dom解析器

这是一个关于它的simepl教程
android设备上提供了
javax.xml.
软件包


使用google查找适合您需要的XML解析JAVA示例。

您必须解析XML。解析xml后,可以得到布尔值true或flase。之后,您可以根据自己的使用情况在应用程序中使用该值

对于在android中解析XML,拉式解析器是最好的方法。使用它,您可以解析xml

使用下面的链接了解更多信息


你能详细说明一下吗。我不明白你到底想要什么?我需要帮助创建一个xml读取器来检查Web服务是否返回true或false。