libSBML C API  5.18.0
SyntaxChecker_t Class Reference

Detailed Description

Methods for checking the validity of SBML identifiers.

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.

This utility class provides static methods for checking the syntax of identifiers and other text used in an SBML model. The methods allow callers to verify that strings such as SBML identifiers and XHTML notes text conform to the SBML specifications.

Public Member Functions

int SyntaxChecker_hasExpectedXHTMLSyntax (XMLNode_t *node, SBMLNamespaces_t *sbmlns)
 Predicate indicating whether the argument XMLNode_t structure represents XHTML that conforms to the requirements of the SBML specification. More...
 
int SyntaxChecker_isValidSBMLSId (const char *sid)
 Predicate indicating whether the argument string conforms to the SBML type SId. More...
 
int SyntaxChecker_isValidUnitSId (const char *units)
 Predicate indicating whether the argument string conforms to the SBML type UnitSId. More...
 
int SyntaxChecker_isValidXMLID (const char *id)
 Predicate indicating whether the argument string conforms to the XML 1.0 type ID. More...
 

Member Function Documentation

int SyntaxChecker_hasExpectedXHTMLSyntax ( XMLNode_t node,
SBMLNamespaces_t sbmlns 
)

Predicate indicating whether the argument XMLNode_t structure represents XHTML that conforms to the requirements of the SBML specification.

Parameters
nodethe XMLNode_t structure to be checked for conformance.
sbmlnsthe SBMLNamespaces_t structure associated with the node.
Returns
1 (true) if the XMLNode_t structure conforms, 0 (false) otherwise.
Note
the optional SBMLNamespaces_t argument can be used to check for the declaration of the XHTML namespace at the top-level within an SBMLDocument_t.
int SyntaxChecker_isValidSBMLSId ( const char *  sid)

Predicate indicating whether the argument string conforms to the SBML type SId.

Parameters
sidstring to be checked for conformance.
Returns
1 (true) if the string conforms to type SId, 0 (false) otherwise.

The identifier given by an object's "id" attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of "id" is always SId or a type derived from that, such as UnitSId, depending on the object in question. All data types are defined as follows:

  letter ::= 'a'..'z','A'..'Z'
  digit  ::= '0'..'9'
  idChar ::= letter | digit | '_'
  SId    ::= ( letter | '_' ) idChar*
int SyntaxChecker_isValidUnitSId ( const char *  units)

Predicate indicating whether the argument string conforms to the SBML type UnitSId.

Parameters
unitsstring to be checked for conformance.
Returns
1 (true) if the string conforms to type UnitSId, 0 (false) otherwise.
Note
The following is a summary of the definition of the SBML identifier type UnitSId, which defines the permitted syntax of identifiers. We express the syntax using an extended form of BNF notation:

letter ::= 'a'..'z','A'..'Z'
digit ::= '0'..'9'
idChar ::= letter | digit | '_'
SId ::= ( letter | '_' ) idChar*

The characters ( and ) are used for grouping, the character * "zero or more times", and the character | indicates logical "or". The equality of SBML unit identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. In addition, there are a few conditions for the uniqueness of unit identifiers in an SBML model. Please consult the SBML specifications for the exact formulations.

int SyntaxChecker_isValidXMLID ( const char *  id)

Predicate indicating whether the argument string conforms to the XML 1.0 type ID.

Parameters
idstring to be checked for conformance.
Returns
1 (true) if the string conforms to type ID, 0 (false) otherwise.
Note
The following is a summary of the definition of the XML 1.0 data type ID. We express the syntax using an extended form of BNF notation:

NCNameChar ::= letter | digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
ID ::= ( letter | '_' | ':' ) NCNameChar*

The characters ( and ) are used for grouping, the character * means "zero or more times", and the character | indicates logical "or". The production letter consists of the basic upper and lower case alphabetic characters of the Latin alphabet along with a large number of related characters defined by Unicode 2.0; similarly, the production digit consists of the numerals 0..9 along with related Unicode 2.0 characters. The CombiningChar production is a list of characters that add such things as accents to the preceding character. (For example, the Unicode character \#x030A when combined with a produces \aa.) The Extender production is a list of characters that extend the shape of the preceding character. Please consult the XML 1.0 specification for the complete definitions of letter, digit, CombiningChar, and Extender.