libSBML 5.3.0 Python API

libsbml.XMLAttributes Class Reference

List of all members.


Detailed Description

Representation of attributes on an XML node.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

Public Member Functions

def add
def clear
def clone
def getIndex
def getLength
def getName
def getNumAttributes
def getPrefix
def getPrefixedName
def getURI
def getValue
def hasAttribute
def isEmpty
def remove
def removeResource

Member Function Documentation

def libsbml.XMLAttributes.add (   self,
  args 
)

Python method signature(s):

add(string name, string value, string namespaceURI = "", 
    string prefix = "")    int
add(string name, string value, string namespaceURI = "")    int
add(string name, string value)    int
add(XMLTriple triple, string value)    int

This method has multiple variants that differ in the arguments they accept. Each is described separately below.


Method variant with the following signature:

add( XMLTriple triple, string value)

Adds an attribute with the given XMLTriple/value pair to this XMLAttributes set.

Note:
if local name with the same namespace URI already exists in this attribute set, its value and prefix will be replaced.
Parameters:
triple an XMLTriple, the XML triple of the attribute.
value a string, the value of the attribute.
Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:
Method variant with the following signature:
add(  string name , string value , string namespaceURI = '' , string prefix = '')

Adds an attribute (a name/value pair) to this XMLAttributes object, optionally with a prefix and URI defining a namespace.

Parameters:
name a string, the local name of the attribute.
value a string, the value of the attribute.
namespaceURI a string, the namespace URI of the attribute.
prefix a string, the prefix of the namespace
Returns:
an integer code indicating the success or failure of the function. The possible values returned by this function are:
Note:
if local name with the same namespace URI already exists in this attribute set, its value and prefix will be replaced.
Documentation note:
The native C++ implementation of this method defines a default argument value. In the documentation generated for different libSBML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java and C#, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libSBML documentation will be identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.
def libsbml.XMLAttributes.clear (   self  ) 

Python method signature(s):

clear()    int

Clears (deletes) all attributes in this XMLAttributes object.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.XMLAttributes.clone (   self  ) 

Python method signature(s):

clone()    XMLAttributes

Creates and returns a deep copy of this XMLAttributes set.

Returns:
a (deep) copy of this XMLAttributes set.
def libsbml.XMLAttributes.getIndex (   self,
  args 
)

Python method signature(s):

getIndex(string name)    int
getIndex(string name, string uri)    int
getIndex(XMLTriple triple)    int

This method has multiple variants that differ in the arguments they accept. Each is described separately below.


Method variant with the following signature:

getIndex(XMLTriple triple)

Return the index of an attribute with the given XMLTriple.

Parameters:
triple an XMLTriple, the XML triple of the attribute for which the index is required.
Returns:
the index of an attribute with the given XMLTriple, or -1 if not present.

Method variant with the following signature:

getIndex(string name, string uri)

Return the index of an attribute with the given local name and namespace URI.

Parameters:
name a string, the local name of the attribute.
uri a string, the namespace URI of the attribute.
Returns:
the index of an attribute with the given local name and namespace URI, or -1 if not present.

Method variant with the following signature:

getIndex(string name)

Return the index of an attribute with the given name.

Note:
A namespace bound to the name is not checked by this function. Thus, if there are multiple attributes with the given local name and different namespaces, the smallest index among those attributes will be returned. XMLAttributes.getIndex() or XMLAttributes.getIndex() should be used to get an index of an attribute with the given local name and namespace.
Parameters:
name a string, the local name of the attribute for which the index is required.
Returns:
the index of an attribute with the given local name, or -1 if not present.
def libsbml.XMLAttributes.getLength (   self  ) 

Python method signature(s):

getLength()    int

Return the number of attributes in the set.

Returns:
the number of attributes in this XMLAttributes set.
def libsbml.XMLAttributes.getName (   self,
  args 
)

Python method signature(s):

getName(int index)    string

Return the local name of an attribute in this XMLAttributes set (by position).

Parameters:
index an integer, the position of the attribute whose local name is required.
Returns:
the local name of an attribute in this list (by position).
Note:
If index is out of range, an empty string will be returned. Use XMLAttributes.hasAttribute() to test for the attribute existence.
def libsbml.XMLAttributes.getNumAttributes (   self  ) 

Python method signature(s):

getNumAttributes()    int

Return the number of attributes in the set.

Returns:
the number of attributes in this XMLAttributes set.

This function is an alias for getLength introduced for consistency with other XML classes.

def libsbml.XMLAttributes.getPrefix (   self,
  args 
)

Python method signature(s):

getPrefix(int index)    string

Return the prefix of an attribute in this XMLAttributes set (by position).

Parameters:
index an integer, the position of the attribute whose prefix is required.
Returns:
the namespace prefix of an attribute in this list (by position).
Note:
If index is out of range, an empty string will be returned. Use XMLAttributes.hasAttribute() to test for the attribute existence.
def libsbml.XMLAttributes.getPrefixedName (   self,
  args 
)

Python method signature(s):

getPrefixedName(int index)    string

Return the prefixed name of an attribute in this XMLAttributes set (by position).

Parameters:
index an integer, the position of the attribute whose prefixed name is required.
Returns:
the prefixed name of an attribute in this list (by position).
Note:
If index is out of range, an empty string will be returned. Use XMLAttributes.hasAttribute() to test for attribute existence.
def libsbml.XMLAttributes.getURI (   self,
  args 
)

