Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

data server requests and XML decode?


PPeters Feb 16, 2017 07:53 PM

Hi,

I have a project were i am looking at setting up some displays to show local river heights and flows. What I am looking at adding is the ability to display forecast flow information. This information is not held locally but is availble from our data server via a web request. Is it possible for the datalogger (CR1000 or similar) to make the request then decode the resulting XML?  I have some code experience but not in this domain.

request is (groundwater example but same principle)

http://hilltopserver.horizons.govt.nz/boo.hts?Service=SOS&Request=GetObservation&FeatureOfInterest=RC_103757&ObservedProperty=Groundwater%5bGroundWater%5d

as an alternative method would it be better to use FTP type features to either push data to the logger or upload a csv type file?


any thoughts suggestions or help much appreciated


regards

Paul


GaryTRoberts Feb 16, 2017 08:06 PM

Yes, it is.  Take a look at the blog article located at http://www.campbellsci.com/blog/easily-parse-data-from-trusted-source .


PPeters Feb 16, 2017 08:12 PM

Perfect Gary

just what I needed

thanks for thr reply


PPeters Feb 17, 2017 01:37 AM

just working through the problem now and hit a road block.. im can get the data from the blog example so confident the the code setup is ok

but when i hit our server data the xml file structure is slightly different

the result is embedded amonst other attributes and I am not sure how to reference 

<wml2:point><wml2:MeasurementTVP><wml2:time>2016-11-29T14:00:00+12:00</wml2:time><wml2:value>-2882</wml2:value></wml2:MeasurementTVP></wml2:point>

what would I use for the xml element name? 

  If xml_response_code = XML_END_OF_ELEMENT AND xml_element_name = "wml2:value" Then 

help much appreciated

Log in or register to post/reply in the forum.