1

In our project we do a GetFeature request to a WFS service. This service returns some GML. To parse this GML, we are playing with the GML parser of OpenLayers. This is working as long the GML isn't 'complex'. It isn't returning everything.

This is how a GML object looks like:

<gml:featureMember>
  <mag:keywords gml:id="TopografischElement_Trefwoord.fid--255d1722_146cd32a493_b9c">
    <mag:keywordid>1</mag:keywordid>
    <mag:keyword>Vlees</mag:keyword>
    <mag:keywordtopografischelement>
      <mag:keywordtopolink gml:id="1">
         <mag:keywordid>1</mag:keywordid>
         <mag:topografischelementid>4</mag:topografischelementid>
         <mag:typologie1>Wegennet</mag:typologie1>
         <mag:typologie2>Straat</mag:typologie2>
         <mag:typology1>Road network</mag:typology1>
         <mag:typology2>Street</mag:typology2>
      </mag:keywordtopolink>
   </mag:keywordtopografischelement>
 </mag:keywords>
</gml:featureMember>

This the code we use to parse it:

var content = _this.format.read(data);

and _this.format is:

this.format = new OpenLayers.Format.GML();

So when looping through "content", each object has a data property. When looking that property, we can find the keywordid and keyword (in this example 1 and 'Vlees'). The problem is, I need the data below that, I need the mag:topografischelementid. How can I make it parse that data too, and not only the first 2 fields?

  • Your GML is not a complex feature – nmtoken May 27 '18 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.