Python method signature(s):

getURI(int index)    string

Return the namespace URI of an attribute in this XMLAttributes set (by position).

Parameters:
index an integer, the position of the attribute whose namespace URI is required.
Returns:
the namespace URI of an attribute in this list (by position).
Note:
If index is out of range, an empty string will be returned. Use XMLAttributes.hasAttribute() to test for attribute existence.
def libsbml.XMLAttributes.getValue (   self,
  args 
)

Python method signature(s):

getValue(int index)    string
getValue(string name)    string
getValue(string name, string uri)    string
getValue(XMLTriple triple)    string

This method has multiple variants that differ in the arguments they accept. Each is described separately below.


Method variant with the following signature:

getValue(XMLTriple triple)

Return a value of an attribute with the given XMLTriple.

Parameters:
triple an XMLTriple, the XML triple of the attribute whose value is required.
Returns:
The attribute value as a string.
Note:
If an attribute with the given XMLTriple does not exist, an empty string will be returned. Use XMLAttributes.hasAttribute() to test for attribute existence.

Method variant with the following signature:

getValue(int index)

Return the value of an attribute in this XMLAttributes set (by position).

Parameters:
index an integer, the position of the attribute whose value is required.
Returns:
the value of an attribute in the list (by position).
Note:
If index is out of range, an empty string will be returned. Use XMLAttributes.hasAttribute() to test for attribute existence.

Method variant with the following signature:

getValue(string name)

Return an attribute's value by name.

Parameters:
name a string, the local name of the attribute whose value is required.
Returns:
The attribute value as a string.
Note:
If an attribute with the given local name does not exist, an empty string will be returned. Use XMLAttributes.hasAttribute() const to test for attribute existence. A namespace bound to the local name is not checked by this function. Thus, if there are multiple attributes with the given local name and different namespaces, the value of an attribute with the smallest index among those attributes will be returned. XMLAttributes.getValue() or XMLAttributes.getValue() should be used to get a value of an attribute with the given local name and namespace.

Method variant with the following signature:

getValue(string name, string uri)

Return a value of an attribute with the given local name and namespace URI.

Parameters:
name a string, the local name of the attribute whose value is required.
uri a string, the namespace URI of the attribute.
Returns:
The attribute value as a string.
Note:
If an attribute with the given local name and namespace URI does not exist, an empty string will be returned. Use XMLAttributes.hasAttribute() const to test for attribute existence.
def libsbml.XMLAttributes.hasAttribute (   self,
  args 
)

Python method signature(s):

hasAttribute(int index)    bool
hasAttribute(string name, string uri = "")    bool
hasAttribute(string name)    bool
hasAttribute(XMLTriple triple)    bool

This method has multiple variants that differ in the arguments they accept. Each is described separately below.


Method variant with the following signature:

hasAttribute(XMLTriple triple)

Predicate returning true or false depending on whether an attribute with the given XML triple exists in this XMLAttributes.

Parameters:
triple an XMLTriple, the XML triple of the attribute
Returns:
true if an attribute with the given XML triple exists in this XMLAttributes, false otherwise.

Method variant with the following signature:

hasAttribute(int index)

Predicate returning true or false depending on whether an attribute with the given index exists in this XMLAttributes.

Parameters:
index an integer, the position of the attribute.
Returns:
true if an attribute with the given index exists in this XMLAttributes, false otherwise.

Method variant with the following signature:

hasAttribute(string name, string uri='')

Predicate returning true or false depending on whether an attribute with the given local name and namespace URI exists in this XMLAttributes.

Parameters:
name a string, the local name of the attribute.
uri a string, the namespace URI of the attribute.
Returns:
true if an attribute with the given local name and namespace URI exists in this XMLAttributes, false otherwise.
def libsbml.XMLAttributes.isEmpty (   self  ) 

Python method signature(s):

isEmpty()    bool

Predicate returning true or false depending on whether this XMLAttributes set is empty.

Returns:
true if this XMLAttributes set is empty, false otherwise.
def libsbml.XMLAttributes.remove (   self,
  args 
)

Python method signature(s):

remove(int n)    int
remove(string name, string uri = "")    int
remove(string name)    int
remove(XMLTriple triple)    int

This method has multiple variants that differ in the arguments they accept. Each is described separately below.


Method variant with the following signature:

remove(XMLTriple triple)

Removes an attribute with the given XMLTriple from this XMLAttributes set.

Parameters:
triple an XMLTriple, the XML triple of the attribute.
Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:
Method variant with the following signature:
remove(int n)

Removes an attribute with the given index from this XMLAttributes set. (This function is an alias of XMLAttributes.removeResource() ).

Parameters:
n an integer the index of the resource to be deleted
Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:
Method variant with the following signature:
remove(string name, string uri = '')

Removes an attribute with the given local name and namespace URI from this XMLAttributes set.

Parameters:
name a string, the local name of the attribute.
uri a string, the namespace URI of the attribute.
Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:
def libsbml.XMLAttributes.removeResource (   self,
  args 
)

Python method signature(s):

removeResource(int n)    int

Removes an attribute with the given index from this XMLAttributes set.

Parameters:
n an integer the index of the resource to be deleted
Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:



HTML documentation generated on Tue Dec 20 01:39:57 2011 using Doxygen 1.6.3.