みなさん、こんにちは。WebサービスからSoaobject xmlを解析すると、xmlタグは空ではなく、すべて問題ありませんが、空の例です " <barcode></barcode>
" it makestring-anyType{}。そしてそれを私のリストに表示します!:(この単語「anyType{}」をリストから削除するために何をすべきか、それは私が書いたものを何も表示しませんか?envelope.implicitTypes =false;--->これは機能していません....それでもanyType{}を取得します...これが私のコードです:
String [] xmlElements = {"Id"、 "name"、 "Unit"、 "Cost"、 "description"、 "barcode"};
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
androidHttpTransport.call(SOAP_ACTION, envelope);
ArrayList<HashMap<String, String>> Tags = new ArrayList<HashMap<String, String>>();
if ( xmlelements==null&& KEY_RAKTINIS==null){
Object soapObj = (SoapObject)envelope.getResponse();
soapObj = ((SoapObject) soapObj).getProperty(KEY_PATVIRTINIMAS);
Toast.makeText(getActivity().getBaseContext(), soapObj.toString(), Toast.LENGTH_SHORT).show();
}else {
SoapObject soapObj = (SoapObject)envelope.getResponse();
soapObj = (SoapObject) soapObj.getProperty(KEY_RAKTINIS);// su situo ieinu i butent customers punkta
for (int j = 0; j < soapObj.getPropertyCount(); j++) {
SoapObject soapObjMenu = (SoapObject) soapObj.getProperty(j);
for (int i = 0; i <1; i++) {
HashMap<String, String> map = new HashMap<String, String>();
for( i=0; i < xmlelements.length;i++){
if (soapObjMenu.getProperty(xmlelements[i])!="") {
map.put(xmlelements[i], (soapObjMenu.getProperty(xmlelements[i]).toString()));
Log.v(xmlelements[i], "sitas");}
}
Tags.add(map);
}}
<Items>
<Item>
<Id>1000</Id>
<name>LCD Television HD Black 42 inches</name>
<Unit>ea</Unit>
<Cost>2000.00</Cost>
<description>Simple SKU</description>
<barcode></barcode>
</Item>
<Item>
<Id>1001</Id>
<name>LCD Television Model 01</name>
<Unit>ea</Unit>
<Cost>4015.00</Cost>
<description></description>
<barcode></barcode>
</Item>
<Item>
<Id>1003</Id>
<name>Plasma Television Model 01</name>
<Unit>ea</Unit>
<Cost>4020.00</Cost>
<description></description>
<barcode></barcode>
</Item>
`