libSBML Perl API
libSBML 5.8.0 Perl API
|
Representation of a token in an XML stream.
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 | |
int | addAttr (const std::string &name, const std::string &value, const std::string &namespaceURI="", const std::string &prefix="") |
Adds an attribute to the attribute set in this XMLToken optionally with a prefix and URI defining a namespace. More... | |
int | addAttr (const XMLTriple &triple, const std::string &value) |
Adds an attribute with the given XMLTriple/value pair to the attribute set in this XMLToken. More... | |
int | addNamespace (const std::string &uri, const std::string &prefix="") |
Appends an XML namespace prefix and URI pair to this XMLToken. More... | |
int | append (const std::string &chars) |
Appends characters to this XML text content. More... | |
int | clearAttributes () |
Clears (deletes) all attributes in this XMLToken. More... | |
int | clearNamespaces () |
Clears (deletes) all XML namespace declarations in the XMLNamespaces of this XMLToken. More... | |
XMLToken * | clone () const |
Creates and returns a deep copy of this XMLToken. More... | |
const XMLAttributes & | getAttributes () const |
Returns the attributes of this element. More... | |
int | getAttributesLength () const |
Return the number of attributes in the attributes set. More... | |
int | getAttrIndex (const std::string &name, const std::string &uri="") const |
Return the index of an attribute with the given local name and namespace URI. More... | |
int | getAttrIndex (const XMLTriple &triple) const |
Return the index of an attribute with the given XMLTriple. More... | |
std::string | getAttrName (int index) const |
Return the local name of an attribute in the attributes set in this XMLToken (by position). More... | |
std::string | getAttrPrefix (int index) const |
Return the prefix of an attribute in the attribute set in this XMLToken (by position). More... | |
std::string | getAttrPrefixedName (int index) const |
Return the prefixed name of an attribute in the attribute set in this XMLToken (by position). More... | |
std::string | getAttrURI (int index) const |
Return the namespace URI of an attribute in the attribute set in this XMLToken (by position). More... | |
std::string | getAttrValue (int index) const |
Return the value of an attribute in the attribute set in this XMLToken (by position). More... | |
std::string | getAttrValue (const std::string name, const std::string uri="") const |
Return a value of an attribute with the given local name and namespace URI. More... | |
std::string | getAttrValue (const XMLTriple &triple) const |
Return a value of an attribute with the given XMLTriple. More... | |
const std::string & | getCharacters () const |
Returns the text of this element. More... | |
unsigned int | getColumn () const |
Returns the column at which this XMLToken occurred in the input document or data stream. More... | |
unsigned int | getLine () const |
Returns the line at which this XMLToken occurred in the input document or data stream. More... | |
const std::string & | getName () const |
Returns the (unqualified) name of this XML element. More... | |
int | getNamespaceIndex (const std::string &uri) const |
Look up the index of an XML namespace declaration by URI. More... | |
int | getNamespaceIndexByPrefix (const std::string &prefix) const |
Look up the index of an XML namespace declaration by prefix. More... | |
std::string | getNamespacePrefix (int index) const |
Look up the prefix of an XML namespace declaration by position. More... | |
std::string | getNamespacePrefix (const std::string &uri) const |
Look up the prefix of an XML namespace declaration by its URI. More... | |
const XMLNamespaces & | getNamespaces () const |
Returns the XML namespace declarations for this XML element. More... | |
int | getNamespacesLength () const |
Returns the number of XML namespaces stored in the XMLNamespaces of this XMLToken. More... | |
std::string | getNamespaceURI (int index) const |
Look up the URI of an XML namespace declaration by its position. More... | |
std::string | getNamespaceURI (const std::string &prefix="") const |
Look up the URI of an XML namespace declaration by its prefix. More... | |
const std::string & | getPrefix () const |
Returns the namespace prefix of this XML element. More... | |
const std::string & | getURI () const |
Returns the namespace URI of this XML element. More... | |
bool | hasAttr (int index) const |
Predicate returning true or false depending on whether an attribute with the given index exists in the attribute set in this XMLToken. More... | |
bool | hasAttr (const std::string name, const std::string uri="") const |
Predicate returning true or false depending on whether an attribute with the given local name and namespace URI exists in the attribute set in this XMLToken. More... | |
bool | hasAttr (const XMLTriple &triple) const |
Predicate returning true or false depending on whether an attribute with the given XML triple exists in the attribute set in this XMLToken. More... | |
bool | hasNamespaceNS (const std::string &uri, const std::string &prefix) const |
Predicate returning true or false depending on whether an XML Namespace with the given uri/prefix pair is contained in the XMLNamespaces ofthis XMLToken. More... | |
bool | hasNamespacePrefix (const std::string &prefix) const |
Predicate returning true or false depending on whether an XML Namespace with the given prefix is contained in the XMLNamespaces of this XMLToken. More... | |
bool | hasNamespaceURI (const std::string &uri) const |
Predicate returning true or false depending on whether an XML Namespace with the given URI is contained in the XMLNamespaces of this XMLToken. More... | |
bool | isAttributesEmpty () const |
Predicate returning true or false depending on whether the attribute set in this XMLToken set is empty. More... | |
bool | isElement () const |
Predicate returning true or false depending on whether this XMLToken is an XML element. More... | |
bool | isEnd () const |
Predicate returning true or false depending on whether this XMLToken is an XML end element. More... | |
bool | isEndFor (const XMLToken &element) const |
Predicate returning true or false depending on whether this XMLToken is an XML end element for the given start element. More... | |
bool | isEOF () const |
Predicate returning true or false depending on whether this XMLToken is an end of file marker. More... | |
bool | isNamespacesEmpty () const |
Predicate returning true or false depending on whether the XMLNamespaces of this XMLToken is empty. More... | |
bool | isStart () const |
Predicate returning true or false depending on whether this XMLToken is an XML start element. More... | |
bool | isText () const |
Predicate returning true or false depending on whether this XMLToken is an XML text element. More... | |
XMLToken & | operator= (const XMLToken &rhs) |
Assignment operator for XMLToken. More... | |
int | removeAttr (int n) |
Removes an attribute with the given index from the attribute set in this XMLToken. More... | |
int | removeAttr (const std::string &name, const std::string &uri="") |
Removes an attribute with the given local name and namespace URI from the attribute set in this XMLToken. More... | |
int | removeAttr (const XMLTriple &triple) |
Removes an attribute with the given XMLTriple from the attribute set in this XMLToken. More... | |
int | removeNamespace (int index) |
Removes an XML Namespace stored in the given position of the XMLNamespaces of this XMLToken. More... | |
int | removeNamespace (const std::string &prefix) |
Removes an XML Namespace with the given prefix. More... | |
int | setAttributes (const XMLAttributes &attributes) |
Sets an XMLAttributes to this XMLToken. More... | |
int | setEnd () |
Declares this XML start element is also an end element. More... | |
int | setEOF () |
Declares this XMLToken is an end-of-file (input) marker. More... | |
int | setNamespaces (const XMLNamespaces &namespaces) |
Sets an XMLnamespaces to this XML element. More... | |
int | setTriple (const XMLTriple &triple) |
Sets the XMLTripe (name, uri and prefix) of this XML element. More... | |
std::string | toString () |
Prints a string representation of the underlying token stream, for debugging purposes. More... | |
int | unsetEnd () |
Declares this XML start/end element is no longer an end element. More... | |
XMLToken () | |
Creates a new empty XMLToken. More... | |
XMLToken (const XMLTriple &triple, const XMLAttributes &attributes, const XMLNamespaces &namespaces, const unsigned int line=0, const unsigned int column=0) | |
Creates a start element XMLToken with the given set of attributes and namespace declarations. More... | |
XMLToken (const XMLTriple &triple, const XMLAttributes &attributes, const unsigned int line=0, const unsigned int column=0) | |
Creates a start element XMLToken with the given set of attributes. More... | |
XMLToken (const XMLTriple &triple, const unsigned int line=0, const unsigned int column=0) | |
Creates an end element XMLToken. More... | |
XMLToken (const std::string &chars, const unsigned int line=0, const unsigned int column=0) | |
Creates a text XMLToken. More... | |
XMLToken (const XMLToken &orig) | |
Copy constructor; creates a copy of this XMLToken. More... | |
virtual | ~XMLToken () |
Destroys this XMLToken. More... | |
XMLToken::XMLToken | ( | ) |
Creates a new empty XMLToken.
XMLToken::XMLToken | ( | const XMLTriple & | triple, |
const XMLAttributes & | attributes, | ||
const XMLNamespaces & | namespaces, | ||
const unsigned int | line = 0 , |
||
const unsigned int | column = 0 |
||
) |
Creates a start element XMLToken with the given set of attributes and namespace declarations.
triple | XMLTriple. |
attributes | XMLAttributes, the attributes to set. |
namespaces | XMLNamespaces, the namespaces to set. |
line | an unsigned int, the line number (default = 0). |
column | an unsigned int, the column number (default = 0). |
XMLToken::XMLToken | ( | const XMLTriple & | triple, |
const XMLAttributes & | attributes, | ||
const unsigned int | line = 0 , |
||
const unsigned int | column = 0 |
||
) |
Creates a start element XMLToken with the given set of attributes.
triple | XMLTriple. |
attributes | XMLAttributes, the attributes to set. |
line | an unsigned int, the line number (default = 0). |
column | an unsigned int, the column number (default = 0). |
XMLToken::XMLToken | ( | const XMLTriple & | triple, |
const unsigned int | line = 0 , |
||
const unsigned int | column = 0 |
||
) |
Creates an end element XMLToken.
triple | XMLTriple. |
line | an unsigned int, the line number (default = 0). |
column | an unsigned int, the column number (default = 0). |
XMLToken::XMLToken | ( | const std::string & | chars, |
const unsigned int | line = 0 , |
||
const unsigned int | column = 0 |
||
) |
Creates a text XMLToken.
chars | a string, the text to be added to the XMLToken |
line | an unsigned int, the line number (default = 0). |
column | an unsigned int, the column number (default = 0). |
XMLConstructorException | Thrown if the argument orig is NULL . |
|
virtual |
Destroys this XMLToken.
XMLToken::XMLToken | ( | const XMLToken & | orig | ) |
Copy constructor; creates a copy of this XMLToken.
orig | the XMLToken object to copy. |
XMLConstructorException | Thrown if the argument orig is NULL . |
int XMLToken::addAttr | ( | const std::string & | name, |
const std::string & | value, | ||
const std::string & | namespaceURI = "" , |
||
const std::string & | prefix = "" |
||
) |
Adds an attribute to the attribute set in this XMLToken optionally with a prefix and URI defining a namespace.
Nothing will be done if this XMLToken is not a start element.
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 |
int XMLToken::addAttr | ( | const XMLTriple & | triple, |
const std::string & | value | ||
) |
Adds an attribute with the given XMLTriple/value pair to the attribute set in this XMLToken.
Nothing will be done if this XMLToken is not a start element.
triple | an XMLTriple, the XML triple of the attribute. |
value | a string, the value of the attribute. |
int XMLToken::addNamespace | ( | const std::string & | uri, |
const std::string & | prefix = "" |
||
) |
Appends an XML namespace prefix and URI pair to this XMLToken.
If there is an XML namespace with the given prefix in this XMLToken, then the existing XML namespace will be overwritten by the new one.
Nothing will be done if this XMLToken is not a start element.
uri | a string, the uri for the namespace |
prefix | a string, the prefix for the namespace |
int XMLToken::append | ( | const std::string & | chars | ) |
Appends characters to this XML text content.
chars | string, characters to append |
int XMLToken::clearAttributes | ( | ) |
int XMLToken::clearNamespaces | ( | ) |
Clears (deletes) all XML namespace declarations in the XMLNamespaces of this XMLToken.
Nothing will be done if this XMLToken is not a start element.
XMLToken * XMLToken::clone | ( | ) | const |
const XMLAttributes & XMLToken::getAttributes | ( | ) | const |
Returns the attributes of this element.
int XMLToken::getAttributesLength | ( | ) | const |
Return the number of attributes in the attributes set.
int XMLToken::getAttrIndex | ( | const std::string & | name, |
const std::string & | uri = "" |
||
) | const |
Return the index of an attribute with the given local name and namespace URI.
name | a string, the local name of the attribute. |
uri | a string, the namespace URI of the attribute. |
-1
if not present.int XMLToken::getAttrIndex | ( | const XMLTriple & | triple | ) | const |
std::string XMLToken::getAttrName | ( | int | index | ) | const |
Return the local name of an attribute in the attributes set in this XMLToken (by position).
index | an integer, the position of the attribute whose local name is required. |
std::string XMLToken::getAttrPrefix | ( | int | index | ) | const |
Return the prefix of an attribute in the attribute set in this XMLToken (by position).
index | an integer, the position of the attribute whose prefix is required. |
std::string XMLToken::getAttrPrefixedName | ( | int | index | ) | const |
Return the prefixed name of an attribute in the attribute set in this XMLToken (by position).
index | an integer, the position of the attribute whose prefixed name is required. |
std::string XMLToken::getAttrURI | ( | int | index | ) | const |
Return the namespace URI of an attribute in the attribute set in this XMLToken (by position).
index | an integer, the position of the attribute whose namespace URI is required. |
std::string XMLToken::getAttrValue | ( | int | index | ) | const |
Return the value of an attribute in the attribute set in this XMLToken (by position).
index | an integer, the position of the attribute whose value is required. |
std::string XMLToken::getAttrValue | ( | const std::string | name, |
const std::string | uri = "" |
||
) | const |
Return a value of an attribute with the given local name and namespace URI.
name | a string, the local name of the attribute whose value is required. |
uri | a string, the namespace URI of the attribute. |
std::string XMLToken::getAttrValue | ( | const XMLTriple & | triple | ) | const |
Return a value of an attribute with the given XMLTriple.
triple | an XMLTriple, the XML triple of the attribute whose value is required. |
const string & XMLToken::getCharacters | ( | ) | const |
Returns the text of this element.
unsigned int XMLToken::getColumn | ( | ) | const |
unsigned int XMLToken::getLine | ( | ) | const |
const string & XMLToken::getName | ( | ) | const |
Returns the (unqualified) name of this XML element.
int XMLToken::getNamespaceIndex | ( | const std::string & | uri | ) | const |
Look up the index of an XML namespace declaration by URI.
uri | a string, uri of the required namespace. |
-1
if not present. int XMLToken::getNamespaceIndexByPrefix | ( | const std::string & | prefix | ) | const |
Look up the index of an XML namespace declaration by prefix.
prefix | a string, prefix of the required namespace. |
-1
if not present. std::string XMLToken::getNamespacePrefix | ( | int | index | ) | const |
Look up the prefix of an XML namespace declaration by position.
Callers should use getNamespacesLength() to find out how many namespaces are stored in the XMLNamespaces.
index | an integer, position of the required prefix. |
std::string XMLToken::getNamespacePrefix | ( | const std::string & | uri | ) | const |
Look up the prefix of an XML namespace declaration by its URI.
uri | a string, the URI of the prefix being sought |
uri
does not exist, an empty string will be returned. const XMLNamespaces & XMLToken::getNamespaces | ( | ) | const |
Returns the XML namespace declarations for this XML element.
int XMLToken::getNamespacesLength | ( | ) | const |
Returns the number of XML namespaces stored in the XMLNamespaces of this XMLToken.
std::string XMLToken::getNamespaceURI | ( | int | index | ) | const |
Look up the URI of an XML namespace declaration by its position.
index | an integer, position of the required URI. |
index
is out of range, an empty string will be returned.std::string XMLToken::getNamespaceURI | ( | const std::string & | prefix = "" | ) | const |
Look up the URI of an XML namespace declaration by its prefix.
prefix | a string, the prefix of the required URI |
prefix
does not exist, an empty string will be returned.const string & XMLToken::getPrefix | ( | ) | const |
Returns the namespace prefix of this XML element.
const string & XMLToken::getURI | ( | ) | const |
Returns the namespace URI of this XML element.
bool XMLToken::hasAttr | ( | int | index | ) | const |
Predicate returning true
or false
depending on whether an attribute with the given index exists in the attribute set in this XMLToken.
index | an integer, the position of the attribute. |
true
if an attribute with the given index exists in the attribute set in this XMLToken, false
otherwise. bool XMLToken::hasAttr | ( | const std::string | name, |
const std::string | uri = "" |
||
) | const |
Predicate returning true
or false
depending on whether an attribute with the given local name and namespace URI exists in the attribute set in this XMLToken.
name | a string, the local name of the attribute. |
uri | a string, the namespace URI of the attribute. |
true
if an attribute with the given local name and namespace URI exists in the attribute set in this XMLToken, false
otherwise.bool XMLToken::hasAttr | ( | const XMLTriple & | triple | ) | const |
Predicate returning true
or false
depending on whether an attribute with the given XML triple exists in the attribute set in this XMLToken.
triple | an XMLTriple, the XML triple of the attribute |
true
if an attribute with the given XML triple exists in the attribute set in this XMLToken, false
otherwise. bool XMLToken::hasNamespaceNS | ( | const std::string & | uri, |
const std::string & | prefix | ||
) | const |
Predicate returning true
or false
depending on whether an XML Namespace with the given uri/prefix pair is contained in the XMLNamespaces ofthis XMLToken.
uri | a string, the uri for the namespace |
prefix | a string, the prefix for the namespace |
true
if an XML Namespace with the given uri/prefix pair is contained in the XMLNamespaces of this XMLToken, false
otherwise. bool XMLToken::hasNamespacePrefix | ( | const std::string & | prefix | ) | const |
Predicate returning true
or false
depending on whether an XML Namespace with the given prefix is contained in the XMLNamespaces of this XMLToken.
prefix | a string, the prefix for the namespace |
true
if an XML Namespace with the given URI is contained in the XMLNamespaces of this XMLToken, false
otherwise. bool XMLToken::hasNamespaceURI | ( | const std::string & | uri | ) | const |
Predicate returning true
or false
depending on whether an XML Namespace with the given URI is contained in the XMLNamespaces of this XMLToken.
uri | a string, the uri for the namespace |
true
if an XML Namespace with the given URI is contained in the XMLNamespaces of this XMLToken, false
otherwise. bool XMLToken::isAttributesEmpty | ( | ) | const |
bool XMLToken::isElement | ( | ) | const |
bool XMLToken::isEnd | ( | ) | const |
bool XMLToken::isEndFor | ( | const XMLToken & | element | ) | const |
bool XMLToken::isEOF | ( | ) | const |
bool XMLToken::isNamespacesEmpty | ( | ) | const |
Predicate returning true
or false
depending on whether the XMLNamespaces of this XMLToken is empty.
true
if the XMLNamespaces of this XMLToken is empty, false
otherwise. bool XMLToken::isStart | ( | ) | const |
bool XMLToken::isText | ( | ) | const |
Assignment operator for XMLToken.
rhs | The XMLToken object whose values are used as the basis of the assignment. |
XMLConstructorException | Thrown if the argument rhs is NULL . |
int XMLToken::removeAttr | ( | int | n | ) |
Removes an attribute with the given index from the attribute set in this XMLToken.
Nothing will be done if this XMLToken is not a start element.
n | an integer the index of the resource to be deleted |
int XMLToken::removeAttr | ( | const std::string & | name, |
const std::string & | uri = "" |
||
) |
Removes an attribute with the given local name and namespace URI from the attribute set in this XMLToken.
Nothing will be done if this XMLToken is not a start element.
name | a string, the local name of the attribute. |
uri | a string, the namespace URI of the attribute. |
int XMLToken::removeAttr | ( | const XMLTriple & | triple | ) |
Removes an attribute with the given XMLTriple from the attribute set in this XMLToken.
Nothing will be done if this XMLToken is not a start element.
triple | an XMLTriple, the XML triple of the attribute. |
int XMLToken::removeNamespace | ( | int | index | ) |
Removes an XML Namespace stored in the given position of the XMLNamespaces of this XMLToken.
Nothing will be done if this XMLToken is not a start element.
index | an integer, position of the removed namespace. |
int XMLToken::removeNamespace | ( | const std::string & | prefix | ) |
Removes an XML Namespace with the given prefix.
Nothing will be done if this XMLToken is not a start element.
prefix | a string, prefix of the required namespace. |
int XMLToken::setAttributes | ( | const XMLAttributes & | attributes | ) |
Sets an XMLAttributes to this XMLToken.
Nothing will be done if this XMLToken is not a start element.
attributes | XMLAttributes to be set to this XMLToken. |
int XMLToken::setEnd | ( | ) |
Declares this XML start element is also an end element.
int XMLToken::setEOF | ( | ) |
Declares this XMLToken is an end-of-file (input) marker.
int XMLToken::setNamespaces | ( | const XMLNamespaces & | namespaces | ) |
Sets an XMLnamespaces to this XML element.
Nothing will be done if this XMLToken is not a start element.
namespaces | XMLNamespaces to be set to this XMLToken. |
int XMLToken::setTriple | ( | const XMLTriple & | triple | ) |
Sets the XMLTripe (name, uri and prefix) of this XML element.
Nothing will be done if this XML element is a text node.
triple | XMLTriple to be added to this XML element. |
string XMLToken::toString | ( | ) |
Prints a string representation of the underlying token stream, for debugging purposes.
int XMLToken::unsetEnd | ( | ) |
Declares this XML start/end element is no longer an end element.