Ejemplo n.º 1
0
class IActionEvent(IEvent):
    timestamp = Attribute("Time at which action was induced.")
    actuator = Attribute("Agent/object responsible for causing event.")
    context = Attribute("Additional information provided by actuator.")

    def __init__(source, timestamp, actuator, context):
        """
Ejemplo n.º 2
0
class IStateEvent(IEvent):
    name = Attribute("""
        Name of this particular state.""")

    action = Attribute("""Reference to ActionEvent that caused state.""")

    def __init__(alarmevent, actionevent):
        """
            See individual attributes with same
            names for definition of parameters.
        """

    def tostring():
        """
            Return nicely formatted string description of
            this particular state change.
        """

    def get_alarm_event():
        """
            Return reference to AlarmEvent of which
            this is a state.
        """

    def __call__(self, actionevent):
        """
Ejemplo n.º 3
0
class ISecurityService(Interface):
    """
        Interface defining those security-related attributes that
        may be retreived from any of the security services.
    """

    security_manager = Attribute("""
            Read-only reference to Security Manager, the primary manager
            under which all other security services/managers are located.
        """)

    user_manager = Attribute("""
            Read-only reference to User Manager service, this is typically
            the "Users" child of the security manager.
        """)

    role_manager = Attribute("""
            Read-only reference to Roel Manager service, this is typically
            the "Roles" child of the security manager.
        """)

    policy_manager = Attribute("""
            Read-only reference to Policy Manager service, this is typically
            the "Policies" child of the security manager.
        """)
Ejemplo n.º 4
0
class IAlarmExporter(Interface):
    """
        Instances catch events from specific alarms and exports
        a string representation of those events using the assigned
        formatter to determine the formatting of the payload, and the
        assigned transporter to actually transfer the payload.

        Any number of alarms may be exported by this exporter.
    """

    name = Attribute("""
        Named used by alarms to identify exporter.
    """)

    description = Attribute("""
        Brief description of exporter to assist configuration.
    """)

    alarms = Attribute("""
        Dictionary of alarm objects being exported by this exporter,
        and the dispatcher subscription for catching that event.
    """)

    def add_alarm(alarm):
        """
            Add alarm 'alarm' to list of alarms whose
            events will be exported by this exporter.
        """

    def remove_alarm(alarm):
        """
            Remove alarm 'alarm' from list of alarms to be
            exported by this exporter.
        """

    def export(event):
        """
            Export data associated with alarm event 'event.'
        """

    def get_formatter():
        """
            Return reference to this exporter's formatter.
        """

    def get_transporter():
        """
            Return reference to this exporter's transporter.
        """

    def set_formatter(formatter):
        """
            Set formatter for this exporter.  Note, previous
            formatter will be deleted if one is already configured.
        """

    def set_transporter(transporter):
        """
Ejemplo n.º 5
0
class IUserEvent(IEvent):
    user = Attribute(
        """
            Reference to User node which raised the Event.
        """)

    description = Attribute(
        """
            Short description of event.  For example, 'role change',
            'password change', 'name change', 'user configured'.
        """)
Ejemplo n.º 6
0
class IEvent(Interface):
    LOCALORIGIN = Attribute("""
        Required reference to event producer.  Class attr.""")

    EVENTS = Attribute("""
        WeakValueDictionary of all existing events by GUID.  Class attr.""")

    GUID = Attribute("""
        Every event instance has a unique GUID.  Instance attr.""")

    origin = Attribute("""
        String indicating IP addr of this event's origin.  Instance attr.""")

    source = Attribute("""
        Reference to object which instanciated
        this event.  Instance attr.""")

    def get_event(guid):
        """
            Find Event, regardless of its type, with GUID
            'guid' and return its reference.

            NOTE: This is a static method and may be invoked
            on any Event class, subclass, or instance thereof
            with the same result.
        """

    def __init__(source, origin=None, guid=None):
        """
            Initialize event with source 'source'.

            - If 'origin' is provided it is expected to be a string
            and will be used as this event's 'origin' attribute.
            - If it is not provided, and the event's source itself
            does have an 'origin' attribute, the event's 'origin'
            will default to its source's origin.
            - If it is not provided and the source does not have an
            'origin' attribute, then the origin will default to
            the class's LOCALORIGIN.

            If 'guid' is provided it will be used as the event's
            GUID; if no 'guid' is specified one will be automatically
            generated.  Either way the GUID used must be unique
            and a ValueError will be thrown if it is not.
        """

    def get_guid():
        """
            Return value of this event's GUID attribute.
        """

    def is_local():
        """
Ejemplo n.º 7
0
class INodeSpace(Interface):
    nodetree = Attribute("""
        Copy of entire nodetree.  Retrieving this attribute
        may require considerable computing, depending upon the
        size of the node tree; usage should be reserved for
        rare and unique situations.""")

    url = Attribute("""Base URL for entire node space tree""")
    root = Attribute("""Reference to this space's root node.""")

    def as_node(path):
        """
            Return the PublicInterface of referenced path.
        """

    def as_node_collection(paths):
        """
            Return collection of referenced paths.
        """

    def as_internal_node(path):
        """
            Return the actual node of referenced path.
        """

    def as_node_url(node):
        """
            Return URL of node 'node.'
        """

    def as_node_url_collection(node):
        """
            Return collection of URLs.
        """

    def create_node(factory):
        """
            Use factory 'factory' to intantiate
            a node whose 'namespace' will be set to
            this namespace object, and return new node.
        """

    def add_node(node, url=None):
        """
            Add node 'node' to this Neodespace's nodetree using
            url 'url,' or node.url if argument is None.
        """

    def remove_node(node, url=None):
        """
Ejemplo n.º 8
0
class IUserManager(ISimpleManager):
    """
        Manages collection of User objects and provides
        shortcut functions for convenience.  Primarily
        serves as marker interface.
    """

    anonymous = Attribute(
        """
            Read-only reference to special user "Anonymous", which is
            User object associated with unidentified users.
        """)

    sysadmin = Attribute(
        """
            Read-only reference to special user "System Administrator";
            this user will be given all permissions dynamically during
            permission queries.
        """)

    def get_users():
        """
            Return list of user objects.
        """

    def get_user(name):
        """
            Return user node with name 'name'.
        """

    def get_user_names():
        """
            Return list of user names.
        """

    def has_user(username):
        """
            Returns True if user with username 'username'
            exists, False otherwise.
        """

    def user_from_object(userobject):
        """
            Function to bridge existing User Manager and User objects
            as defined in mpx.lib.user.User with the Users defined here.
        """

    def user_from_current_thread():
        """
