RDFCalendar.Parsers

Package RDFCalendar :: Module Parsers |
[show private | hide private]
[frames | no frames]

## Module RDFCalendar.Parsers

    Conversion of iCalendar files to and from RDF representations.

    Copyright (C) 2005, 2006 Paul Boddie <paul@boddie.org.uk>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

    --------

    Note on relationships/predicates between nodes/references:

        * The "contains" relationship is used between elements.
        * Predicates from elements to attributes typically bear the type of the
          attributes.
        * Multivalues are represented by numerous "value" nodes, each linked to
          nodes via relationships bearing specific labels.

    To parse iCalendar files, use the parse function provided in this module:

    resource = RDFCalendar.Parsers.parse(f, store)

    In the above call, f should be a stream providing iCalendar data, and store
    should be some kind of object which can understand the actions of the parsing
    process; in the RDFCalendar.Store module, some classes are provided for this
    activity. For the storage of iCalendar data, objects instantiated from the Store
    class can be supplied to the parse function; for interpreting free/busy requests,
    objects instantiated from the FreeBusyRequest class can be supplied.

    To interpret the contents of DOM documents, use the parse_document and
    parse_document_fragment functions provided in this module.

Classes
`DOMParser` | A parser which reads resource definitions from DOM documents.
`iCalendarParser` | An iCalendar parser.
`Reader` | A simple class wrapping a file, providing simple pushback capabilities.

Exceptions
`DuplicateResourceError` |

Function Summary
| ``add_node`(store, attributes, node_type, uriref)` Add a node described by the given 'attributes' and 'node_type' to the store.
| `check_existing(store, uriref)`
| ``find_uid`(attributes)` Find the unique identifier in 'attributes', returning such an identifier (or None if no such identifier was found).
| ``parse`(f, store, name, uriref)` Parse the resource data found through the use of the file object 'f', which should provide Unicode data, and put the resource information in the given 'store'.
| ``parse_document`(doc, store, uriref)` Parse the resource data found in the given DOM document 'doc', inserting the information in the given 'store'.
| ``parse_document_fragment`(doc, root, store, uriref)` Parse the resource data found in the given DOM document 'doc' under the 'root' element, inserting the information in the given 'store'.

Function Details

### add_node(store, attributes, node_type, uriref=None)
    Add a node described by the given 'attributes' and 'node_type' to the
    store. The 'attributes' parameter is a list of items of the following
    form: (name-string, modifiers-dictionary, value-tuple-list). The latter
    value-tuple-list consists of items of the following form: (qualifier,
    value-string).

    If the optional 'uriref' is specified, override any unique identifier
    found in the 'attributes'.

### find_uid(attributes)
    Find the unique identifier in 'attributes', returning such an identifier
    (or None if no such identifier was found). The 'attributes' are modified
    if an identifier was found, with the attribute providing the identifier
    removed.

### parse(f, store, name=None, uriref=None)
    Parse the resource data found through the use of the file object 'f', which
    should provide Unicode data, and put the resource information in the given
    'store'. (The codecs module can be used to open files or to wrap streams in
    order to provide Unicode data.)

    The optional 'name' and 'uriref' parameters can be used to respectively set
    the name of the imported resource and to override the unique identifier of
    the resource with a specific URI reference.

    As a result of parsing the resource, the root node of the imported resource
    is returned.

### parse_document(doc, store, uriref=None)
    Parse the resource data found in the given DOM document 'doc', inserting the
    information in the given 'store'. If the optional 'uriref' is specified,
    override any unique identifier information in choosing the identity of the
    root node.

### parse_document_fragment(doc, root, store, uriref=None)
    Parse the resource data found in the given DOM document 'doc' under the
    'root' element, inserting the information in the given 'store'. If the
    optional 'uriref' is specified, override any unique identifier information
    in choosing the identity of the root node.

Generated by Epydoc 2.1 on Mon Mar 19 01:08:11 2007 | http://epydoc.sf.net