XMLError.h File Reference

Detailed Description

Represents errors (and messages) encountered during an XML parse.

Author:
Ben Bornstein
Michael Hucka
Include dependency graph for XMLError.h:
This graph shows which files directly or indirectly include this file:

Enumerations

enum  XMLErrorCategory_t {
  LIBSBML_CAT_INTERNAL = 0,
  LIBSBML_CAT_SYSTEM,
  LIBSBML_CAT_XML
}
 Category codes for errors in the XML layer. More...
enum  XMLErrorCode_t {
  XMLUnknownError = 0,
  XMLOutOfMemory = 1,
  XMLFileUnreadable = 2,
  XMLFileUnwritable = 3,
  XMLFileOperationError = 4,
  XMLNetworkAccessError = 5,
  InternalXMLParserError = 101,
  UnrecognizedXMLParserCode = 102,
  XMLTranscoderError = 103,
  MissingXMLDecl = 1001,
  MissingXMLEncoding = 1002,
  BadXMLDecl = 1003,
  BadXMLDOCTYPE = 1004,
  InvalidCharInXML = 1005,
  BadlyFormedXML = 1006,
  UnclosedXMLToken = 1007,
  InvalidXMLConstruct = 1008,
  XMLTagMismatch = 1009,
  DuplicateXMLAttribute = 1010,
  UndefinedXMLEntity = 1011,
  BadProcessingInstruction = 1012,
  BadXMLPrefix = 1013,
  BadXMLPrefixValue = 1014,
  MissingXMLRequiredAttribute = 1015,
  XMLAttributeTypeMismatch = 1016,
  XMLBadUTF8Content = 1017,
  MissingXMLAttributeValue = 1018,
  BadXMLAttributeValue = 1019,
  BadXMLAttribute = 1020,
  UnrecognizedXMLElement = 1021,
  BadXMLComment = 1022,
  BadXMLDeclLocation = 1023,
  XMLUnexpectedEOF = 1024,
  BadXMLIDValue = 1025,
  BadXMLIDRef = 1026,
  UninterpretableXMLContent = 1027,
  BadXMLDocumentStructure = 1028,
  InvalidAfterXMLContent = 1029,
  XMLExpectedQuotedString = 1030,
  XMLEmptyValueNotPermitted = 1031,
  XMLBadNumber = 1032,
  XMLBadColon = 1033,
  MissingXMLElements = 1034,
  XMLContentEmpty = 1035,
  XMLErrorCodesUpperBound = 9999
}
 Canonical error codes returned for low-level XML parser errors. More...
enum  XMLErrorSeverity_t {
  LIBSBML_SEV_INFO = 0,
  LIBSBML_SEV_WARNING,
  LIBSBML_SEV_ERROR,
  LIBSBML_SEV_FATAL
}
 Severity codes for errors in the XML layer. More...

Functions

LIBLAX_EXTERN XMLError_t * XMLError_create (void)
 Creates a new XMLError to report that something occurred.
LIBLAX_EXTERN XMLError_t * XMLError_createWithIdAndMessage (unsigned int errorId, const char *message)
 Creates a new XMLError with the identification number and detailed message set.
LIBLAX_EXTERN void XMLError_free (XMLError_t *error)
 Frees the given XMLError_t structure.
LIBLAX_EXTERN unsigned int XMLError_getCategory (const XMLError_t *error)
 Return the category of this XMLError.
LIBLAX_EXTERN const char * XMLError_getCategoryAsString (const XMLError_t *error)
 Return the category of this XMLError as a string.
LIBLAX_EXTERN unsigned int XMLError_getColumn (const XMLError_t *error)
 Return the column number where this XMLError occurred.
LIBLAX_EXTERN unsigned int XMLError_getErrorId (const XMLError_t *error)
 Returns the id of this XMLError.
LIBLAX_EXTERN unsigned int XMLError_getLine (const XMLError_t *error)
 Return the line number where this XMLError occurred.
LIBLAX_EXTERN const char * XMLError_getMessage (const XMLError_t *error)
 Returns the message text of this XMLError.
LIBLAX_EXTERN unsigned int XMLError_getSeverity (const XMLError_t *error)
 Return the severity of this XMLError.
LIBLAX_EXTERN const char * XMLError_getSeverityAsString (const XMLError_t *error)
 Return the severity of this XMLError as a string.erity_t.
LIBLAX_EXTERN const char * XMLError_getShortMessage (const XMLError_t *error)
 Returns the short message text of this XMLError.
LIBLAX_EXTERN int XMLError_isError (const XMLError_t *error)
 Predicate returning true or false depending on whether this XMLError_t structure is an error.
LIBLAX_EXTERN int XMLError_isFatal (const XMLError_t *error)
 Predicate returning true or false depending on whether this XMLError_t structure is a fatal error.
