View Single Post
Unread 08-16-2012, 02:38 AM   #201
flashflood
Found some matches.
 
Join Date: 06-02-12
Location: Los Altos, CA
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by HKChad View Post
I question their skills as writing xml, but whatever, it works.
Heh. Yeah. I would have preferred JSON, but as you say: whatever. For such trivial data the format hardly matters. For my little gnuplot graphing tool I don't even use an XML parser, I just use bash. Literally, it's curl or wget of all.xml piped to this:

Code:
get_status() {
    local IFS="<>$IFS"
    while read W N V E R
    do
        [ "/$N" = "$E" ] && eval $N=$V
    done
}
This converts a line of XML like "<FOOD1_SET>1800</FOOD1_SET>" into the executable (vla eval) statement FOOD1_SET=1800.

(If you haven't played with this, no, that's not self-clean mode -- the temps are reported in units of degrees * 10, which is goofy, but whatever.)
flashflood is offline   Reply With Quote