使用jquery的xml根节点属性

时间:2015-09-20 12:23:25

标签: jquery xml geoserver

我有geoserver响应:

fLogin.setFacebookListener(new OnFacebookListener(){
    @Override
    public void onFacebookLoggedIn(Profile profile){
      //Do whatever you want to do with profile
    }
});

我想获得numberOfFeatures。

我已经厌倦了以下解决方案,但无法正常工作

<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:topp="http://www.openplans.org/topp" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sf="http://www.openplans.org/spearfish" xmlns:gml="http://www.opengis.net/gml" xmlns:GIS="http://softwarekitchengisdata.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="0" timeStamp="2015-09-20T12:15:46.527Z" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>

这是我的小提琴: http://jsfiddle.net/uftmnggw/

1 个答案:

答案 0 :(得分:2)

尝试此选择器

$($doc).find("*").eq(0).attr('numberOfFeatures')

JsFiddle http://jsfiddle.net/uftmnggw/2/