LIBLAX_EXTERN int XMLError_isInfo (const XMLError_t *error)
 Predicate returning true or false depending on whether this XMLError_t structure is for information only.
LIBLAX_EXTERN int XMLError_isWarning (const XMLError_t *error)
 Predicate returning true or false depending on whether this XMLError_t structure is a warning.
LIBLAX_EXTERN void XMLError_print (const XMLError_t *error, FILE *stream)
 Outputs this XMLError to stream in the following format (and followed by a newline):

Enumeration Type Documentation

Category codes for errors in the XML layer.

Enumerator:
LIBSBML_CAT_INTERNAL 

A problem involving the libSBML software itself or the underlying XML parser. This almost certainly indicates a software defect (i.e., bug) in libSBML. Please report instances of this to the libSBML developers.

LIBSBML_CAT_SYSTEM 

A problem reported by the operating system, such as an inability to read or write a file. This indicates something that is not a program error but is outside of the control of libSBML.

LIBSBML_CAT_XML 

A problem in the XML content itself. This usually arises from malformed XML or the use of constructs not permitted in SBML.

Canonical error codes returned for low-level XML parser errors.

These codes are 4 digits long, less than 10000, to distinguish them from 5-digit SBML error codes > 10000. The codes are an abstraction of errors from the multiple parsers (Xerces, Expat, libxml2) supported by libSBML.

Enumerator:
XMLUnknownError 

Unknown error encountered.

XMLOutOfMemory 

LibSBML unexpected encountered an out of memory condition from the operating system.

XMLFileUnreadable 

Could not open or read the file.

XMLFileUnwritable 

Could not write to the file.

XMLFileOperationError 

Error encountered while attempting a file operation.

XMLNetworkAccessError 

Error encountered while attempting a network access.

InternalXMLParserError 

Internal error in XML parser.

UnrecognizedXMLParserCode 

The XML parser returned an error code that is not recognized by libSBML.

XMLTranscoderError 

The character transcoder reported an error.

MissingXMLDecl 

Missing XML declaration at beginning of XML input.

MissingXMLEncoding 

Missing encoding attribute in XML declaration.

BadXMLDecl 

Invalid or unrecognized XML declaration or XML encoding.

BadXMLDOCTYPE 

Invalid, malformed or unrecognized XML DOCTYPE declaration.

InvalidCharInXML 

Invalid character in XML content.

BadlyFormedXML 

XML is not well-formed.

UnclosedXMLToken 

Unclosed token.

InvalidXMLConstruct 

XML construct is invalid or not permitted.

XMLTagMismatch 

Element tag mismatch or missing tag.

DuplicateXMLAttribute 

Duplicate attribute.

UndefinedXMLEntity 

Undefined XML entity.

BadProcessingInstruction 

Invalid, malformed or unrecognized XML processing instruction.

BadXMLPrefix 

Invalid or undefined XML Namespace prefix.

BadXMLPrefixValue 

Invalid XML Namespace prefix value.

MissingXMLRequiredAttribute 

Required attribute is missing.

XMLAttributeTypeMismatch 

Data type mismatch for attribute value.

XMLBadUTF8Content 

Invalid UTF8 content.

MissingXMLAttributeValue 

Missing or improperly formed attribute value.

BadXMLAttributeValue 

Invalid or unrecognizable attribute value.

BadXMLAttribute 

Invalid, unrecognized or malformed attribute.

UnrecognizedXMLElement 

Element either not recognized or not permitted.

BadXMLComment 

Badly formed XML comment.

BadXMLDeclLocation 

XML declaration not permitted in this location.

XMLUnexpectedEOF 

Reached end of input unexpectedly.

BadXMLIDValue 

Value is invalid for XML ID, or has already been used.

BadXMLIDRef 

XML ID value was never declared.

UninterpretableXMLContent 

Unable to interpret content.

BadXMLDocumentStructure 

Bad XML document structure.

InvalidAfterXMLContent 

Encountered invalid content after expected content.

XMLExpectedQuotedString 

Expected to find a quoted string.

XMLEmptyValueNotPermitted 

An empty value is not permitted in this context.

XMLBadNumber 

Invalid or unrecognized number.

XMLBadColon 

Colon characters are invalid in this context.

MissingXMLElements 

One or more expected elements are missing.

XMLContentEmpty 

Main XML content is empty.

XMLErrorCodesUpperBound 

Severity codes for errors in the XML layer.

These severity levels are based on those defined in the XML specification, with the addition of Info for informational messages.

Enumerator:
LIBSBML_SEV_INFO 

The error is actually informational and not necessarily a serious problem.

LIBSBML_SEV_WARNING 

The error object represents a problem that is not serious enough to necessarily stop the problem, but applications should take note of the problem and evaluate what its implications may be.

