|
|
|
/*
|
|
|
|
__ __ _
|
|
|
|
___\ \/ /_ __ __ _| |_
|
|
|
|
/ _ \\ /| '_ \ / _` | __|
|
|
|
|
| __// \| |_) | (_| | |_
|
|
|
|
\___/_/\_\ .__/ \__,_|\__|
|
|
|
|
|_| XML parser
|
|
|
|
|
|
|
|
Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
|
|
|
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
|
|
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
|
|
|
Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
|
|
|
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
|
|
|
Licensed under the MIT license:
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
|
|
persons to whom the Software is furnished to do so, subject to the
|
|
|
|
following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included
|
|
|
|
in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
|
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ASCII_A 0x41
|
|
|
|
#define ASCII_B 0x42
|
|
|
|
#define ASCII_C 0x43
|
|
|
|
#define ASCII_D 0x44
|
|
|
|
#define ASCII_E 0x45
|
|
|
|
#define ASCII_F 0x46
|
|
|
|
#define ASCII_G 0x47
|
|
|
|
#define ASCII_H 0x48
|
|
|
|
#define ASCII_I 0x49
|
|
|
|
#define ASCII_J 0x4A
|
|
|
|
#define ASCII_K 0x4B
|
|
|
|
#define ASCII_L 0x4C
|
|
|
|
#define ASCII_M 0x4D
|
|
|
|
#define ASCII_N 0x4E
|
|
|
|
#define ASCII_O 0x4F
|
|
|
|
#define ASCII_P 0x50
|
|
|
|
#define ASCII_Q 0x51
|
|
|
|
#define ASCII_R 0x52
|
|
|
|
#define ASCII_S 0x53
|
|
|
|
#define ASCII_T 0x54
|
|
|
|
#define ASCII_U 0x55
|
|
|
|
#define ASCII_V 0x56
|
|
|
|
#define ASCII_W 0x57
|
|
|
|
#define ASCII_X 0x58
|
|
|
|
#define ASCII_Y 0x59
|
|
|
|
#define ASCII_Z 0x5A
|
|
|
|
|
|
|
|
#define ASCII_a 0x61
|
|
|
|
#define ASCII_b 0x62
|
|
|
|
#define ASCII_c 0x63
|
|
|
|
#define ASCII_d 0x64
|
|
|
|
#define ASCII_e 0x65
|
|
|
|
#define ASCII_f 0x66
|
|
|
|
#define ASCII_g 0x67
|
|
|
|
#define ASCII_h 0x68
|
|
|
|
#define ASCII_i 0x69
|
|
|
|
#define ASCII_j 0x6A
|
|
|
|
#define ASCII_k 0x6B
|
|
|
|
#define ASCII_l 0x6C
|
|
|
|
#define ASCII_m 0x6D
|
|
|
|
#define ASCII_n 0x6E
|
|
|
|
#define ASCII_o 0x6F
|
|
|
|
#define ASCII_p 0x70
|
|
|
|
#define ASCII_q 0x71
|
|
|
|
#define ASCII_r 0x72
|
|
|
|
#define ASCII_s 0x73
|
|
|
|
#define ASCII_t 0x74
|
|
|
|
#define ASCII_u 0x75
|
|
|
|
#define ASCII_v 0x76
|
|
|
|
#define ASCII_w 0x77
|
|
|
|
#define ASCII_x 0x78
|
|
|
|
#define ASCII_y 0x79
|
|
|
|
#define ASCII_z 0x7A
|
|
|
|
|
|
|
|
#define ASCII_0 0x30
|
|
|
|
#define ASCII_1 0x31
|
|
|
|
#define ASCII_2 0x32
|
|
|
|
#define ASCII_3 0x33
|
|
|
|
#define ASCII_4 0x34
|
|
|
|
#define ASCII_5 0x35
|
|
|
|
#define ASCII_6 0x36
|
|
|
|
#define ASCII_7 0x37
|
|
|
|
#define ASCII_8 0x38
|
|
|
|
#define ASCII_9 0x39
|
|
|
|
|
|
|
|
#define ASCII_TAB 0x09
|
|
|
|
#define ASCII_SPACE 0x20
|
|
|
|
#define ASCII_EXCL 0x21
|
|
|
|
#define ASCII_QUOT 0x22
|
|
|
|
#define ASCII_AMP 0x26
|
|
|
|
#define ASCII_APOS 0x27
|
|
|
|
#define ASCII_MINUS 0x2D
|
|
|
|
#define ASCII_PERIOD 0x2E
|
|
|
|
#define ASCII_COLON 0x3A
|
|
|
|
#define ASCII_SEMI 0x3B
|
|
|
|
#define ASCII_LT 0x3C
|
|
|
|
#define ASCII_EQUALS 0x3D
|
|
|
|
#define ASCII_GT 0x3E
|
|
|
|
#define ASCII_LSQB 0x5B
|
|
|
|
#define ASCII_RSQB 0x5D
|
|
|
|
#define ASCII_UNDERSCORE 0x5F
|
|
|
|
#define ASCII_LPAREN 0x28
|
|
|
|
#define ASCII_RPAREN 0x29
|
|
|
|
#define ASCII_FF 0x0C
|
|
|
|
#define ASCII_SLASH 0x2F
|
|
|
|
#define ASCII_HASH 0x23
|
|
|
|
#define ASCII_PIPE 0x7C
|
|
|
|
#define ASCII_COMMA 0x2C
|