Ejemplo n.º 9
0
class IPolicy(Interface):
    context = Attribute("""
            Node URL at where Policy is applicable.  This policy
            will be applied to all nodes at URL 'context' and below,
            unless overridden by another policy in a lower context.
        """)

    acquires = Attribute("""
            Boolean flag indicating whether this policy inherits all
            policy assertions already in place at this location, or
            if it replaces all existing assertions altogether.
        """)

    rolemap = Attribute("""
            Dictionary mapping roles to permissions.  Key
            is name of role, value is list of permissions granted
            to role.
        """)

    def is_running():
        """
            Returns boolean indication of whether node has
            been successfully started and not stopped since.
        """

    def is_removable():
        """
            Return boolean indicator as to whether node may be pruned.
        """

    def is_configurable():
        """
            Return boolean indicator as to whether node may be (re)configured.
        """

    def get_permissions(role):
        """
            Return list of permissions that have been granted to role
            'role' by this Policy.
        """

    def set_permissions(role, *permissions):
        """
            Allows permissions for single role to be set at a time,
            same functionality is available through configuration dictionary.
        """

    def rank_match(context):
        """
Ejemplo n.º 10
0
class ISecurityContext(Interface):
    """
        Interface implemented by an object which may act as a
        security conetxt, meaning security policies may be
        associated with the instance itself.
    """
    url = Attribute("""
        String instance indicating the context with
        which a policy may be associated.""")
Ejemplo n.º 11
0
class IGUIDMarked(Interface):
    GUID = Attribute(
        """
            GUID identifying this object.  This attribute may 
            only be set once, after which point it becomes a 
            read-only attribute.  Although GUID may be an instance 
            of a user-defined object, attribute accessor will convert 
            to string value before returning.
        """)
Ejemplo n.º 12
0
class ITrigger(Interface):
    state = Attribute("""
        EnumeratedValue instance that is currently this trigger's state.
    """)
    targets = Attribute("""
        List of Alarm nodes which are registered to be triggered and cleared
        by this trigger.
    """)

    def is_active():
        """
            Boolean indicator with value true if this trigger is currently
            True and false otherwise.
        """

    def is_running():
        """
            Returns true if Trigger has been started; false otherwise.
        """

    def get_state():
        """
            Return state attribute.
        """

    def __call__():
        """
            Perform evaluation of trigger condition, and generate
            TriggerActivated/TriggerCleared events in manager
            if state has changed.
        """

    def add_target(target):
        """
            Append target 'target' to list of targets for this trigger.
        """

    def remove_target(target):
        """
            If target 'target' is in targets, remove it.
        """

    def get_targets():
        """
