On 11.02.2015 18:45, Bill Lavender wrote:
On Wed, Feb 11, 2015 at 02:28:39PM +0100, Dirk Zimoch wrote:
On 09.02.2015 21:58, Kasemir, Kay wrote:
and then you need to be prepared to parse a response that looks like
HTTP/1.1 200 OK
Content-Type: text/html
Server: Whatever
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 97
.. the actual data..
Try regular expressions to fund the actual data in all the http noise.
See my example in the StreamDevice documentation:
http://epics.web.psi.ch/software/streamdevice/doc/tipsandtricks.html#web
get_title {
extrainput = ignore;
replyTimeout = 1000;
out "GET http://\$1\n\n";
in "%+.1/(?im)<title>(.*)<\/title>/";
}
Something like this can work with a device that always responds in a fixed
pattern. However, you should be aware that, in general, regular expressions
cannot be used to parse arbitrary HTML. A Stack Overflow article that
talks about this can be found here:
http://stackoverflow.com/questions/6751105/why-its-not-possible-to-use-regex-to-parse-html-xml-a-formal-explanation-in-la
A more entertaining, though less illuminating, explanation can be found here:
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
Hope this helps.
Bill Lavender
Bill is right. I also mention this in my documentation:
"But this only works if the order of the values is predictible.
StreamDevice is not an XML parser! It always reads sequentially."
The web page must have a fixed format. In particular all values to parse
must always be in the same order.
Dirk
- References:
- using EPICS code with HTTP port Ana Malagon
- RE: using EPICS code with HTTP port Mark Rivers
- Re: using EPICS code with HTTP port Kasemir, Kay
- Re: using EPICS code with HTTP port Dirk Zimoch
- Re: using EPICS code with HTTP port Bill Lavender
- Navigate by Date:
- Prev:
Re: EPICS Collaboration Meeting May 2014 Torsten Bögershausen
- Next:
RE: EPICS Collaboration Meeting May 2014 Hoff, Larry
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
<2015>
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: using EPICS code with HTTP port Bill Lavender
- Next:
Re: using EPICS code with HTTP port Ana Malagon
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
<2015>
2016
2017
2018
2019
2020
2021
2022
2023
2024
|