¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Brute-force parsing of an XML stream ? (cc128 Current Cost)


seismicsound174
 

Hi Marc,

We have that device in here in Australia where it's called WattsClever.

I wrote a module that parses the stream using nothing but SIMPL.
Gather on 47d ("/"). Use an STOA for each XML tag that you want to read then convert the ASCII characters to analogs using your choice of method as taught in Intermediate class... use an ARAM to store the analogs for further processing.

The only complication is the yearly value which has more than 5 digits (bigger than a 16-bit analog).

Enjoy - maybe it'll help to get people to turn the oven off when they don't need it... ;-)

Phil.

--- In Crestron@..., "Chip" <cfm@...> wrote:


As long as your buffer is big enough to accommodate the larger messages, and as long as you're keying your parsing routine to run after seeing a "</msg>" tag, I'm not seeing where there would be a problem, no?

Those 2-hour messages don't look like they get bigger than 2k worth of data - which ain't a lot...

- Chip


--- In Crestron@..., Marc-Etienne HUNEAU <mehuneau@> wrote:

Hey Group,


I'm working on a CurrentCost Envi cc128 device. It's a power meter, and its RS232 output can (and will) spit power consumption data.

It outputs a realtime and short xml stream whenever it gets a reading from one of its meters.

It also outputs a set of possibly very long xml data sets every two hours.



I'm parsing the "realtime" data just fine. I even put together a cool little graph using the Google Charts module from XXXXX.


Problem is, now I gather the string and search for the tags i'm looking for. I suspect that won't work with the very long xml for daily, weekly and monthly data.

I'm not willing to parse and store all the data. Far from that, I'm only willing to retrieve one or two days of hourly history, one or two weeks, and one of two months. The idea is to generate history charts for one hour, one day, one week, one month. Well, maybe one year too.

For that I should read data as it flows through my module. How would you gurus do that ?


--
Marc-Etienne HUNEAU Dark Side of the Room (DSR)
+33 (0)6 615 516 90








Join [email protected] to automatically receive all group messages.