Ejemplo n.º 13
0
class IChildNode(INode):
    """
        Adds attributes and method associated
        with being a child of a parent to the
        INode Interface.
    """

    parent = Attribute('Reference to node parent.')

    def prune():
        """
Ejemplo n.º 14
0
class INode(ISecurityContext):
    """
        Objects with these attributes make
        mpx.lib.node.is_node(object) == True
    """

    name = Attribute('Node name.')
    nodespace = Attribute('Reference to owning nodepsace object.')
    # Although ISecurityContext already specified this attr,
    #   it is respecified here because it's critical nature and
    #   additional meaning.
    url = Attribute("""
        Meant to be implemted as a property so that
        the url can be built rather than stored.
        Since INode's have a 'parent' attribute
        and a 'name,' they too have a 'url'""")

    absolute_url = Attribute("""Adds node space location to 'url'""")

    def get_nodespace():
        """
Ejemplo n.º 15
0
class ICloudEvent(Interface):
    topics = Attribute(
        """
            The list of event topic under which this
            CloudEvent's event should be notified.
        """)
    event = Attribute(
        """
            The Event instance the CloudEvent wraps.
        """
    )
    targets = Attribute(
        """
            A list of targets to which this event is currently being sent.
        """
    )
    portal = Attribute(
        """
            A portal to which this event is currently being sent.
        """
    )
Ejemplo n.º 16
0
class IRoleManager(ISimpleManager):
    """
        Manages collection of Role objects and provides
        shortcut functions for convenience.  Primarily
        serves as marker interface.
    """

    unknown = Attribute("""
            Read-only reference to special role "Unknown", which is role
            meant to be assigned to unauthenticated users.
        """)

    authenticated = Attribute("""
            Read-only referent to special role "Authenticated", which role
            meant to be assigned to all identified and authenticated users.
        """)

    administrator = Attribute("""
            Read-only reference to special role "System Administrator", this
            reference may be used by policies to determine whether all
            permissions should be granted to a role.
        """)

    def get_roles():
        """
            Return list of role objects.
        """

    def get_role(name):
        """
            Return role node with name 'name'.
        """

    def get_role_names():
        """
            Return list of role names.
        """

    def has_role(rolename):
        """
Ejemplo n.º 17
0
class INode(Interface):
    name = Attribute("")
    parent = Attribute("")

    def as_node(path):
        """
        """

    def as_internal_node(path):
        """
        """

    def as_node_url(node):
        """
        """

    def prune(force=False):
        """
        """

    def is_pruned():
        """
Ejemplo n.º 18
0
class IConfigurable(Interface):
    debug = Attribute("")

    def configure(config):
        """
        """

    def configuration():
        """
        """

    def is_configured():
        """
Ejemplo n.º 19
0
class ITemplate(Interface):
    """
        Object accepts IStorageField object and 
        applies formatting specified by template 
        file, such as HTML source file.
        
        Object constructor takes string argument 
        that may be: path to template content file, 
        or a string containing the template data itself.
        
        The constructor checks to see if the argument 
        specifies a path of an existing file.  If so, it 
        reads the contents of the specified file and uses 
        that as the template source; if not it uses the 
        parameter directly as the template.
        
        Optional argument specifying that argument is meant 
        to be a file path, and therefore an exception should 
        be raised if file does not exist.
        
        Templates take strings containing identifiers delimited 
        by '$identifier' or ${identifier}.  Both delimiters 
        have essentially the same meaning, however the second 
        identifier can be used in places where identifier is 
        otherwise interpolated into non-delimited string.  For example:
            
            - "Hello $name, how are you?", or
            -  "It is a nice ${prefix}day." 
        
        Use "$$" to include literal $ in template output text.
        
        See string.Template for additional documentation.
    """

    template = Attribute("""Data being used as template data""")

    def substitute(mapping, **kws):
        """
            Performs the template substitution, returning a new string. 
            'mapping' is any dictionary-like object with keys that match 
            the placeholders in the template. 
            
            Alternatively, you can provide keyword arguments, where the 
            keywords are the placeholders. 
            
            When both mapping and kws are given and there are duplicates, 
            the placeholders from kws take precedence.
        """

    def safe_substitute(mapping, **kws):
        """
Ejemplo n.º 20
0
class IDomNodeList(Interface):
    """
        A NodeList represents a sequence of nodes. These objects are used in 
        two ways in the DOM Core recommendation: the Element objects provides 
        one as its list of child nodes, and the getElementsByTagName() and 
        getElementsByTagNameNS() methods of Node return objects with this 
        interface to represent query results.
        
        The DOM Level 2 recommendation defines one method and one 
        attribute for these objects.
    """

    length = Attribute("""
            The number of nodes in the sequence.
        """)

    def item(index):
        """
            Return the i'th item from the sequence, if there is one, or None. 
            The index i is not allowed to be less then zero or greater 
            than or equal to the length of the sequence.
        """

    def __getitem__(index):
        """
            In addition, the Python DOM interface requires that some 
            additional support is provided to allow NodeList objects 
            to be used as Python sequences. All NodeList implementations 
            must include support for __len__() and __getitem__(); 
            this allows iteration over the NodeList in for statements 
            and proper support for the len() built-in function.
        """

    def __len__():
        """
            See __getitem__.
        """

    def __setitem__(index, value):
        """
            If a DOM implementation supports modification of the document, 
            the NodeList implementation must also support the 
            __setitem__() and __delitem__() methods.
        """

    def __delitem__(index):
        """
Ejemplo n.º 21
0
class IEnableAble(Interface):
    enabled = Attribute("""
        Boolean flag indicating whether runnable object
        is currently enabled or disabled.""")

    def enable():
        """
            Enabled Runnable object.
        """

    def disable():
        """
            Disable Runnable object.
        """

    def is_enabled():
        """
Ejemplo n.º 22
0
class IRunnable(Interface):
    enabled = Attribute("")

    def start():
        """
        """

    def stop():
        """
        """

    def is_enabled():
        """
        """

    def is_running():
        """
Ejemplo n.º 23
0
class IUniquelyIdentified(Interface):
    """
        Interface provided by objects which can be identified
        by a GUID.
    """
    identifier = Attribute("""GUID identifying this object.""")

    def get_identifier(obj, default = None, create = False):
        """
            NOTE: Static
            Static method to quickly retreive identifier stored
            on object 'obj' without needing to instantiate and
            operate on an adapter.

            If 'create' is True and object 'obj' does not
            already have an identifier, create one and return.
        """

    def get_identified(uuid, default = None):
        """
Ejemplo n.º 24
0
class IPolicyManager(ISimpleManager):
    """
        Manages collection of policy objects and provides
        functions simplifying the lookup of important information
        but requiring data from groups of policies.
    """

    default = Attribute("""
            Read-only reference to special policy "Default", which is policy
            that "always" exists and establishes base mappings.
        """)

    def get_permissions():
        """
            Return list of available permissions as listed in
            permissions repository module.

            NOTE: This is a static method, so can be called by
            class or instance reference with same results.
        """

    def get_policy(name):
        """
            Return policy node with name 'name'.
        """

    def has_policy(name):
        """
            Test whether policy named 'name' exists.  Return
            True if it does, false otherwise.
        """

    def get_policies():
        """
            Return list of policy nodes.
        """

    def get_context_policies(context, ascending=True):
        """
Ejemplo n.º 25
0
class ICounter(Interface):
    """
        General purpose counter uses long integer to prevent 
        overflows and provides increment and decrement interface.
    """
    value = Attribute('Read Only value of counter')
    def increment(delta = 0):
        """
            Alias for post_increment.
        """
    def decrement(delta = 0):
        """
            Alias for post_decrement.
        """
    def post_increment(delta = 0):
        """
            Increment counter value by absolute value of 
            delta.  Return counter value previous to operation.
        """
    def post_decrement(delta = 0):
        """
            Decrement counter value by absolute value of 
            delta.  Return counter value previous to operation.            
        """
    def pre_increment(delta = 0):
        """
            Increment counter value by absolute value of 
            delta.  Return new counter value.
        """
    def pre_decrement(delta = 0):
        """
            Decrement counter value by absolute value of 
            delta.  Return new counter value.
        """
    def reset():
        """
