Package rsbxml :: Module xop :: Class XOP
[hide private]
[frames] | no frames]

Class XOP

source code

object --+
         |
        XOP

Instances of this class represent composite XOP structures consisting of an XML document and associated binary data items.

For the XOP specification, see http://www.w3.org/TR/xop10/.


Author: jmoringe

Instance Methods [hide private]
 
__init__(self, document, attachments=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getDocument(self) source code
 
setDocument(self, document) source code
 
getAttachments(self) source code
 
setAttachments(self, attachments)
Set the associated binary data items to attachments.
source code
 
getAttachment(self, uri) source code
 
setAttachment(self, uri, attachment) source code
 
addAttachment(self, attachment)
Add attachment to the list of attachments.
source code
 
_makeAttachment(self, uri, thing) source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  document
  attachments

Inherited from object: __class__

Method Details [hide private]

__init__(self, document, attachments=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

setAttachments(self, attachments)

source code 

Set the associated binary data items to attachments.

Parameters:
  • attachments (dict or list

    Example:

    >>> p.attachments = { 'http://foo.bar': bytearray(str('bla')) }
    ...
    >>> p.attachments = [ Attachment('http://foo.bar', bytearray(str('bla'))) ]
    ...
    ) - Either a dict the keys of which are URIs and the values of which are the binary data items, or a list of either Attachment objects or pairs of the same kind as in the dict case.

addAttachment(self, attachment)

source code 

Add attachment to the list of attachments.

Parameters:
  • attachment (Attachment) - The attachment that should be added.
Raises:
  • KeyError - If there already is a attachment for the URI of attachment.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

Property Details [hide private]

document

Get Method:
getDocument(self)
Set Method:
setDocument(self, document)

attachments

Get Method:
getAttachments(self)
Set Method:
setAttachments(self, attachments) - Set the associated binary data items to attachments.