Changes between Version 1 and Version 2 of CSMLParserHowTo


Ignore:
Timestamp:
14/07/06 11:28:39 (13 years ago)
Author:
domlowe
Comment:

More edits to csml parser how to

Legend:

Unmodified
Added
Removed
Modified
  • CSMLParserHowTo

    v1 v2  
    6565print strCSML 
    6666}}} 
     67 
     68 
     69So all we are doing is creating a Dataset parser object and saying 'parse all the XML from tree.getroot()'. i.e. parse the entire CSML document. 
     70 
     71So now the object called 'csml' is a representation of the CSML document in memory. You can navigate this document directly by using python attributes e.g.: 
     72 
     73{{{ 
     74#!python 
     75#Reading the href attribute of the domainReference for a feature and print it: 
     76print dataset.featureCollection.members[3].profileSeriesDomain.domainReference.times.href 
     77}}} 
     78 
     79Notice that to get to a feature you have to navigate the featureCollection. Individual CSML features are members of dataset.featureCollection.members[]. 
     80Anyway, this is all very longwinded so there is a higher level API that wraps up a lot of this detail and makes interacting with features much simpler. 
     81 
     82 
     83 
     84 == The CSML API == 
     85As we have just seen, the parser itself provides an API of sorts via the object hierarchy. but it is clumsy to navigate. The most common things you will want to do with features have been wrapped up in a set of simple methods.