我在XML中有这样的东西:
<trkpt lat="-32.577000" lon="-71.443764">
<ele>2.204529</ele>
<time>2015-12-27T12:35:45Z</time>
我可以使用
获得lat和lon XmlPullParser parser = factory.newPullParser();
parser.getAttributeValue(0);
parser.getAttributeValue(1);
但是如何才能获得存储在“ele”标签之间的值?
答案 0 :(得分:2)
你必须在当前元素上使用getText()。从文档
State.pushData = function () {
$http({
method: 'POST',
url: 'pushData.php?action=pushdata',
data: {'status': 'push', 'email' : State.campemail},
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(response){
if(response.error){
console.log(response.error);
return;
}
State.getCartData();
State.selectedItems = [],
});
}
当然,您必须将解析器移动到调用 State.pushData = function () {
$http.post('pushData.php?action=pushdata',
{'status': 'push', 'email' : State.campemail}
).then(function(response){
if(response.error){
console.log(response.error);
return;
}
State.getCartData();
State.selectedItems = [],
});
}
的正确元素。来自文档:
Returns the text content of the current event as String.