Module BasicClasses :: Class BIXMLWriteable
[show private | hide private]
[frames | no frames]

Class BIXMLWriteable

object --+
         |
        BIXMLWriteable

Known Subclasses:
BioInfer, Entity, Formula, FormulaNode, Link, Linkage, Linkages, Ontology, OntologyNode, Predicate, Sentence, Sentences, SubToken, Token

Definition of methods and variables for XML output. Any object that is included in the XML output needs to inherit from this class. The XML output mechanism works as follows.
Method Summary
  writeXML(self, out, indent, **kwArgs)
Outputs the complete XML representation of the given object.
  writeXMLClose(self, out, indent)
Prints the closing tag of the object: </tag>.
  writeXMLOpen(self, out, indent, closing)
Writes opening tag into the XML output.
  XMLAttrs(self)
Computes the string representation of the object's attributes, which are included into the XML tag.
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T

Class Variable Summary
list persistentAttrs: The list of attributes to be included in the XML output.

Method Details

writeXML(self, out, indent, **kwArgs)

Outputs the complete XML representation of the given object.
  1. The XML tag, including the attributes is printed.
  2. If defined, the nested object are recursively printed via a call to writeXMLNestedItems.
  3. The closing tag is printed. If there are no nested objects, the complete <tag/> was used already in step 1.
Parameters:
out - The output stream to which the XML representation should be printed.
indent - The indentation level of the XML block.
           (type=Integer)
kwArgs - Any keyword arguments will be passed to writeXMLNestedItems

writeXMLClose(self, out, indent=0)

Prints the closing tag of the object: </tag>.
Parameters:
out - The output stream to which the output is printed.
indent - The indentation level of the XML block.
           (type=Integer)

writeXMLOpen(self, out, indent=0, closing=False)

Writes opening tag into the XML output. Depending on the parameter closing, the opening will be a simple opening tag <tag> or a complete tag <tag/>.
Parameters:
out - Output stream to which the XML output is printed.
indent - Indentation level of the output.
           (type=Integer)
closing - If true, the complete tag <tag/> is produced. If false, only the opening tag <tag> is produced.
           (type=bool)

XMLAttrs(self)

Computes the string representation of the object's attributes, which are included into the XML tag. Invokes the mechanism for attribute printing (described above) to obtain all printable attributes of the object
Returns:
A string containing the XML-encoded, textual representation of the object's attributes

Class Variable Details

persistentAttrs

The list of attributes to be included in the XML output. By default an empty list, that is, no attributes are included by default.
Type:
list
Value:
[]                                                                     

Generated by Epydoc 2.0 on Tue Nov 21 15:32:22 2006 http://epydoc.sf.net