By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

Saving modified DOM state

P: n/a
I am building an SVG interface (with Javascript) for client side control
of some hardware. The svg will be hosted on a micro PC
(http://www.picotux.com/indexe.html). It runs a uClinux OS with GCC 3.4.4
for C++ (and Fortran??) and a Web Server and Telnet and not much more.

My SVG seems to be working fine and using Firefox's DOM browser I can see
it change. What I can't do is find a way to capture these DOM state
changes. All I need is to capture timer events from my SVG and convert
them into CRON events in a config file and use CRON to kick a small
program on/off appropriately. This will in-turn turn a serial port pin
high or low - this controls a relay, which turns my hardware on and off at
the set times. Simple really :o)

Obviously, this needs to all be very lightweight. I don't think there's
room for a JVM and I don't know C++. So, if anyone knows a simple
solution to saving DOM state or wants to volunteer to program it in C++
for me, I'd be very happy.

Thanks in advance,
Greg
Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a


Greg wrote:

My SVG seems to be working fine and using Firefox's DOM browser I can see
it change. What I can't do is find a way to capture these DOM state
changes.


I am not sure what exactly you want to achieve. If you want to serialize
the current DOM of the SVG document in Mozilla then you can use e.g.
var serializedMarkup = new XMLSerializer().serializeToString(document);

If you want to post the current document to the server you can use e.g.
var httpRequest = new XMLHttpRequest();
httpRequest.open('POST', 'save.cgi', true);
httpRequest.send(document);
where save.cgi then finds the serialized SVG markup in the HTTP request
body.

If you want to have listeners reacting to changes in the DOM then
Mozilla has some support for W3C DOM Level 2 Mutation Events.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 24 '06 #2

P: n/a
Martin,

Just to recap the requirements then:

I serve some SVG to an SVG capable web client browser (eg, Firefox 1.5).

I change the state of the SVG on the client browser, so it now contains
some timer information that I want to use to control some hardware
attached to the server.

I capture the timer information from the client side SVG DOM back to the
server, in a format recognised by a timer that will use it to run a
program that turns the hardware on or off, via the serial port.

The hardware has a C++ compiler and a Web Server and hopefully enough room
for a couple of small C++ programs.

Does that help?

I've stated it in terms of a use case scenario, rather than a
technology description as it's the technology bit that I need help on, to
meet the requirements. You'll probably need to explain serialization or
listners, assuming they do what I need them to do?

Cheers,

Greg
Apr 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.