libSBML C API  5.18.0
XMLTriple_t Class Reference

Detailed Description

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. Triples by themselves are not entities in an XML stream—they are not, for example, elements or attributes; rather, XMLTriple_t is used in libSBML to construct these other kinds of objects.

An XMLTriple_t instance carries up to three data items:

  1. The name of the attribute or element; that is, the attribute name as it appears in an XML document or data stream;
  2. 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_t objects, their prefix is mysim.
    <mysim:someelement mysim:attribA="value" />
    
  3. The XML namespace URI with which the prefix is associated. In XML, every namespace used must be declared and mapped to a URI.

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

See also
XMLToken_t
XMLNode_t
XMLAttributes_t
XMLNamespaces_t
Examples:
addingEvidenceCodes_2.c, and createExampleSBML.c.

Public Member Functions

LIBLAX_EXTERN XMLTriple_tXMLTriple_clone (const XMLTriple_t *triple)
 Creates a deep copy of the given XMLTriple_t structure. More...
 
LIBLAX_EXTERN XMLTriple_tXMLTriple_create (void)
 Creates a new empty XMLTriple_t structure and returns a pointer to it. More...
 
LIBLAX_EXTERN XMLTriple_tXMLTriple_createWith (const char *name, const char *uri, const char *prefix)
 Creates a new XMLTriple_t structure with name, prefix and uri. More...
 
LIBLAX_EXTERN int XMLTriple_equalTo (const XMLTriple_t *lhs, const XMLTriple_t *rhs)
 Predicate returning 1 (true) or 0 (false) depending on whether the two XMLTriple_t structures are equal. More...
 
LIBLAX_EXTERN void XMLTriple_free (XMLTriple_t *triple)
 Destroys this XMLTriple_t structure. More...
 
LIBLAX_EXTERN const char * XMLTriple_getName (const XMLTriple_t *triple)
 Returns the name from this XMLTriple_t structure. More...
 
LIBLAX_EXTERN const char * XMLTriple_getPrefix (const XMLTriple_t *triple)
 Returns the prefix from this XMLTriple_t structure. More...
 
LIBLAX_EXTERN const char * XMLTriple_getPrefixedName (const XMLTriple_t *triple)
 Returns the prefixed name from this XMLTriple_t structure. More...
 
LIBLAX_EXTERN const char * XMLTriple_getURI (const XMLTriple_t *triple)
 Returns the URI from this XMLTriple_t structure. More...
 
LIBLAX_EXTERN int XMLTriple_isEmpty (const XMLTriple_t *triple)
 Predicate returning 1 (true) or 0 (false) depending on whether this XMLTriple_t is empty. More...
 
LIBLAX_EXTERN int XMLTriple_notEqualTo (const XMLTriple_t *lhs, const XMLTriple_t *rhs)
 Predicate returning 1 (true) or 0 (false) depending on whether the two XMLTriple_t structures are not equal. More...
 

Member Function Documentation

LIBLAX_EXTERN XMLTriple_t * XMLTriple_clone ( const XMLTriple_t triple)

Creates a deep copy of the given XMLTriple_t structure.

Parameters
triplethe XMLTriple_t structure to be copied.
Returns
a (deep) copy of the given XMLTriple_t structure.
LIBLAX_EXTERN XMLTriple_t * XMLTriple_create ( void  )

Creates a new empty XMLTriple_t structure and returns a pointer to it.

Returns
pointer to created XMLTriple_t structure.
LIBLAX_EXTERN XMLTriple_t * XMLTriple_createWith ( const char *  name,
const char *  uri,
const char *  prefix 
)

Creates a new XMLTriple_t structure with name, prefix and uri.

Parameters
namea string, name for the XMLTriple_t structure.
uria string, URI of the XMLTriple_t structure.
prefixa string, prefix for the URI of the XMLTriple_t structure.
Returns
pointer to the created XMLTriple_t structure.
Examples:
addingEvidenceCodes_2.c, and createExampleSBML.c.
LIBLAX_EXTERN int XMLTriple_equalTo ( const XMLTriple_t lhs,
const XMLTriple_t rhs 
)

Predicate returning 1 (true) or 0 (false) depending on whether the two XMLTriple_t structures are equal.

Parameters
lhsthe first XMLTriple_t structure to be compared.
rhsthe second XMLTriple_t structure to be compared.
Returns
1 (true) if the combination of name, URI, and prefix of the two XMLTriple_t structures are equal, 0 (false) otherwise.
LIBLAX_EXTERN void XMLTriple_free ( XMLTriple_t triple)

Destroys this XMLTriple_t structure.

Parameters
tripleXMLTriple_t structure to be freed.
LIBLAX_EXTERN const char * XMLTriple_getName ( const XMLTriple_t triple)

Returns the name from this XMLTriple_t structure.

Parameters
tripleXMLTriple_t structure to be queried.
Returns
name from this XMLTriple_t structure.
LIBLAX_EXTERN const char * XMLTriple_getPrefix ( const XMLTriple_t triple)

Returns the prefix from this XMLTriple_t structure.

Parameters
tripleXMLTriple_t structure to be queried.
Returns
prefix from this XMLTriple_t structure.
LIBLAX_EXTERN const char * XMLTriple_getPrefixedName ( const XMLTriple_t triple)

Returns the prefixed name from this XMLTriple_t structure.

Parameters
tripleXMLTriple_t structure to be queried.
Returns
prefixed name from this XMLTriple_t structure.
LIBLAX_EXTERN const char * XMLTriple_getURI ( const XMLTriple_t triple)

Returns the URI from this XMLTriple_t structure.

Parameters
tripleXMLTriple_t structure to be queried.
Returns
URI from this XMLTriple_t structure.
LIBLAX_EXTERN int XMLTriple_isEmpty ( const XMLTriple_t triple)

Predicate returning 1 (true) or 0 (false) depending on whether this XMLTriple_t is empty.

Parameters
tripleXMLTriple_t structure to be queried.
Returns
1 (true) if this XMLTriple_t is empty, 0 (false) otherwise.
LIBLAX_EXTERN int XMLTriple_notEqualTo ( const XMLTriple_t lhs,
const XMLTriple_t rhs 
)

Predicate returning 1 (true) or 0 (false) depending on whether the two XMLTriple_t structures are not equal.

Parameters
lhsthe first XMLTriple_t structure to be compared.
rhsthe second XMLTriple_t structure to be compared.
Returns
1 (true) if the combination of name, URI, or prefix of the two XMLTriple_t structures are not equal, 0 (false) otherwise.