Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 解析xml数据_Android - Fatal编程技术网

Android 解析xml数据

Android 解析xml数据,android,Android,我有以下XML数据。如果请求或输入无效,如何跟踪错误标记 如果可能的话,你能为我提供正确的代码吗 登录请求: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoa

我有以下XML数据。如果请求或输入无效,如何跟踪错误标记

如果可能的话,你能为我提供正确的代码吗

登录请求:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Signin xmlns="http://tempuri.org/">
  <card_number> 123/321 </ card_number >
   <dob>MM|DD|YYYY </dob >
    </Signin>
  </soap:Body>
</soap:Envelope>

123/321 
年月日
答复:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SigninResponse xmlns="http://tempuri.org/">
      <user>
        <user_id>long</user_id>
        <current_balance>string</current_balance>
        <card_iamge><![CDATA[string]]></card_iamge>
      </user>
    </SigninResponse>
  </soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TransactionHistoryResponse xmlns="http://tempuri.org/">
      <transactions>
        <transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
        <transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
<transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
      </transactions>
    </TransactionHistoryResponse>
  </soap:Body>
</soap:Envelope>

长的
一串
交易历史记录请求:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TransactionHistory xmlns="http://tempuri.org/">
  < user_id >1/2 </ user_id >


    </TransactionHistory>
  </soap:Body>
</soap:Envelope>

1/2
答复:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SigninResponse xmlns="http://tempuri.org/">
      <user>
        <user_id>long</user_id>
        <current_balance>string</current_balance>
        <card_iamge><![CDATA[string]]></card_iamge>
      </user>
    </SigninResponse>
  </soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TransactionHistoryResponse xmlns="http://tempuri.org/">
      <transactions>
        <transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
        <transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
<transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
      </transactions>
    </TransactionHistoryResponse>
  </soap:Body>
</soap:Envelope>

$10.50
ASYU763543
$10.50
ASYU763543
$10.50
ASYU763543
错误:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <*Response xmlns="http://tempuri.org/">
  < error> string </ error >
    </<*Response>
  </soap:Body>
</soap:Envelope>

字符串
看看这个

也许这可以解决你的问题