LIBSBML_SEV_ERROR 

The error object represents a serious error. The application may continue running but it is unlikely to be able to continue processing the same XML file or data stream.

LIBSBML_SEV_FATAL 

A serious error occurred, such as an out-of-memory condition, and the software should terminate immediately.


Function Documentation

LIBLAX_EXTERN XMLError_t* XMLError_create ( void  )

Creates a new XMLError to report that something occurred.

LIBLAX_EXTERN XMLError_t* XMLError_createWithIdAndMessage ( unsigned int  errorId,
const char *  message 
)

Creates a new XMLError with the identification number and detailed message set.

If the identifier is < 10000, it must be one of the predefined XML layer error codes.

Parameters:
errorIdan unsigned int, the identification number of the error.
messagea string, the error message.
LIBLAX_EXTERN void XMLError_free ( XMLError_t *  error)

Frees the given XMLError_t structure.

Parameters:
errorthe XMLError_t structure to be freed.
LIBLAX_EXTERN unsigned int XMLError_getCategory ( const XMLError_t *  error)

Return the category of this XMLError.

The possible values (for the XML layers) are those from the enumeration XMLErrorCategory_t.

Parameters:
errorthe XMLError_t from which to return the category.
Returns:
the category of this XMLError.
LIBLAX_EXTERN const char* XMLError_getCategoryAsString ( const XMLError_t *  error)

Return the category of this XMLError as a string.

Parameters:
errorthe XMLError_t from which to return the category.
Returns:
string representing the category of this XMLError.
LIBLAX_EXTERN unsigned int XMLError_getColumn ( const XMLError_t *  error)

Return the column number where this XMLError occurred.

Parameters:
errorthe XMLError_t from which to return the column number.
Returns:
the column number where this XMLError occurred.
LIBLAX_EXTERN unsigned int XMLError_getErrorId ( const XMLError_t *  error)

Returns the id of this XMLError.

Parameters:
errorthe XMLError_t from which to return the id.
Returns:
the id of this XMLError.
LIBLAX_EXTERN unsigned int XMLError_getLine ( const XMLError_t *  error)

Return the line number where this XMLError occurred.

Parameters:
errorthe XMLError_t from which to return the line number.
Returns:
the line number where this XMLError occurred.
LIBLAX_EXTERN const char* XMLError_getMessage ( const XMLError_t *  error)

Returns the message text of this XMLError.

Parameters:
errorthe XMLError_t from which to return the message.
Returns:
the message text of this XMLError.
LIBLAX_EXTERN unsigned int XMLError_getSeverity ( const XMLError_t *  error)

Return the severity of this XMLError.

The possible values (for the XML layer) are those from the enumeration XMLErrorSeverity_t.

Parameters:
errorthe XMLError_t from which to return the severity.
Returns:
the severity of this XMLError.
LIBLAX_EXTERN const char* XMLError_getSeverityAsString ( const XMLError_t *  error)

Return the severity of this XMLError as a string.erity_t.

Parameters:
errorthe XMLError_t from which to return the severity.
Returns:
string representing the severity of this XMLError.
LIBLAX_EXTERN const char* XMLError_getShortMessage ( const XMLError_t *  error)

Returns the short message text of this XMLError.

Parameters:
errorthe XMLError_t from which to return the short message.
Returns:
the message text of this XMLError.
LIBLAX_EXTERN int XMLError_isError ( const XMLError_t *  error)

Predicate returning true or false depending on whether this XMLError_t structure is an error.

Parameters:
errorthe XMLError_t.
Returns:
non-zero (true) if this XMLError is an error, zero (false) otherwise.
LIBLAX_EXTERN int XMLError_isFatal ( const XMLError_t *  error)

Predicate returning true or false depending on whether this XMLError_t structure is a fatal error.

Parameters:
errorthe XMLError_t.
Returns:
non-zero (true) if this XMLError is a fatal error, zero (false) otherwise.
LIBLAX_EXTERN int XMLError_isInfo ( const XMLError_t *  error)

Predicate returning true or false depending on whether this XMLError_t structure is for information only.

Parameters:
errorthe XMLError_t.
Returns:
non-zero (true) if this XMLError is for informational purposes only, zero (false) otherwise.
LIBLAX_EXTERN int XMLError_isWarning ( const XMLError_t *  error)

Predicate returning true or false depending on whether this XMLError_t structure is a warning.

Parameters:
errorthe XMLError_t.
Returns:
non-zero (true) if this XMLError is a warning, zero (false) otherwise.
LIBLAX_EXTERN void XMLError_print ( const XMLError_t *  error,
FILE *  stream 
)

Outputs this XMLError to stream in the following format (and followed by a newline):

line: (id) message

Parameters:
error,theXMLError_t structure to write.
stream,thestream to write to.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines