libSBML Python API  5.10.0
 All Classes Namespaces Files Functions Variables Modules Pages
libsbml.XMLAttributes Class Reference
Inheritance diagram for libsbml.XMLAttributes:
[legend]

Detailed Description

{core}

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(XMLAttributes self, string name, string value, string namespaceURI="", string prefix="")   int
add(XMLAttributes self, string name, string value, string namespaceURI="")   int
add(XMLAttributes self, string name, string value)   int
add(XMLAttributes self, 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
triplean XMLTriple, the XML triple of the attribute.
valuea 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
namea string, the local name of the attribute.
valuea string, the value of the attribute.
namespaceURIa string, the namespace URI of the attribute.
prefixa 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(XMLAttributes self)   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)

{core}

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.

Python method signature(s):

clone(XMLAttributes self)   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(XMLAttributes self, string name)   int
getIndex(XMLAttributes self, string name, string uri)   int
getIndex(XMLAttributes self, 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
triplean 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
namea string, the local name of the attribute.
uria 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
namea 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(XMLAttributes self)   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(XMLAttributes self, int index)   string

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

Parameters
indexan 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(XMLAttributes self)   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(XMLAttributes self, int index)   string

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

Parameters
indexan 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(XMLAttributes self, int index)   string

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

Parameters
indexan 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(XMLAttributes self, int index)   string

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

Parameters
indexan 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(XMLAttributes self, int index)   string
getValue(XMLAttributes self, string name)   string
getValue(XMLAttributes self, string name, string uri)   string
getValue(XMLAttributes self, 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
triplean 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
indexan 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
namea 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
namea string, the local name of the attribute whose value is required.
uria 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(XMLAttributes self, int index)   bool
hasAttribute(XMLAttributes self, string name, string uri="")   bool
hasAttribute(XMLAttributes self, string name)   bool
hasAttribute(XMLAttributes self, 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
triplean 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
indexan 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
namea string, the local name of the attribute.
uria 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(XMLAttributes self)   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(XMLAttributes self, int n)   int
remove(XMLAttributes self, string name, string uri="")   int
remove(XMLAttributes self, string name)   int
remove(XMLAttributes self, 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
triplean 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
nan 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
namea string, the local name of the attribute.
uria 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(XMLAttributes self, int n)   int

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

Parameters
nan 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: