libNuML  1.1.1
Library for reading / writing NuML documents
NUMLErrorTable.h
Go to the documentation of this file.
1 /*
2 * ****************************************************************************
3 * This file is part of libNUML. Please visit http://code.google.com/p/numl/for more
4 * information about NUML, and the latest version of libNUML.
5 * Copyright (c) 2013 The University of Manchester.
6 *
7 * This library is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation. A copy of the license agreement is
10 * provided in the file named "LICENSE.txt" included with this software
11 * distribution and also available online as http://www.gnu.org/licenses/lgpl.html
12 *
13 * Contributors:
14 * Joseph O. Dada, The University of Manchester - initial API and implementation
15 * ****************************************************************************
16 */
17 
18 
19 #include <string>
20 #include <iostream>
21 #include <sstream>
22 
23 #include <sbml/xml/XMLError.h>
24 #include <numl/NUMLError.h>
25 
26 
28 
29 typedef struct {
30  const char * ref_l1;
32 
33 typedef struct {
34  unsigned int code;
35  const char* shortMessage;
36  unsigned int category;
37  unsigned int l1v1_severity;
38  const char* message;
41 
42 
44 {
45  // 10000
47  "Unknown internal libNUML error",
50  "Unrecognized error encountered by libNUML" },
51 
52  //10101
53  {
55  "Not UTF8",
58  "An NUML XML file must use UTF-8 as the character encoding. More "
59  "precisely, the 'encoding' attribute of the XML declaration at the "
60  "beginning of the XML data stream cannot have a value other than "
61  "'UTF-8'. An example valid declaration is "
62  "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'. (References: L2V2 Section "
63  "4.1; L2V3 Section 4.1; L2V4 Section 4.1)"
64  },
65 
66  //10102
67  {
69  "Unrecognized element",
72  "An NUML XML document must not contain undefined elements or attributes "
73  "in the NUML namespace. Documents containing unknown elements or "
74  "attributes placed in the NUML namespace do not conform to the NUML "
75  "specification. (References: L2V2 Section 4.1; L2V3 Section 4.1; L2V4 "
76  "Section 4.1)"
77  },
78 
79  //10103
80  {
82  "Not conformant to NUML XML schema",
85  "An NUML XML document must conform to the XML Schema for the corresponding "
86  "NUML Level, Version and Release. The XML Schema for NUML defines the "
87  "basic NUML object structure, the data types used by those objects, and the "
88  "order in which the objects may appear in an NUML document."
89  },
90 
91  //10401
92  {
94  "Missing declaration of XML namespace for annotation",
97  "Every top-level element within an annotation element must "
98  "have a namespace declared. (References: L1V1 Section ??"
99  },
100 
101  //10402
102  {
104  "Multiple annotations using same XML namespace",
107  "There cannot be more than one top-level element using a "
108  "given namespace inside a given annotation element. "
109  "(References: L1V1 Section ??"
110  },
111 
112  //10403
113  {
115  "Invalid use of NUML XML namespace in annotation",
118  "Top-level elements within an annotation element cannot use any NUML "
119  "namespace, whether explicitly (by declaring the namespace to be one of "
120  "the URIs \"http://www.numl.org/numl/level1\", Section ??"
121  },
122 
123  //20101
124  {
126  "Invalid XML namespace for NUML container",
129  "The <numl> container element must declare the XML Namespace for NUML, "
130  "and this declaration must be consistent with the values of the 'level' "
131  "and 'version' attributes on the <numl> element."
132  "Section XXX TODO)"
133  },
134  //21003
135  {
137  "Constraint message is not in XHTML XML namespace",
140  "The contents of the <message> element in a <constraint> must be "
141  "explicitly placed in the XHTML XML namespace. (References: L1V1 Section TODO)"
142  },
143 
144  //21004
145  {
147  "XML declarations not permitted in constraint messages",
150  "The contents of the <message> element must not contain an XML declaration "
151  "(i.e., a string of the form \"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\" "
152  },
153 
154  //21005
155  {
157  "XML DOCTYPE not permitted in constraint messages",
160  "The contents of the message element must not contain an XML DOCTYPE "
161  "declaration (i.e., a string beginning with the characters \"<!DOCTYPE\". "
162  "(References: L1V1 Section TODO)"
163  },
164 
165  //21006
166  {
168  "Invalid content for constraint message",
171  "The XHTML content inside a <constraint>s message element can only take one "
172  "of the following general forms: (1) a complete XHTML document beginning "
173  "with the element <html> and ending with </html>; (2) the \"body\" portion "
174  "of a document beginning with the element <body> and ending with </body>; "
175  "or (3) XHTML content that is permitted within a <body> ... </body> "
176  "elements. (References: L1V1 Section ??"
177  },
178 
179 
180  //99101
181  {
183  "Invalid NUML Level and Version",
186  "The level and version specified for the document must be "
187  "consistent with a valid published NUML specification. These are "
188  "Level 1, Versions 1"
189  },
190 
191  //99301
192  {
194  "<csymbol> for 'time' used within the <math> of a function definition",
197  "The csymbol 'time' should not be used within a the <math> element "
198  "of a <FunctionDefinition>. (References: L2V3 Section 4.3.2; "
199  "L2V4 Section 4.3.2)"
200  },
201 
202  //99502
203  // This is an internal error that reverts to 10501
204 /* {
205  InconsistentArgUnitsWarnings,
206  "",
207  LIBNUML_SEV_GENERAL_WARNING,
208  LIBNUML_SEV_WARNING,
209  ""
210  },
211 */
212 
213  //99701
214  /* {
215  UnrecognisedSBOTerm,
216  "Unrecognized 'sboTerm' value",
217  LIBNUML_CAT_SBO_CONSISTENCY,
218  LIBNUML_SEV_WARNING,
219  "The SBOTerm used is not recognised by libNUML and therefore the correct "
220  "parentage cannot be checked. However, since libNUML is referring to a "
221  "snapshot of the SBO tree the term may now exist."
222  },
223 
224  //99701
225  {
226  ObseleteSBOTerm,
227  "Obsolete 'sboTerm' value",
228  LIBNUML_CAT_SBO_CONSISTENCY,
229  LIBNUML_SEV_WARNING,
230  "The SBOTerm value used is considered obsolete."
231  },
232 */
233  //99901
234  /* {
235  IncorrectCompartmentSpatialDimensions,
236  "in NUML Level 1, only three-dimensional compartments are permitted",
237  LIBNUML_CAT_INTERNAL_CONSISTENCY,
238  LIBNUML_SEV_ERROR,
239  "The 'spatialDimensions' attribute on <compartment> was not available "
240  "in NUML Level 1. In order for the internal respresentation of a "
241  "<compartment> to be correct, the value for the spatialDimensions "
242  "member variable should be '3'."
243  },
244 */
245  //99925
246 /* {
247  OffsetNotValidAttribute,
248  "Attribute 'offset' on units only available in NUML Level 2 Version 1",
249  LIBNUML_CAT_INTERNAL_CONSISTENCY,
250  LIBNUML_SEV_ERROR,
251  "The 'offset' attribute on <unit> was only available in NUML Level 2 "
252  "Version 1. In order for the internal respresentation of a <unit> to "
253  "be correct, the value for the offset member variable should be '0'."
254  }
255 */
256 
257 };
258 
260 
261 
XML DOCTYPE not permitted in constraint messages.
Definition: NUMLError.h:88
unsigned int l1v1_severity
Definition: NUMLErrorTable.h:37
const char * ref_l1
Definition: NUMLErrorTable.h:30
Not UTF8.
Definition: NUMLError.h:48
Invalid NUML Level and Version.
Definition: NUMLError.h:113
Definition: NUMLError.h:147
#define LIBNUML_CPP_NAMESPACE_BEGIN
Definition: libnuml-namespace.h:71
unsigned int category
Definition: NUMLErrorTable.h:36
Unknown internal libNUML error.
Definition: NUMLError.h:47
Invalid use of NUML XML namespace in annotation.
Definition: NUMLError.h:62
Not conformant to NUML XML schema.
Definition: NUMLError.h:50
const char * message
Definition: NUMLErrorTable.h:38
Constraint message is not in XHTML XML namespace.
Definition: NUMLError.h:86
Multiple annotations using same XML namespace.
Definition: NUMLError.h:61
unsigned int code
Definition: NUMLErrorTable.h:34
Definition: NUMLError.h:204
Invalid content for constraint message.
Definition: NUMLError.h:89
referenceEntry reference
Definition: NUMLErrorTable.h:39
Definition: NUMLError.h:203
Invalid XML namespace for NUML container.
Definition: NUMLError.h:76
Definition: NUMLErrorTable.h:29
XML declarations not permitted in constraint messages.
Definition: NUMLError.h:87
Definition: NUMLErrorTable.h:33
Category of errors that can occur while validating general NUML constructs.
Definition: NUMLError.h:163
General NUML error not falling into another category below.
Definition: NUMLError.h:149
#define LIBNUML_CPP_NAMESPACE_END
Definition: libnuml-namespace.h:72
static const numlErrorTableEntry errorTable[]
Definition: NUMLErrorTable.h:43
Missing declaration of XML namespace for annotation.
Definition: NUMLError.h:60
<csymbol> for time used within the <math> of a function definition
Definition: NUMLError.h:115
const char * shortMessage
Definition: NUMLErrorTable.h:35
Unrecognized element.
Definition: NUMLError.h:49