Ejemplo n.º 26
0
class IFaultEvent(IEvent):
    title = Attribute('')
    faulttype = Attribute('')
    timestamp = Attribute('')
    description = Attribute('')
Ejemplo n.º 27
0
class IPersistenceManager(Interface):
    """
        Manages persistence mechanism.  Coordinates set 
        of pluggable components to build full-fledged 
        persistence mechanism.
    """
    storage = Attribute("""
        Reference to manager's IStorage provider.""")
    policy = Attribute("""
        Referene to manager's default IStoragePolicy provider.""")
    policies = Attribute("""
        Reference to list of policies in use by manager.""")
    cache = Attribute("""
        Reference to manager's object cache.""")
    writer_factory = Attribute("""
        Reference to manager's object writer factory""")
    reader_factory = Attribute("""
        Reference to manager's object reader factory.""")
    
    def get_storage():
        """
            Return current IStorage instance.
        """
    
    def get_policy():
        """
            Return default IPolicy instance.
        """
    
    def get_policies():
        """
            Return list of policies.
        """
    
    def get_cache():
        """
            Return current object cache.
        """
    
    def get_reader_factory():
        """
            Return current object reader factory.
        """
    
    def get_writer_factory():
        """
            Return current object writer factory.
        """
    
    def set_storage(storage):
        """
            Set current IStorage instance.
        """
    
    def add_policy(policy):
        """
            Set current IPolicy instance.
        """
    
    def remove_policy(policy):
        """
            Remove policy 'policy' if it exists.
        """
    
    def set_reader_factory(factory):
        """
            Set current factory for IObjectReader providing instances.
        """
    
    def set_writer_factory(factory):
        """
            Set current factory for IObjectWriter providing instances.
        """
    
    def new_oid():
        """
            Return unused OID value.  Generally delegates this 
            to storage instance's generate_oid method.
        """
    
    def get_object(oid):
        """
            Return object identified by OID 'oid'.
            
            Note: this method is meant to be called by clients 
            of the manager object; load is called internally.  The 
            object returned by this call may be a deferred type object 
            if the object does not yet exist in cache.
        """
    
    def get_oid(instance):
        """
            Return OID of object 'instance.'  Raise TypeError 
            if instance does not provide IPeristent.
            
            If no default value is provided, raise TypeError if 
            instance has no OID, otherwise, return default.  Note, 
            None may be provided as default.
        """
    
    def load(oid):
        """
            Return object with OID 'oid'.
        """
    
    def store(instance):
        """
            Add instance 'instance' to storage for persistent 
            storage from this point forward.
        """
    
    def note_modified(instance):
        """
            Notify policy of modified instance.
        """
    
    def make_persistent(instance):
        """
            Mark object 'instance' as persistent and track as modified.
        """
    
    def make_persistent_type(klass):
        """
            Mark class as persistent, thereby making all instances of 
            that class, and sub-classes, persistent.
        """
    
    def make_transient(instance):
        """
            Mark object 'instance' as transient and stop tracking.
        """
    
    def commit_changes():
        """
            Delegate to policy to commit modifications track since 
            last commit.
        """
    
    def commit_storage():
        """
            Cause storage to commit all pending changes to physical storage.
        """
    
    def commit():
        """
            Commit changes and store them.
        """
    
    def terminate():
        """
Ejemplo n.º 28
0
class IDomNode(Interface):
    """
        All of the components of an XML document are subclasses of Node.
    """

    nodeType = Attribute("""
            An integer representing the node type. Symbolic constants for 
            the types are on the Node object: ELEMENT_NODE, ATTRIBUTE_NODE, 
            TEXT_NODE, CDATA_SECTION_NODE, ENTITY_NODE, 
            PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE, 
            DOCUMENT_TYPE_NODE, NOTATION_NODE. This is a read-only attribute.
        """)

    nodeClass = Attribute("""
            Reference to actual node class object.
        """)

    nodeClassName = Attribute("""
            Fully-qualified class name; dot-separated.
        """)

    nodeID = Attribute("""
            Full Node URL.
        """)

    parentNode = Attribute("""
            The parent of the current node, or None for the document node. 
            The value is always a Node object or None. For Element nodes, 
            this will be the parent element, except for the root element, 
            in which case it will be the Document object. For Attr nodes, 
            this is always None. This is a read-only attribute.
        """)

    attributes = Attribute("""
            A NamedNodeMap of attribute objects. Only elements have actual 
            values for this; others provide None for this attribute. 
            This is a read-only attribute.
        """)

    previousSibling = Attribute("""
            The node that immediately precedes this one with the same parent. 
            For instance the element with an end-tag that comes just before 
            the self element's start-tag. Of course, XML documents are made 
            up of more than just elements so the previous sibling could be 
            text, a comment, or something else. If this node is the first 
            child of the parent, this attribute will be None. 
            This is a read-only attribute.
        """)

    nextSibling = Attribute("""
            The node that immediately follows this one with the same parent. 
            See also previousSibling. If this is the last child of the parent, 
            this attribute will be None. This is a read-only attribute.
        """)

    childNodes = Attribute("""
            A list of nodes contained within this node. 
            This is a read-only attribute.
        """)

    firstChild = Attribute("""
            The first child of the node, if there are any, or None. 
            This is a read-only attribute.
        """)

    lastChild = Attribute("""
            The last child of the node, if there are any, or None. 
            This is a read-only attribute.
        """)

    localName = Attribute("""
            The part of the tagName following the colon if there is one, 
            else the entire tagName. The value is a string.
        """)

    prefix = Attribute("""
            The part of the tagName preceding the colon if there is one, 
            else the empty string. The value is a string, or None
        """)

    namespaceURI = Attribute("""
            The namespace associated with the element name. This will be a 
            string or None. This is a read-only attribute.
        """)

    nodeName = Attribute("""
            This has a different meaning for each node type; see the DOM 
            specification for details. You can always get the information 
            you would get here from another property such as the tagName 
            property for elements or the name property for attributes. 
            For all node types, the value of this attribute will be 
            either a string or None. This is a read-only attribute.
        """)

    nodeValue = Attribute("""
            This has a different meaning for each node type; see the DOM 
            specification for details. The situation is similar to 
            that with nodeName. The value is a string or None.
        """)

    def hasAttributes():
        """
            Returns true if the node has any attributes.
        """

    def hasChildNodes():
        """
            Returns true if the node has any child nodes.
        """

    def isSameNode(other):
        """
            Returns true if other refers to the same node as this node. 
            This is especially useful for DOM implementations which use 
            any sort of proxy architecture, because more than one 
            object can refer to the same node.
            
            Note: This is based on a proposed DOM Level 3 API which is still 
            in the ``working draft'' stage, but this particular interface 
            appears uncontroversial. Changes from the W3C will not necessarily 
            affect this method in the Python DOM interface 
            (though any new W3C API for this would also be supported).
        """

    def appendChild(newChild):
        """
            Add a new child node to this node at the end of the 
            list of children, returning newChild.
        """

    def insertBefore(newChild, refChild):
        """
            Insert a new child node before an existing child. It must be the 
            case that refChild is a child of this node; if not, ValueError is 
            raised. newChild is returned. If refChild is None, it inserts 
            newChild at the end of the children's list.
        """

    def removeChild(oldChild):
        """
            Remove a child node. oldChild must be a child of this node; 
            if not, ValueError is raised. oldChild is returned on success. 
            If oldChild will not be used further, its unlink() 
            method should be called.
        """

    def replaceChild(newChild, oldChild):
        """
            Replace an existing node with a new node. It must be the case 
            that oldChild is a child of this node; if not, 
            ValueError is raised.
        """

    def normalize():
        """
            Join adjacent text nodes so that all stretches of text are stored 
            as single Text instances. This simplifies processing text from a 
            DOM tree for many applications. New in version 2.1.
        """

    def cloneNode(deep):
        """
Ejemplo n.º 29
0
class IDomDocument(IDomNode):
    """
        A Document represents an entire XML document, including its 
        constituent elements, attributes, processing instructions, 
        comments etc. Remeber that it inherits properties from Node.
    """

    documentElement = Attribute("""
            The one and only root element of the document.
        """)

    def createElement(tagName):
        """
            Create and return a new element node. The element is not 
            inserted into the document when it is created. You need to 
            explicitly insert it with one of the other methods such 
            as insertBefore() or appendChild().
        """

    def createElementNS(namespaceURI, tagName):
        """
            Create and return a new element with a namespace. The tagName 
            may have a prefix. The element is not inserted into the document 
            when it is created. You need to explicitly insert it with one of 
            the other methods such as insertBefore() or appendChild().
        """

    def createTextNode(data):
        """
            Create and return a text node containing the data passed as a 
            parameter. As with the other creation methods, this one does 
            not insert the node into the tree.
        """

    def createComment(data):
        """
            Create and return a comment node containing the data passed as 
            a parameter. As with the other creation methods, this one does 
            not insert the node into the tree.
        """

    def createProcessingInstruction(target, data):
        """
            Create and return a processing instruction node containing the 
            target and data passed as parameters. As with the other creation 
            methods, this one does not insert the node into the tree.
        """

    def createAttribute(name):
        """
            Create and return an attribute node. This method does not 
            associate the attribute node with any particular element. 
            You must use setAttributeNode() on the appropriate Element 
            object to use the newly created attribute instance.
        """

    def createAttributeNS(namespaceURI, qualifiedName):
        """
            Create and return an attribute node with a namespace. 
            The tagName may have a prefix. This method does not associate 
            the attribute node with any particular element. You must use 
            setAttributeNode() on the appropriate Element object to use 
            the newly created attribute instance.
        """

    def getElementsByTagName(tagName):
        """
            Search for all descendants: direct children, children's children, 
            etc., with a particular element type name.
        """

    def getElementsByTagNameNS(namespaceURI, localName):
        """
Ejemplo n.º 30
0
class IDomElement(IDomNode):
    """
        Element is a subclass of Node, so inherits all 
        the attributes of that class.
    """

    tagName = Attribute("""
            The element type name. In a namespace-using document it may have 
            colons in it. The value is a string.
        """)

    def getElementsByTagName(tagName):
        """
            Same as equivalent method in the Document class.
        """

    def getElementsByTagNameNS(namespaceURI, tagName):
        """
            Same as equivalent method in the Document class.
        """

    def hasAttribute(name):
        """
            Returns true if the element has an attribute named by name.
        """

    def hasAttributeNS(namespaceURI, localName):
        """
            Returns true if the element has an attribute named by 
            namespaceURI and localName.
        """

    def getAttribute(name):
        """
            Return the value of the attribute named by name as a string. 
            If no such attribute exists, an empty string is returned, 
            as if the attribute had no value.
        """

    def getAttributeNode(attrname):
        """
            Return the Attr node for the attribute named by attrname.
        """

    def getAttributeNS(namespaceURI, localName):
        """
            Return the value of the attribute named by namespaceURI 
            and localName as a string. If no such attribute exists, 
            an empty string is returned, as if the attribute had no value.
        """

    def getAttributeNodeNS(namespaceURI, localName):
        """
            Return an attribute value as a node, given a 
            namespaceURI and localName.
        """

    def removeAttribute(name):
        """
            Remove an attribute by name. No exception is raised if there 
            is no matching attribute.
        """

    def removeAttributeNode(oldAttr):
        """
            Remove and return oldAttr from the attribute list, if present. 
            If oldAttr is not present, NotFoundErr is raised.
        """

    def removeAttributeNS(namespaceURI, localName):
        """
            Remove an attribute by name. Note that it uses a localName, 
            not a qname. No exception is raised if there is no 
            matching attribute.
        """

    def setAttribute(name, value):
        """
            Set an attribute value from a string.
        """

    def setAttributeNode(newAttr):
        """
            Add a new attribute node to the element, replacing an existing 
            attribute if necessary if the name attribute matches. If a 
            replacement occurs, the old attribute node will be returned. 
            If newAttr is already in use, InuseAttributeErr will be raised.
        """

    def setAttributeNodeNS(newAttr):
        """
            Add a new attribute node to the element, replacing an existing 
            attribute if necessary if the namespaceURI and localName 
            attributes match. If a replacement occurs, the old attribute 
            node will be returned. If newAttr is already in use, 
            InuseAttributeErr will be raised.
        """

    def setAttributeNS(namespaceURI, qname, value):
        """