libSBML Perl API  libSBML 5.10.0 Perl API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
XMLTriple Class Reference

Detailed Description

{core} Representation of a qualified XML name.

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.

A "triple" in the libSBML XML layer encapsulates the notion of qualified name, meaning an element name or an attribute name with an optional namespace qualifier. An XMLTriple instance carries up to three data items:

  • The name of the attribute or element; that is, the attribute name as it appears in an XML document or data stream;

  • The XML namespace prefix (if any) of the attribute. For example, in the following fragment of XML, the namespace prefix is the string mysim and it appears on both the element someelement and the attribute attribA. When both the element and the attribute are stored as XMLTriple objects, their prefix is mysim.

    <mysim:someelement mysim:attribA="value" />
    

  • The XML namespace URI with which the prefix is associated. In XML, every namespace used must be declared and mapped to a URI.

XMLTriple objects are the lowest-level data item in the XML layer of libSBML. Other objects such as XMLToken make use of XMLTriple objects.

Examples:
addingEvidenceCodes_2.cpp, and createExampleSBML.cpp.

Public Member Functions

XMLTripleclone () const
 Creates and returns a deep copy of this XMLTriple set. More...
 
const std::string & getName () const
 Returns the name portion of this XMLTriple. More...
 
const std::string & getPrefix () const
 Returns the prefix portion of this XMLTriple. More...
 
const std::string getPrefixedName () const
 Returns the prefixed name from this XMLTriple. More...
 
const std::string & getURI () const
 Returns the URI portion of this XMLTriple. More...
 
bool isEmpty () const
 Predicate returning true or false depending on whether this XMLTriple is empty. More...
 
XMLTripleoperator= (const XMLTriple &rhs)
 Assignment operator for XMLTriple. More...
 
 XMLTriple ()
 Creates a new, empty XMLTriple. More...
 
 XMLTriple (const std::string &name, const std::string &uri, const std::string &prefix)
 Creates a new XMLTriple with the given name, uri and and prefix. More...
 
 XMLTriple (const std::string &triplet, const char sepchar= ' ')
 Creates a new XMLTriple by splitting the given triplet on the separator character sepchar. More...
 
 XMLTriple (const XMLTriple &orig)
 Copy constructor; creates a copy of this XMLTriple set. More...
 

Constructor & Destructor Documentation

XMLTriple::XMLTriple ( )

Creates a new, empty XMLTriple.

XMLTriple::XMLTriple ( const std::string &  name,
const std::string &  uri,
const std::string &  prefix 
)

Creates a new XMLTriple with the given name, uri and and prefix.

Parameters
namea string, name for the XMLTriple.
uria string, URI of the XMLTriple.
prefixa string, prefix for the URI of the XMLTriple,
Exceptions
XMLConstructorExceptionThrown if the argument orig is NULL.
XMLTriple::XMLTriple ( const std::string &  triplet,
const char  sepchar = ' ' 
)

Creates a new XMLTriple by splitting the given triplet on the separator character sepchar.

Triplet may be in one of the following formats:

  • name
  • URI sepchar name
  • URI sepchar name sepchar prefix
Parameters
tripleta string representing the triplet as above
sepchara character, the sepchar used in the triplet
Exceptions
XMLConstructorExceptionThrown if the argument orig is NULL.
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.
XMLTriple::XMLTriple ( const XMLTriple orig)

Copy constructor; creates a copy of this XMLTriple set.

Parameters
origthe XMLTriple object to copy.
Exceptions
XMLConstructorExceptionThrown if the argument orig is NULL.

Member Function Documentation

XMLTriple * XMLTriple::clone ( ) const

Creates and returns a deep copy of this XMLTriple set.

Returns
a (deep) copy of this XMLTriple set.
const std::string & XMLTriple::getName ( ) const

Returns the name portion of this XMLTriple.

Returns
a string, the name from this XMLTriple.
const std::string & XMLTriple::getPrefix ( ) const

Returns the prefix portion of this XMLTriple.

Returns
a string, the prefix portion of this XMLTriple.
const std::string XMLTriple::getPrefixedName ( ) const

Returns the prefixed name from this XMLTriple.

Returns
a string, the prefixed name from this XMLTriple.
const std::string & XMLTriple::getURI ( ) const

Returns the URI portion of this XMLTriple.

Returns
URI a string, the prefix portion of this XMLTriple.
bool XMLTriple::isEmpty ( ) const

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

Returns
true if this XMLTriple is empty, false otherwise.
XMLTriple & XMLTriple::operator= ( const XMLTriple rhs)

Assignment operator for XMLTriple.

Parameters
rhsThe XMLTriple object whose values are used as the basis of the assignment.
Exceptions
XMLConstructorExceptionThrown if the argument rhs is NULL.