AutoPilot searchProperties = new AutoPilot();
searchProperties.selectXPath("/BatchItemSearchResultAnswer/Result/SearchProperties/Content/Item");
searchProperties.bind(nav);
searchPro searchOption = new searchPro();
while (searchProperties.evalXPath() != -1) {
//reuser
name.resetXPath();
name.selectXPath("Name");
searchOption.id = Id.evalXPathToString();
searchOption.name = name.evalXPathToString();
Log.e("SearchId", Id.evalXPathToString());
Log.e("SearchName", name.evalXPathToString());
Image.resetXPath();
Image.selectXPath("/BatchItemSearchResultAnswer/Result/SearchProperties/Content/Item/Values/PropertyValue");
searchOption.propertyList = new ArrayList();
while (Image.evalXPath() != -1) {
property pro = new Property();
pro.id = Id.evalXPathToString();
Log.e("SearchPId", Id.evalXPathToString());
Log.e("SearchPName", name.evalXPathToString());
searchOption.propertyList.add(pro);
}
}
使用してXMLで内部配列の子要素を取得するにはどのようにここに私のXMLximpleware
<SearchProperties><Content> <Item><Id>12345</Id><Name>scene</Name><Values><PropertyValue><Id>29</Id><Name>Le</Name></PropertyValue> <PropertyValue><Id>208</Id><Name>Business</Name></PropertyValue> </Values></Item><Item>..</Item></Content></SearchProperties>
SearchProperties whileループ一度だけです。私はImage.selectPath( "")行を削除します。その時は正しくループするでしょう。 これを解決する方法。
ありがとうございました。
コード書式がオフになっているようです... –
私はちょうど質問を編集しました。 – AnanThDev
私の答えがあなたのために働く場合、あなたは投票を与えることができます... –