[Vobject] vobject.iCalendar to tree

tsr tsr.offentlig at tsr.se
Wed Feb 10 02:56:11 CST 2010


Hi,

[preamble]
I've been thinking alot lately about iCalendar for printing and the
currently best idea I have so far is creating an xml-representation that
can be parsed through an xslt-stylesheet into svg.

In my continuing process to actually get myself into python I've decided
to make the ical2xml in python.

I've found a current ietf-draft about ical2xml that I will (with some
modifications) implement.

On to my question...
[/preamble]

Is there an already implemented function (or best practice) to get an
iCalendar-object as a tree-object using vobject?

So that each component is separated into sub-components.

example:
ical
    vcal
        vevent
            valarm
           /valarm
        /vevent
        vevent
        /vevent
    /vcal
    vcal
        vjournal
        /vjournal
        vjournal
        /vjournal
    /vcal
/ical

instead of:
ical
vcal
vevent
valarm
/valarm
/vevent
vevent
/vevent
/vcal
vcal
vjournal
/vjournal
vjournal
/vjournal
/vcal
/ical

So that accessing a trigger in the above valarm would be something like:

ical.vcal[0].vevent[0].valarm.property['trigger']

And there would be no other path to it.

The problem I'm having with the current libraries (both vobject and
icalendar) is that I can't figure out how to get the objects in
tree-form instead of inlined.

It is not that hard to write a parser-function to do this, it just seems
that I shouldn't have to. I think I just don't understand the
vobject-library fully.

Can I have some enlightenment please.

/tsr



More information about the VObject mailing list