Thomas Weholt 2002 at
Sun Jun 22 05:11:01 CEST 2003

I've come abit further parsing FOAF-files. The result is available for
download at, but it's still a bit buggy, for instance
it crashes when I tried to load Mark Pilgrims FOAF-profile. Still, it can
generate rather easily a structured FOAF-document and load data from a
xml-file or an url. It has some special properties not part of the
FOAF-standard, but they're in a seperate namespace in the xml-file and
should not be hard to remove or not use for people who want to use it for
ordinary FOAF-stuff.

If anybody has time to test it that would be nice. Problems remaining are :

1. cannot get the encoding set correctly in the generated document. This
means norwegian characters and other non-english characters will cause the
document to be seen as invalid xml. THIS IS A MAJOR PROBLEM. Any help here
would be appreciated.

2. The code is very verbose. I'm not good at creating xml in code other than
doing the old hard way. Hints on how to do it more object-like are welcome,
allthough the way I do it now works ok too.

3. The parser uses DOM, ie. everything is read into memory. Other solutions,
like using minidom or SAX/Expat are welcome. I cannot use anymore time on
this at the moment, due to other deadlines. It has not been tested on huge
documents so I know nothing about speed etc.

4. Better support for all the goodies available in RDF, like Dublin Core and
Syndication elements. Eh ... support for some of them, any support at all,
would be an improvement.

Best regards,
Thomas Weholt

"Thomas Weholt" <2002 at> wrote in message
news:M6XIa.8186$Hb.144201 at
> Hi,
> I need a FOAF[1]-parser that can handle deep-hierarchy of nodes ( ie.
> Friends knowing friends knowing friends etc. )  So far I've looked at
> Tramp[2] and RDFLib, but they don't seem to fit the task somehow. All I
> is to parse a FOAF-file and get a list of persons back, each person may
> again have a list of persons he/she knows etc. My attempts so far has been
> terrible mess of SAX, pulldom and rdflib.
> Any help would be highly appreciated.
> [1] :
> [2] :
> Best regards,
> Thomas Weholt

More information about the Python-list mailing list