Skip to content

Instantly share code, notes, and snippets.

@dajobe
Created July 4, 2009 23:02
Show Gist options
  • Save dajobe/140762 to your computer and use it in GitHub Desktop.
Save dajobe/140762 to your computer and use it in GitHub Desktop.
def namespaces_seen(self):
"""Get a dictionary of prefix/URI pairs for namespaces seen during parsing.
"""
count = Redland.librdf_parser_get_namespaces_seen_count(self._parser)
nspaces={}
for index in range(0, count-1):
prefix=Redland.librdf_parser_get_namespaces_seen_prefix(self._parser, index)
uri_obj=Redland.librdf_parser_get_namespaces_seen_uri(self._parser, index)
if uri_obj is None:
uri=None
else:
uri=Uri(from_object=uri_obj)
nspaces[prefix]=uri
return nspaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment