Package suds :: Package sax :: Module attribute :: Class Attribute
[hide private]
[frames] | no frames]

Class Attribute

source code

An XML attribute object.

Instance Methods [hide private]
 
__init__(self, name, value=None) source code
Attribute
clone(self, parent=None)
Clone this object.
source code
basestring
qname(self)
Get the fully qualified name of this attribute
source code
Attribute
setValue(self, value)
Set the attributes value
source code
Text
getValue(self, default=)
Get the attributes value with optional default.
source code
boolean
hasText(self)
Get whether the attribute has text and that it is not an empty (zero length) string.
source code
(prefix, name)
namespace(self)
Get the attributes namespace.
source code
(prefix, name)
resolvePrefix(self, prefix)
Resolve the specified prefix to a known namespace.
source code
boolean
match(self, name=None, ns=None)
Match by (optional) name and/or (optional) namespace.
source code
 
__eq__(self, rhs)
equals operator
source code
 
__repr__(self)
get a string representation
source code
 
__str__(self)
get an xml string representation
source code
 
__unicode__(self)
get an xml string representation
source code
Instance Variables [hide private]
basestring name
The unqualified name of the attribute
element.Element parent
The node containing this attribute
basestring prefix
The optional namespace prefix.
basestring value
The attribute's value
Method Details [hide private]

__init__(self, name, value=None)
(Constructor)

source code 
Parameters:
  • name (basestring) - The attribute's name with optional namespace prefix.
  • value (basestring) - The attribute's value

clone(self, parent=None)

source code 

Clone this object.

Parameters:
Returns: Attribute
A copy of this object assigned to the new parent.

qname(self)

source code 

Get the fully qualified name of this attribute

Returns: basestring
The fully qualified name.

setValue(self, value)

source code 

Set the attributes value

Parameters:
  • value (basestring) - The new value (may be None)
Returns: Attribute
self

getValue(self, default=)

source code 

Get the attributes value with optional default.

Parameters:
  • default (basestring) - An optional value to be return when the attribute's has not been set.
Returns: Text
The attribute's value, or default

hasText(self)

source code 

Get whether the attribute has text and that it is not an empty (zero length) string.

Returns: boolean
True when has text.

namespace(self)

source code 

Get the attributes namespace. This may either be the namespace defined by an optional prefix, or its parent's namespace.

Returns: (prefix, name)
The attribute's namespace

resolvePrefix(self, prefix)

source code 

Resolve the specified prefix to a known namespace.

Parameters:
  • prefix (basestring) - A declared prefix
Returns: (prefix, name)
The namespace that has been mapped to prefix

match(self, name=None, ns=None)

source code 

Match by (optional) name and/or (optional) namespace.

Parameters:
  • name (str) - The optional attribute tag name.
  • ns ((prefix, name)) - An optional namespace.
Returns: boolean
True if matched.