/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to parse/parabix.20090922/src/xml_error.c

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-23 17:13:04 UTC
  • Revision ID: csa@dside.dyndns.org-20090923171304-osvtr4zqb29h11kd
Intel, Tango, Phobos, and RapidXML parsers; Memory benchmark scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  xml_error.c - Error reporting for XML parsing/validation.
 
2
    Copyright (c) 2008, Robert D. Cameron and Dan Lin.
 
3
    Licensed to the public under the Open Software License 3.0.
 
4
    Licensed to International Characters, Inc., under the Academic
 
5
    Free License 3.0.
 
6
*/
 
7
 
 
8
#include "xml_error.h"
 
9
 
 
10
void ShowConstraintError(XML_Constraint errCode) {
 
11
        if (errCode < vErr_vc_roottype) {
 
12
                fprintf(stderr, "Violation of well-formedness constraint: %s\n", XML_Constraint_Strings[errCode]);
 
13
                exit(-1);
 
14
        }
 
15
        else {
 
16
                fprintf(stderr, "Violation of validity constraint: %s\n", XML_Constraint_Strings[errCode]);
 
17
                exit(-1);
 
18
        }
 
19
}
 
20
 
 
21
void ShowSyntaxError(XML_NonTerminal errCode) {
 
22
        fprintf(stderr, "Syntax error in production: %s\n", XML_NonTerminal_Names[errCode]);
 
23
}
 
24
 
 
25
 
 
26
void NoEncodingError(const char * msg) {
 
27
        fprintf(stderr, "Error : %s\n", msg);
 
28
        exit(-1);
 
29
}
 
30
 
 
31
void EncodingError(const char * msg, unsigned char * encoding, int lgth) {
 
32
        fprintf(stderr, "Error : Illegal/unsupported %s encoding of length %i: \"", msg, lgth);
 
33
        for (int i = 0; i < lgth; i++) fprintf(stderr, "%c", encoding[i]);
 
34
        fprintf(stderr, "\"\n");
 
35
        exit(-1);
 
36
}
 
37
 
 
38
void CharSetValidationError(const char * encoding, int err_pos) {
 
39
        fprintf(stderr, "Error: Invalid %s character in input stream at position %i\n", encoding, err_pos);
 
40
        exit(-1);
 
41
}
 
42
 
 
43
void XMLCharacterError(int err_pos) {
 
44
        fprintf(stderr, "Illegal control character in XML input stream at position %i\n", err_pos);
 
45
        exit(-1);
 
46
}
 
47
 
 
48
void IncompleteCodeUnitError() {
 
49
        fprintf(stderr, "Error: Incomplete code unit at end of file.\n");
 
50
        exit(-1);
 
51
}
 
52
 
 
53
void DeclarationError(int pos) {
 
54
        fprintf(stderr, "Parsing error at position %i in XML or Text declaration.\n", pos);
 
55
        exit(-1);
 
56
}
 
57
 
 
58
void ImplementationLimitError(const char * msg) {
 
59
        fprintf(stderr, "Fatal implementation limit - %s\n", msg);
 
60
        exit(-1);
 
61
}
 
62
 
 
63
void ContentModelError() {
 
64
        fprintf(stderr, "Error: nondeterminism in content model.\n");
 
65
        exit(-1);
 
66
}
 
67