Hello Chaps,
I'm trying to write an application that will log to an XML file, that'll be later parsed by another application. The proposed log file will look something like this, listing different event elements and then a record for each time that event occurs. <?xml version="1.0" encoding="iso-8859-1"?> <log> <event name="reboot"> <detail date="2007-01-01" time="12:00:00" /> </event> <event name="calledhome"> <detail date="2007-01-01" time="12:00:00" /> <detail date="2007-01-01" time="13:00:00" /> <detail date="2007-01-01" time="14:00:00" /> <detail date="2007-01-01" time="15:00:00" /> </event> <event name="spotted"> <detail address="00:45:GF:WE:3E:10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" date="2007-01-01" time="12:00:00" /> </event> <event name="discovered"> <detail address="00:45:GF:WE:3E:10" channel="10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" channel="10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" channel="10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" channel="10" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" channel="10" date="2007-01-01" time="12:00:00" /> </event> <event name="posted"> <detail address="00:45:GF:WE:3E:10" file="test.jpg" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" file="test.jpg" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" file="test.jpg" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" file="test.jpg" date="2007-01-01" time="12:00:00" /> <detail address="00:45:GF:WE:3E:10" file="test.jpg" date="2007-01-01" time="12:00:00" /> </event> </log> What I would really like to do is have a different function for each event, so logReboot() or something like that which can be called when the application starts, and it'll create and entry with the current date and time. This must be a static file that is on the box, allot of the examples I've seen seem to work using the 'print' function which is a little sketchy as outputting to the screen isn't any use to me, this needs to be a file that can be collected by another application. Can anyone offer any advice on how best to get started with this kind of thing? I'm running python 2.4.4 but when I've tried running any examples with SAX involved they seem to say 'no module found: sax" or something to that effect, I was under the impression that sax came bundled with python 2.0 and above? Thanks guys, Rob
-- http://mail.python.org/mailman/listinfo/python-list