| Home | Trees | Index | Help | 
|---|
| Package EaseXML :: Module main :: Class XMLObject | 
  | 
object --+
         |
        XMLObject
Attribute,
    AttributeGroup,
    Choice,
    ComplexType,
    Element,
    Enumeration,
    Group,
    Schema,
    Sequence,
    SimpleTypeClass attributes of interest:
__name__If you pass the keyword main=True to one of your Nodes, it will be hooked so that calling Node methods ('append' for instance) from the XMLObject instance will be applied to that main Node:
class Other(XMLObject):
    boo = StringAttribute(default='titi')
class Single(XMLObject):
    content = ChoiceNode(['Other','Single'], noLimit=True, main=True)
    title = StringAttribute()
single = Single()
single.title = 'Foo'
single.append(Other())
single.append(Other())
single.append(single)
<Single title="Foo">
  <Other boo="titi"/>
  <Other boo="titi"/>
  <Single title="Foo">
    <Other boo="titi"/>
    <Other boo="titi"/>
  </Single>
</Single>
| Method Summary | |
|---|---|
__init__(self,
          *args,
          **kw)
 | |
Two XMLObjects are equal if they have the same XML representation  | |
__eq__(self,
          other)
 | |
__getattr__(self,
          attrName)
 | |
__getitem__(self,
          attrName)
 | |
__ne__(self,
          other)
 | |
__str__(self)
 | |
Execute an action for each Node handled by an XMLObject.  | |
Build an XMLObject given its dict representation. (Class method)  | |
Feeding an XMLObject instance with XML string data. (Class method)  | |
Fetch a node value given its name.  | |
Basic Introspection  | |
getClassName(cls)
(Class method)  | |
Get all entities specified in the xmlobject:  | |
Fetch XMLObject's instance name which can be redefined by _name class attribute. (Class method)  | |
Sub-Nodes accessor  | |
Specific-Node accessor  | |
Accessing the parent Node instance.  | |
orderAttrs(self)
 | |
XMLObject remembers its children by a hash storage.  | |
Modify a node value given its name.  | |
setName(self,
          newName)
 | |
Setting the parent Node instance.  | |
Fetch an XMLObject instance's data in a hash mapped by Node name  | |
Exporting an XMLObject instance to XML.  | |
Building an XMLObject given its pendant DOM tree.  | |
Method executed after instance initialization (__init__).  | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name  | |
x.__getattribute__('name') <==> x.name  | |
x.__hash__() <==> hash(x)  | |
T.__new__(S, ...) -> a new object with type S, a subtype of T  | |
helper for pickle  | |
helper for pickle  | |
x.__repr__() <==> repr(x)  | |
x.__setattr__('name', value) <==> x.name = value  | |
| Class Variable Summary | |
|---|---|
str | 
__name__ = 'XMLObject'                                   
 | 
dict | 
__nodes__ = {'xmlProcessingInstruction': <EaseXML.Node.P...
 | 
dict | 
__ns_nodes__ = {}                                        
 | 
type | 
  __metaclass__ = EaseXML.main.MetaXMLObject | 
list | 
_attrsOrder = []                                         
 | 
list | 
_defaultEntities = [('&', '&'), ('<', '<'), ('>',...
 | 
NoneType | 
_dtd = None                                                                   | 
str | 
_encoding = 'utf-8'                                      
 | 
list | 
_entities = []                                           
 | 
list | 
_nodesOrder = []                                         
 | 
bool | 
_prettyPrint = True                                      
 | 
str | 
_registry = 'registryID'                                 
 | 
bool | 
_stripStrings = True                                     
 | 
bool | 
_unicodeOutput = True                                    
 | 
| Instance Method Details | 
|---|
  __cmp__(self,
          other)
    
Two XMLObjects are equal if they have the same XML representation   | 
  forEach(self, callableFunc, *args, **kw)Execute an action for each Node handled by an XMLObject. The head XML processing instruction is ignored. The
 
def myCallable(node, xmlObject, *args, **kw):
    # do some things with the node ?
    pass
node is the Node instance to apply user-defined action. xmlObject is the XMLObject instance handling this node. args and kw store the content of their homonyms in the forEach method prototype. Warning: This method can be very CPU-expensive if the XMLObject is deep (nested ListNodes and/or ChoiceNodes) because it make use of a recursion mechanism.  | 
  get(self, nodeName)Fetch a node value given its name. using directly (or implicitely)getattr is smarter.
This method is used by the MetaAttribute instances   | 
  getChildren(self)Basic Introspection Fetch XMLObject node names.  | 
  getEntities(self)Get all entities specified in the xmlobject: 
 This method merges the two entities lists.  | 
  getNodes(self)Sub-Nodes accessor Fetch XMLObject nodes. Return a hash. This method differs
from   | 
  getNodeWithName(self, nodeName)Specific-Node accessor Return a   | 
  getParentNode(self)Accessing the parent Node instance. Return a dummy Node() by default (see   | 
  orderNodes(self, nodesList=None)XMLObject remembers its children by a hash storage. Since hash sorting is not really friendly, this method returns two lists (nodeNames & nodes). | 
  set(self, nodeName, val)Modify a node value given its name. Same external behaviour assetattr
This method is used by the MetaAttribute instances   | 
  setParentNode(self, node)Setting the parent Node instance. When XMLObjects are stored in ChoiceNodes or in ListNodes, we need to keep track of their parent. This method is mainly used by back-storage {Mixed,Typed}List instances used respectively by ChoiceNodes and ListNodes.  | 
  toDict(self)Fetch an XMLObject instance's data in a hash mapped by Node name This method provides instant access to all data stored by an XMLObject instance.  | 
  toXml(self, headers=1, tabLength=2, prettyPrint=True)Exporting an XMLObject instance to XML. Optionnal keyword parameters are: 
 Return a string representing the XMLObject instance  | 
  _fromDom(self, dom)Building an XMLObject given its pendant DOM tree. | 
  _init(self)Method executed after instance initialization (__init__). End-user can override this as he would for __init__.  | 
| Class Method Details | 
|---|
  fromDict(cls, aDict)Build an XMLObject given its dict representation. | 
  fromXml(cls, xmlData)Feeding an XMLObject instance with XML string data. 
  | 
  getName(cls)Fetch XMLObject's instance name which can be redefined by _name class attribute. Space (' ') characters are replaced by underscores ('_') in returned result. | 
| Class Variable Details | 
|---|
__name__
  | 
__nodes__
  | 
__ns_nodes__
  | 
_attrsOrder
  | 
_defaultEntities
  | 
_dtd
  | 
_encoding
  | 
_entities
  | 
_nodesOrder
  | 
_prettyPrint
  | 
_registry
  | 
_stripStrings
  | 
_unicodeOutput
  | 
| Home | Trees | Index | Help | 
|---|
| Generated by Epydoc 2.1 on Sun Dec 12 17:20:24 2004 | http://epydoc.sf.net |