[XML-SIG] Help Needed (Will pay if someone is interested)

Robert Rawlins - Think Blue robert.rawlins at thinkbluemedia.co.uk
Mon Jul 2 13:20:21 CEST 2007

Hello Chaps,


I'm looking for some help with XML parsing, I've been playing around with
this over the past few days and the only solution I can come up with seems
to be a little slow and also leaves what I think is a memory leak in my
application, which causes all kinds of problems. 


I have a very simple XML file which I need to loop over the elements and
extract the attribute information from, but the loop must be conditional as
the attributes must meet a certain criteria.


My current solution is using minidom, which I've read isn't one of the
better parsers, if anyone knows of any that are better for the task I would
love to hear it, the content is extracted regularly so whatever we chose
needs to be quick, and validation isn't so important. Take a look at this
brief example of the XML we're dealing with:


<schedules name="Default event" location="this is the location of the

                <event name="This is an event" location="At my house"
type="1" start="2007-01-01 00:00:00" end="2007-01-01 00:00:00" />

                <event name="And Another" location="At work" type="2"
start="2007-01-01 00:00:00" end="2007-01-01 00:00:00" />

                <event name="This is some more" location="At the cafe"
type="1" start="2007-01-01 00:00:00" end="2007-01-01 00:00:00" />

                <event name="And one last one" location="At my house"
type="3" start="2007-01-01 00:00:00" end="2007-01-01 00:00:00" />



Now this file details events which are possibly going to occur over the next
couple of weeks. Now what I need to do is have a function which is called
'getCurrentEvent()' which will return any events that should be occurring at
this point in time, or now(). The 'Type' attribute details how often the
event it likely to reoccur, 1 being daily, 2 being weekly and so on, if no
elements are found which are occurring in this time and date then I would
like it to return the default event which is defined in the attributes of
the 'schedules' tag.


The current solution I have put together uses minidom to loop over the
elements from the XML and then does a conditional against a python module
called 'period.py'. This works ok, but it's very slow and also contains a
memory leak. I need something better and I have no real idea or experience
of how to achieve it which is why I'm here with you good gentlemen to try
and find a solution.


I appreciate this could be quite a challenging task so would be happy to pay
someone for their time to solve this for me, you may want to contact me off
list to talk about that though and we'd be hoping to get this sorted ASAP.


Thanks guys,




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20070702/41cd5b1e/attachment.htm 

More information about the XML-SIG mailing list