0000: 2f 2a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 /*.
0010: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f _
0020: 5f 20 20 5f 5f 20 20 20 20 20 20 20 20 20 20 20 _ __
0030: 20 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 _.
0040: 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 5c ___\
0050: 20 5c 2f 20 2f 5f 20 5f 5f 20 20 20 5f 5f 20 5f \/ /_ __ __ _
0060: 7c 20 7c 5f 0a 20 20 20 20 20 20 20 20 20 20 20 | |_.
0070: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 5f / _
0080: 20 5c 5c 20 20 2f 7c 20 27 5f 20 5c 20 2f 20 5f \\ /| '_ \ / _
0090: 60 20 7c 20 5f 5f 7c 0a 20 20 20 20 20 20 20 20 ` | __|.
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c |
00b0: 20 20 5f 5f 2f 2f 20 20 5c 7c 20 7c 5f 29 20 7c __// \| |_) |
00c0: 20 28 5f 7c 20 7c 20 7c 5f 0a 20 20 20 20 20 20 (_| | |_.
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00e0: 20 20 5c 5f 5f 5f 2f 5f 2f 5c 5f 5c 20 2e 5f 5f \___/_/\_\ .__
00f0: 2f 20 5c 5f 5f 2c 5f 7c 5c 5f 5f 7c 0a 20 20 20 / \__,_|\__|.
0100: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 5f |_
0120: 7c 20 58 4d 4c 20 70 61 72 73 65 72 0a 0a 20 20 | XML parser..
0130: 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 31 Copyright (c) 1
0140: 39 39 37 2d 32 30 30 30 20 54 68 61 69 20 4f 70 997-2000 Thai Op
0150: 65 6e 20 53 6f 75 72 63 65 20 53 6f 66 74 77 61 en Source Softwa
0160: 72 65 20 43 65 6e 74 65 72 20 4c 74 64 0a 20 20 re Center Ltd.
0170: 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 Copyright (c) 2
0180: 30 30 30 2d 32 30 31 37 20 45 78 70 61 74 20 64 000-2017 Expat d
0190: 65 76 65 6c 6f 70 6d 65 6e 74 20 74 65 61 6d 0a evelopment team.
01a0: 20 20 20 4c 69 63 65 6e 73 65 64 20 75 6e 64 65 Licensed unde
01b0: 72 20 74 68 65 20 4d 49 54 20 6c 69 63 65 6e 73 r the MIT licens
01c0: 65 3a 0a 0a 20 20 20 50 65 72 6d 69 73 73 69 6f e:.. Permissio
01d0: 6e 20 69 73 20 20 68 65 72 65 62 79 20 67 72 61 n is hereby gra
01e0: 6e 74 65 64 2c 20 20 66 72 65 65 20 6f 66 20 63 nted, free of c
01f0: 68 61 72 67 65 2c 20 20 74 6f 20 61 6e 79 20 20 harge, to any
0200: 70 65 72 73 6f 6e 20 6f 62 74 61 69 6e 69 6e 67 person obtaining
0210: 0a 20 20 20 61 20 20 63 6f 70 79 20 20 6f 66 20 . a copy of
0220: 20 74 68 69 73 20 20 73 6f 66 74 77 61 72 65 20 this software
0230: 20 20 61 6e 64 20 20 61 73 73 6f 63 69 61 74 65 and associate
0240: 64 20 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e d documentation
0250: 20 20 66 69 6c 65 73 20 20 28 74 68 65 0a 20 20 files (the.
0260: 20 22 53 6f 66 74 77 61 72 65 22 29 2c 20 20 74 "Software"), t
0270: 6f 20 20 64 65 61 6c 20 69 6e 20 20 74 68 65 20 o deal in the
0280: 20 53 6f 66 74 77 61 72 65 20 20 77 69 74 68 6f Software witho
0290: 75 74 20 72 65 73 74 72 69 63 74 69 6f 6e 2c 20 ut restriction,
02a0: 20 69 6e 63 6c 75 64 69 6e 67 0a 20 20 20 77 69 including. wi
02b0: 74 68 6f 75 74 20 20 6c 69 6d 69 74 61 74 69 6f thout limitatio
02c0: 6e 20 74 68 65 20 20 72 69 67 68 74 73 20 20 74 n the rights t
02d0: 6f 20 75 73 65 2c 20 20 63 6f 70 79 2c 20 20 6d o use, copy, m
02e0: 6f 64 69 66 79 2c 20 6d 65 72 67 65 2c 20 20 70 odify, merge, p
02f0: 75 62 6c 69 73 68 2c 0a 20 20 20 64 69 73 74 72 ublish,. distr
0300: 69 62 75 74 65 2c 20 73 75 62 6c 69 63 65 6e 73 ibute, sublicens
0310: 65 2c 20 61 6e 64 2f 6f 72 20 73 65 6c 6c 20 63 e, and/or sell c
0320: 6f 70 69 65 73 20 6f 66 20 74 68 65 20 53 6f 66 opies of the Sof
0330: 74 77 61 72 65 2c 20 61 6e 64 20 74 6f 20 70 65 tware, and to pe
0340: 72 6d 69 74 0a 20 20 20 70 65 72 73 6f 6e 73 20 rmit. persons
0350: 20 74 6f 20 77 68 6f 6d 20 20 74 68 65 20 53 6f to whom the So
0360: 66 74 77 61 72 65 20 20 69 73 20 20 66 75 72 6e ftware is furn
0370: 69 73 68 65 64 20 74 6f 20 20 64 6f 20 73 6f 2c ished to do so,
0380: 20 20 73 75 62 6a 65 63 74 20 74 6f 20 20 74 68 subject to th
0390: 65 0a 20 20 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 e. following c
03a0: 6f 6e 64 69 74 69 6f 6e 73 3a 0a 0a 20 20 20 54 onditions:.. T
03b0: 68 65 20 61 62 6f 76 65 20 63 6f 70 79 72 69 67 he above copyrig
03c0: 68 74 20 20 6e 6f 74 69 63 65 20 61 6e 64 20 74 ht notice and t
03d0: 68 69 73 20 70 65 72 6d 69 73 73 69 6f 6e 20 6e his permission n
03e0: 6f 74 69 63 65 20 20 73 68 61 6c 6c 20 62 65 20 otice shall be
03f0: 69 6e 63 6c 75 64 65 64 0a 20 20 20 69 6e 20 61 included. in a
0400: 6c 6c 20 63 6f 70 69 65 73 20 6f 72 20 73 75 62 ll copies or sub
0410: 73 74 61 6e 74 69 61 6c 20 70 6f 72 74 69 6f 6e stantial portion
0420: 73 20 6f 66 20 74 68 65 20 53 6f 66 74 77 61 72 s of the Softwar
0430: 65 2e 0a 0a 20 20 20 54 48 45 20 20 53 4f 46 54 e... THE SOFT
0440: 57 41 52 45 20 20 49 53 20 20 50 52 4f 56 49 44 WARE IS PROVID
0450: 45 44 20 20 22 41 53 20 20 49 53 22 2c 20 20 57 ED "AS IS", W
0460: 49 54 48 4f 55 54 20 20 57 41 52 52 41 4e 54 59 ITHOUT WARRANTY
0470: 20 20 4f 46 20 20 41 4e 59 20 20 4b 49 4e 44 2c OF ANY KIND,
0480: 0a 20 20 20 45 58 50 52 45 53 53 20 20 4f 52 20 . EXPRESS OR
0490: 49 4d 50 4c 49 45 44 2c 20 20 49 4e 43 4c 55 44 IMPLIED, INCLUD
04a0: 49 4e 47 20 20 42 55 54 20 20 4e 4f 54 20 4c 49 ING BUT NOT LI
04b0: 4d 49 54 45 44 20 20 54 4f 20 20 54 48 45 20 57 MITED TO THE W
04c0: 41 52 52 41 4e 54 49 45 53 20 20 4f 46 0a 20 20 ARRANTIES OF.
04d0: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
04e0: 2c 20 46 49 54 4e 45 53 53 20 46 4f 52 20 41 20 , FITNESS FOR A
04f0: 50 41 52 54 49 43 55 4c 41 52 20 50 55 52 50 4f PARTICULAR PURPO
0500: 53 45 20 41 4e 44 20 4e 4f 4e 49 4e 46 52 49 4e SE AND NONINFRIN
0510: 47 45 4d 45 4e 54 2e 20 49 4e 0a 20 20 20 4e 4f GEMENT. IN. NO
0520: 20 45 56 45 4e 54 20 53 48 41 4c 4c 20 54 48 45 EVENT SHALL THE
0530: 20 41 55 54 48 4f 52 53 20 4f 52 20 20 43 4f 50 AUTHORS OR COP
0540: 59 52 49 47 48 54 20 48 4f 4c 44 45 52 53 20 42 YRIGHT HOLDERS B
0550: 45 20 4c 49 41 42 4c 45 20 46 4f 52 20 41 4e 59 E LIABLE FOR ANY
0560: 20 43 4c 41 49 4d 2c 0a 20 20 20 44 41 4d 41 47 CLAIM,. DAMAG
0570: 45 53 20 4f 52 20 20 4f 54 48 45 52 20 4c 49 41 ES OR OTHER LIA
0580: 42 49 4c 49 54 59 2c 20 57 48 45 54 48 45 52 20 BILITY, WHETHER
0590: 20 49 4e 20 41 4e 20 20 41 43 54 49 4f 4e 20 4f IN AN ACTION O
05a0: 46 20 43 4f 4e 54 52 41 43 54 2c 20 20 54 4f 52 F CONTRACT, TOR
05b0: 54 20 4f 52 0a 20 20 20 4f 54 48 45 52 57 49 53 T OR. OTHERWIS
05c0: 45 2c 20 41 52 49 53 49 4e 47 20 46 52 4f 4d 2c E, ARISING FROM,
05d0: 20 4f 55 54 20 4f 46 20 4f 52 20 49 4e 20 43 4f OUT OF OR IN CO
05e0: 4e 4e 45 43 54 49 4f 4e 20 57 49 54 48 20 54 48 NNECTION WITH TH
05f0: 45 20 53 4f 46 54 57 41 52 45 20 4f 52 20 54 48 E SOFTWARE OR TH
0600: 45 0a 20 20 20 55 53 45 20 4f 52 20 4f 54 48 45 E. USE OR OTHE
0610: 52 20 44 45 41 4c 49 4e 47 53 20 49 4e 20 54 48 R DEALINGS IN TH
0620: 45 20 53 4f 46 54 57 41 52 45 2e 0a 2a 2f 0a 0a E SOFTWARE..*/..
0630: 23 69 66 6e 64 65 66 20 58 6d 6c 54 6f 6b 5f 49 #ifndef XmlTok_I
0640: 4e 43 4c 55 44 45 44 0a 23 64 65 66 69 6e 65 20 NCLUDED.#define
0650: 58 6d 6c 54 6f 6b 5f 49 4e 43 4c 55 44 45 44 20 XmlTok_INCLUDED
0660: 31 0a 0a 23 69 66 64 65 66 20 5f 5f 63 70 6c 75 1..#ifdef __cplu
0670: 73 70 6c 75 73 0a 65 78 74 65 72 6e 20 22 43 22 splus.extern "C"
0680: 20 7b 0a 23 65 6e 64 69 66 0a 0a 2f 2a 20 54 68 {.#endif../* Th
0690: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 6f 6b 65 e following toke
06a0: 6e 20 6d 61 79 20 62 65 20 72 65 74 75 72 6e 65 n may be returne
06b0: 64 20 62 79 20 58 6d 6c 43 6f 6e 74 65 6e 74 54 d by XmlContentT
06c0: 6f 6b 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d ok */.#define XM
06d0: 4c 5f 54 4f 4b 5f 54 52 41 49 4c 49 4e 47 5f 52 L_TOK_TRAILING_R
06e0: 53 51 42 20 2d 35 20 2f 2a 20 5d 20 6f 72 20 5d SQB -5 /* ] or ]
06f0: 5d 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 ] at the end of
0700: 74 68 65 20 73 63 61 6e 3b 20 6d 69 67 68 74 20 the scan; might
0710: 62 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 be.
0720: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0730: 20 20 20 20 20 20 20 73 74 61 72 74 20 6f 66 20 start of
0740: 69 6c 6c 65 67 61 6c 20 5d 5d 3e 20 73 65 71 75 illegal ]]> sequ
0750: 65 6e 63 65 20 2a 2f 0a 2f 2a 20 54 68 65 20 66 ence */./* The f
0760: 6f 6c 6c 6f 77 69 6e 67 20 74 6f 6b 65 6e 73 20 ollowing tokens
0770: 6d 61 79 20 62 65 20 72 65 74 75 72 6e 65 64 20 may be returned
0780: 62 79 20 62 6f 74 68 20 58 6d 6c 50 72 6f 6c 6f by both XmlProlo
0790: 67 54 6f 6b 20 61 6e 64 0a 20 20 20 58 6d 6c 43 gTok and. XmlC
07a0: 6f 6e 74 65 6e 74 54 6f 6b 2e 0a 2a 2f 0a 23 64 ontentTok..*/.#d
07b0: 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 4e 4f efine XML_TOK_NO
07c0: 4e 45 20 2d 34 20 20 20 20 20 20 20 20 20 20 2f NE -4 /
07d0: 2a 20 54 68 65 20 73 74 72 69 6e 67 20 74 6f 20 * The string to
07e0: 62 65 20 73 63 61 6e 6e 65 64 20 69 73 20 65 6d be scanned is em
07f0: 70 74 79 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 pty */.#define X
0800: 4d 4c 5f 54 4f 4b 5f 54 52 41 49 4c 49 4e 47 5f ML_TOK_TRAILING_
0810: 43 52 20 2d 33 20 20 20 2f 2a 20 41 20 43 52 20 CR -3 /* A CR
0820: 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 at the end of th
0830: 65 20 73 63 61 6e 3b 0a 20 20 20 20 20 20 20 20 e scan;.
0840: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0850: 20 20 20 20 20 20 20 20 20 20 20 20 6d 69 67 68 migh
0860: 74 20 62 65 20 70 61 72 74 20 6f 66 20 43 52 4c t be part of CRL
0870: 46 20 73 65 71 75 65 6e 63 65 20 2a 2f 0a 23 64 F sequence */.#d
0880: 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 50 41 efine XML_TOK_PA
0890: 52 54 49 41 4c 5f 43 48 41 52 20 2d 32 20 20 2f RTIAL_CHAR -2 /
08a0: 2a 20 6f 6e 6c 79 20 70 61 72 74 20 6f 66 20 61 * only part of a
08b0: 20 6d 75 6c 74 69 62 79 74 65 20 73 65 71 75 65 multibyte seque
08c0: 6e 63 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 nce */.#define X
08d0: 4d 4c 5f 54 4f 4b 5f 50 41 52 54 49 41 4c 20 2d ML_TOK_PARTIAL -
08e0: 31 20 20 20 20 20 20 20 2f 2a 20 6f 6e 6c 79 20 1 /* only
08f0: 70 61 72 74 20 6f 66 20 61 20 74 6f 6b 65 6e 20 part of a token
0900: 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 */.#define XML_T
0910: 4f 4b 5f 49 4e 56 41 4c 49 44 20 30 0a 0a 2f 2a OK_INVALID 0../*
0920: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 The following t
0930: 6f 6b 65 6e 73 20 61 72 65 20 72 65 74 75 72 6e okens are return
0940: 65 64 20 62 79 20 58 6d 6c 43 6f 6e 74 65 6e 74 ed by XmlContent
0950: 54 6f 6b 3b 20 73 6f 6d 65 20 61 72 65 20 61 6c Tok; some are al
0960: 73 6f 0a 20 20 20 72 65 74 75 72 6e 65 64 20 62 so. returned b
0970: 79 20 58 6d 6c 41 74 74 72 69 62 75 74 65 56 61 y XmlAttributeVa
0980: 6c 75 65 54 6f 6b 2c 20 58 6d 6c 45 6e 74 69 74 lueTok, XmlEntit
0990: 79 54 6f 6b 2c 20 58 6d 6c 43 64 61 74 61 53 65 yTok, XmlCdataSe
09a0: 63 74 69 6f 6e 54 6f 6b 2e 0a 2a 2f 0a 23 64 65 ctionTok..*/.#de
09b0: 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 53 54 41 fine XML_TOK_STA
09c0: 52 54 5f 54 41 47 5f 57 49 54 48 5f 41 54 54 53 RT_TAG_WITH_ATTS
09d0: 20 31 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 1.#define XML_T
09e0: 4f 4b 5f 53 54 41 52 54 5f 54 41 47 5f 4e 4f 5f OK_START_TAG_NO_
09f0: 41 54 54 53 20 32 0a 23 64 65 66 69 6e 65 20 58 ATTS 2.#define X
0a00: 4d 4c 5f 54 4f 4b 5f 45 4d 50 54 59 5f 45 4c 45 ML_TOK_EMPTY_ELE
0a10: 4d 45 4e 54 5f 57 49 54 48 5f 41 54 54 53 20 33 MENT_WITH_ATTS 3
0a20: 20 2f 2a 20 65 6d 70 74 79 20 65 6c 65 6d 65 6e /* empty elemen
0a30: 74 20 74 61 67 20 3c 65 2f 3e 20 2a 2f 0a 23 64 t tag <e/> */.#d
0a40: 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 45 4d efine XML_TOK_EM
0a50: 50 54 59 5f 45 4c 45 4d 45 4e 54 5f 4e 4f 5f 41 PTY_ELEMENT_NO_A
0a60: 54 54 53 20 34 0a 23 64 65 66 69 6e 65 20 58 4d TTS 4.#define XM
0a70: 4c 5f 54 4f 4b 5f 45 4e 44 5f 54 41 47 20 35 0a L_TOK_END_TAG 5.
0a80: 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f #define XML_TOK_
0a90: 44 41 54 41 5f 43 48 41 52 53 20 36 0a 23 64 65 DATA_CHARS 6.#de
0aa0: 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 44 41 54 fine XML_TOK_DAT
0ab0: 41 5f 4e 45 57 4c 49 4e 45 20 37 0a 23 64 65 66 A_NEWLINE 7.#def
0ac0: 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 44 41 54 ine XML_TOK_CDAT
0ad0: 41 5f 53 45 43 54 5f 4f 50 45 4e 20 38 0a 23 64 A_SECT_OPEN 8.#d
0ae0: 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 45 4e efine XML_TOK_EN
0af0: 54 49 54 59 5f 52 45 46 20 39 0a 23 64 65 66 69 TITY_REF 9.#defi
0b00: 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 48 41 52 5f ne XML_TOK_CHAR_
0b10: 52 45 46 20 31 30 20 20 20 20 20 20 20 20 20 20 REF 10
0b20: 20 20 20 20 20 2f 2a 20 6e 75 6d 65 72 69 63 20 /* numeric
0b30: 63 68 61 72 61 63 74 65 72 20 72 65 66 65 72 65 character refere
0b40: 6e 63 65 20 2a 2f 0a 0a 2f 2a 20 54 68 65 20 66 nce */../* The f
0b50: 6f 6c 6c 6f 77 69 6e 67 20 74 6f 6b 65 6e 73 20 ollowing tokens
0b60: 6d 61 79 20 62 65 20 72 65 74 75 72 6e 65 64 20 may be returned
0b70: 62 79 20 62 6f 74 68 20 58 6d 6c 50 72 6f 6c 6f by both XmlProlo
0b80: 67 54 6f 6b 20 61 6e 64 0a 20 20 20 58 6d 6c 43 gTok and. XmlC
0b90: 6f 6e 74 65 6e 74 54 6f 6b 2e 0a 2a 2f 0a 23 64 ontentTok..*/.#d
0ba0: 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 50 49 efine XML_TOK_PI
0bb0: 20 31 31 20 20 20 20 20 20 20 20 20 20 20 20 20 11
0bc0: 20 20 20 20 20 20 20 20 2f 2a 20 70 72 6f 63 65 /* proce
0bd0: 73 73 69 6e 67 20 69 6e 73 74 72 75 63 74 69 6f ssing instructio
0be0: 6e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d 4c n */.#define XML
0bf0: 5f 54 4f 4b 5f 58 4d 4c 5f 44 45 43 4c 20 31 32 _TOK_XML_DECL 12
0c00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f /
0c10: 2a 20 58 4d 4c 20 64 65 63 6c 20 6f 72 20 74 65 * XML decl or te
0c20: 78 74 20 64 65 63 6c 20 2a 2f 0a 23 64 65 66 69 xt decl */.#defi
0c30: 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 4f 4d 4d 45 ne XML_TOK_COMME
0c40: 4e 54 20 31 33 0a 23 64 65 66 69 6e 65 20 58 4d NT 13.#define XM
0c50: 4c 5f 54 4f 4b 5f 42 4f 4d 20 31 34 20 20 20 20 L_TOK_BOM 14
0c60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0c70: 2f 2a 20 42 79 74 65 20 6f 72 64 65 72 20 6d 61 /* Byte order ma
0c80: 72 6b 20 2a 2f 0a 0a 2f 2a 20 54 68 65 20 66 6f rk */../* The fo
0c90: 6c 6c 6f 77 69 6e 67 20 74 6f 6b 65 6e 73 20 61 llowing tokens a
0ca0: 72 65 20 72 65 74 75 72 6e 65 64 20 6f 6e 6c 79 re returned only
0cb0: 20 62 79 20 58 6d 6c 50 72 6f 6c 6f 67 54 6f 6b by XmlPrologTok
0cc0: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f */.#define XML_
0cd0: 54 4f 4b 5f 50 52 4f 4c 4f 47 5f 53 20 31 35 0a TOK_PROLOG_S 15.
0ce0: 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f #define XML_TOK_
0cf0: 44 45 43 4c 5f 4f 50 45 4e 20 31 36 20 20 20 20 DECL_OPEN 16
0d00: 20 20 20 20 20 20 20 20 20 20 2f 2a 20 3c 21 66 /* <!f
0d10: 6f 6f 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d oo */.#define XM
0d20: 4c 5f 54 4f 4b 5f 44 45 43 4c 5f 43 4c 4f 53 45 L_TOK_DECL_CLOSE
0d30: 20 31 37 20 20 20 20 20 20 20 20 20 20 20 20 20 17
0d40: 2f 2a 20 3e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 /* > */.#define
0d50: 58 4d 4c 5f 54 4f 4b 5f 4e 41 4d 45 20 31 38 0a XML_TOK_NAME 18.
0d60: 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f #define XML_TOK_
0d70: 4e 4d 54 4f 4b 45 4e 20 31 39 0a 23 64 65 66 69 NMTOKEN 19.#defi
0d80: 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 50 4f 55 4e 44 ne XML_TOK_POUND
0d90: 5f 4e 41 4d 45 20 32 30 20 20 20 20 20 20 20 20 _NAME 20
0da0: 20 20 20 20 20 2f 2a 20 23 6e 61 6d 65 20 2a 2f /* #name */
0db0: 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b .#define XML_TOK
0dc0: 5f 4f 52 20 32 31 20 20 20 20 20 20 20 20 20 20 _OR 21
0dd0: 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 7c 20 /* |
0de0: 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 */.#define XML_T
0df0: 4f 4b 5f 50 45 52 43 45 4e 54 20 32 32 0a 23 64 OK_PERCENT 22.#d
0e00: 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 4f 50 efine XML_TOK_OP
0e10: 45 4e 5f 50 41 52 45 4e 20 32 33 0a 23 64 65 66 EN_PAREN 23.#def
0e20: 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 4c 4f 53 ine XML_TOK_CLOS
0e30: 45 5f 50 41 52 45 4e 20 32 34 0a 23 64 65 66 69 E_PAREN 24.#defi
0e40: 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 4f 50 45 4e 5f ne XML_TOK_OPEN_
0e50: 42 52 41 43 4b 45 54 20 32 35 0a 23 64 65 66 69 BRACKET 25.#defi
0e60: 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 4c 4f 53 45 ne XML_TOK_CLOSE
0e70: 5f 42 52 41 43 4b 45 54 20 32 36 0a 23 64 65 66 _BRACKET 26.#def
0e80: 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 4c 49 54 45 ine XML_TOK_LITE
0e90: 52 41 4c 20 32 37 0a 23 64 65 66 69 6e 65 20 58 RAL 27.#define X
0ea0: 4d 4c 5f 54 4f 4b 5f 50 41 52 41 4d 5f 45 4e 54 ML_TOK_PARAM_ENT
0eb0: 49 54 59 5f 52 45 46 20 32 38 0a 23 64 65 66 69 ITY_REF 28.#defi
0ec0: 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 49 4e 53 54 41 ne XML_TOK_INSTA
0ed0: 4e 43 45 5f 53 54 41 52 54 20 32 39 0a 0a 2f 2a NCE_START 29../*
0ee0: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f The following o
0ef0: 63 63 75 72 20 6f 6e 6c 79 20 69 6e 20 65 6c 65 ccur only in ele
0f00: 6d 65 6e 74 20 74 79 70 65 20 64 65 63 6c 61 72 ment type declar
0f10: 61 74 69 6f 6e 73 20 2a 2f 0a 23 64 65 66 69 6e ations */.#defin
0f20: 65 20 58 4d 4c 5f 54 4f 4b 5f 4e 41 4d 45 5f 51 e XML_TOK_NAME_Q
0f30: 55 45 53 54 49 4f 4e 20 33 30 20 20 20 20 20 20 UESTION 30
0f40: 20 20 20 20 2f 2a 20 6e 61 6d 65 3f 20 2a 2f 0a /* name? */.
0f50: 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f #define XML_TOK_
0f60: 4e 41 4d 45 5f 41 53 54 45 52 49 53 4b 20 33 31 NAME_ASTERISK 31
0f70: 20 20 20 20 20 20 20 20 20 20 2f 2a 20 6e 61 6d /* nam
0f80: 65 2a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d e* */.#define XM
0f90: 4c 5f 54 4f 4b 5f 4e 41 4d 45 5f 50 4c 55 53 20 L_TOK_NAME_PLUS
0fa0: 33 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32
0fb0: 2f 2a 20 6e 61 6d 65 2b 20 2a 2f 0a 23 64 65 66 /* name+ */.#def
0fc0: 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 4f 4e 44 ine XML_TOK_COND
0fd0: 5f 53 45 43 54 5f 4f 50 45 4e 20 33 33 20 20 20 _SECT_OPEN 33
0fe0: 20 20 20 20 20 20 2f 2a 20 3c 21 5b 20 2a 2f 0a /* <![ */.
0ff0: 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f #define XML_TOK_
1000: 43 4f 4e 44 5f 53 45 43 54 5f 43 4c 4f 53 45 20 COND_SECT_CLOSE
1010: 33 34 20 20 20 20 20 20 20 20 2f 2a 20 5d 5d 3e 34 /* ]]>
1020: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f */.#define XML_
1030: 54 4f 4b 5f 43 4c 4f 53 45 5f 50 41 52 45 4e 5f TOK_CLOSE_PAREN_
1040: 51 55 45 53 54 49 4f 4e 20 33 35 20 20 20 2f 2a QUESTION 35 /*
1050: 20 29 3f 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 )? */.#define X
1060: 4d 4c 5f 54 4f 4b 5f 43 4c 4f 53 45 5f 50 41 52 ML_TOK_CLOSE_PAR
1070: 45 4e 5f 41 53 54 45 52 49 53 4b 20 33 36 20 20 EN_ASTERISK 36
1080: 20 2f 2a 20 29 2a 20 2a 2f 0a 23 64 65 66 69 6e /* )* */.#defin
1090: 65 20 58 4d 4c 5f 54 4f 4b 5f 43 4c 4f 53 45 5f e XML_TOK_CLOSE_
10a0: 50 41 52 45 4e 5f 50 4c 55 53 20 33 37 20 20 20 PAREN_PLUS 37
10b0: 20 20 20 20 2f 2a 20 29 2b 20 2a 2f 0a 23 64 65 /* )+ */.#de
10c0: 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b 5f 43 4f 4d fine XML_TOK_COM
10d0: 4d 41 20 33 38 0a 0a 2f 2a 20 54 68 65 20 66 6f MA 38../* The fo
10e0: 6c 6c 6f 77 69 6e 67 20 74 6f 6b 65 6e 20 69 73 llowing token is
10f0: 20 72 65 74 75 72 6e 65 64 20 6f 6e 6c 79 20 62 returned only b
1100: 79 20 58 6d 6c 41 74 74 72 69 62 75 74 65 56 61 y XmlAttributeVa
1110: 6c 75 65 54 6f 6b 20 2a 2f 0a 23 64 65 66 69 6e lueTok */.#defin
1120: 65 20 58 4d 4c 5f 54 4f 4b 5f 41 54 54 52 49 42 e XML_TOK_ATTRIB
1130: 55 54 45 5f 56 41 4c 55 45 5f 53 20 33 39 0a 0a UTE_VALUE_S 39..
1140: 2f 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 /* The following
1150: 20 74 6f 6b 65 6e 20 69 73 20 72 65 74 75 72 6e token is return
1160: 65 64 20 6f 6e 6c 79 20 62 79 20 58 6d 6c 43 64 ed only by XmlCd
1170: 61 74 61 53 65 63 74 69 6f 6e 54 6f 6b 20 2a 2f ataSectionTok */
1180: 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 4f 4b .#define XML_TOK
1190: 5f 43 44 41 54 41 5f 53 45 43 54 5f 43 4c 4f 53 _CDATA_SECT_CLOS
11a0: 45 20 34 30 0a 0a 2f 2a 20 57 69 74 68 20 6e 61 E 40../* With na
11b0: 6d 65 73 70 61 63 65 20 70 72 6f 63 65 73 73 69 mespace processi
11c0: 6e 67 20 74 68 69 73 20 69 73 20 72 65 74 75 72 ng this is retur
11d0: 6e 65 64 20 62 79 20 58 6d 6c 50 72 6f 6c 6f 67 ned by XmlProlog
11e0: 54 6f 6b 20 66 6f 72 20 61 0a 20 20 20 6e 61 6d Tok for a. nam
11f0: 65 20 77 69 74 68 20 61 20 63 6f 6c 6f 6e 2e 0a e with a colon..
1200: 2a 2f 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 54 */.#define XML_T
1210: 4f 4b 5f 50 52 45 46 49 58 45 44 5f 4e 41 4d 45 OK_PREFIXED_NAME
1220: 20 34 31 0a 0a 23 69 66 64 65 66 20 58 4d 4c 5f 41..#ifdef XML_
1230: 44 54 44 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f DTD.#define XML_
1240: 54 4f 4b 5f 49 47 4e 4f 52 45 5f 53 45 43 54 20 TOK_IGNORE_SECT
1250: 34 32 0a 23 65 6e 64 69 66 20 2f 2a 20 58 4d 4c 42.#endif /* XML
1260: 5f 44 54 44 20 2a 2f 0a 0a 23 69 66 64 65 66 20 _DTD */..#ifdef
1270: 58 4d 4c 5f 44 54 44 0a 23 64 65 66 69 6e 65 20 XML_DTD.#define
1280: 58 4d 4c 5f 4e 5f 53 54 41 54 45 53 20 34 0a 23 XML_N_STATES 4.#
1290: 65 6c 73 65 20 2f 2a 20 6e 6f 74 20 58 4d 4c 5f else /* not XML_
12a0: 44 54 44 20 2a 2f 0a 23 64 65 66 69 6e 65 20 58 DTD */.#define X
12b0: 4d 4c 5f 4e 5f 53 54 41 54 45 53 20 33 0a 23 65 ML_N_STATES 3.#e
12c0: 6e 64 69 66 20 2f 2a 20 6e 6f 74 20 58 4d 4c 5f ndif /* not XML_
12d0: 44 54 44 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 DTD */..#define
12e0: 58 4d 4c 5f 50 52 4f 4c 4f 47 5f 53 54 41 54 45 XML_PROLOG_STATE
12f0: 20 30 0a 23 64 65 66 69 6e 65 20 58 4d 4c 5f 43 0.#define XML_C
1300: 4f 4e 54 45 4e 54 5f 53 54 41 54 45 20 31 0a 23 ONTENT_STATE 1.#
1310: 64 65 66 69 6e 65 20 58 4d 4c 5f 43 44 41 54 41 define XML_CDATA
1320: 5f 53 45 43 54 49 4f 4e 5f 53 54 41 54 45 20 32 _SECTION_STATE 2
1330: 0a 23 69 66 64 65 66 20 58 4d 4c 5f 44 54 44 0a .#ifdef XML_DTD.
1340: 23 64 65 66 69 6e 65 20 58 4d 4c 5f 49 47 4e 4f #define XML_IGNO
1350: 52 45 5f 53 45 43 54 49 4f 4e 5f 53 54 41 54 45 RE_SECTION_STATE
1360: 20 33 0a 23 65 6e 64 69 66 20 2f 2a 20 58 4d 4c 3.#endif /* XML
1370: 5f 44 54 44 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 _DTD */..#define
1380: 20 58 4d 4c 5f 4e 5f 4c 49 54 45 52 41 4c 5f 54 XML_N_LITERAL_T
1390: 59 50 45 53 20 32 0a 23 64 65 66 69 6e 65 20 58 YPES 2.#define X
13a0: 4d 4c 5f 41 54 54 52 49 42 55 54 45 5f 56 41 4c ML_ATTRIBUTE_VAL
13b0: 55 45 5f 4c 49 54 45 52 41 4c 20 30 0a 23 64 65 UE_LITERAL 0.#de
13c0: 66 69 6e 65 20 58 4d 4c 5f 45 4e 54 49 54 59 5f fine XML_ENTITY_
13d0: 56 41 4c 55 45 5f 4c 49 54 45 52 41 4c 20 31 0a VALUE_LITERAL 1.
13e0: 0a 2f 2a 20 54 68 65 20 73 69 7a 65 20 6f 66 20 ./* The size of
13f0: 74 68 65 20 62 75 66 66 65 72 20 70 61 73 73 65 the buffer passe
1400: 64 20 74 6f 20 58 6d 6c 55 74 66 38 45 6e 63 6f d to XmlUtf8Enco
1410: 64 65 20 6d 75 73 74 20 62 65 20 61 74 20 6c 65 de must be at le
1420: 61 73 74 20 74 68 69 73 2e 20 2a 2f 0a 23 64 65 ast this. */.#de
1430: 66 69 6e 65 20 58 4d 4c 5f 55 54 46 38 5f 45 4e fine XML_UTF8_EN
1440: 43 4f 44 45 5f 4d 41 58 20 34 0a 2f 2a 20 54 68 CODE_MAX 4./* Th
1450: 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 62 75 e size of the bu
1460: 66 66 65 72 20 70 61 73 73 65 64 20 74 6f 20 58 ffer passed to X
1470: 6d 6c 55 74 66 31 36 45 6e 63 6f 64 65 20 6d 75 mlUtf16Encode mu
1480: 73 74 20 62 65 20 61 74 20 6c 65 61 73 74 20 74 st be at least t
1490: 68 69 73 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 his. */.#define
14a0: 58 4d 4c 5f 55 54 46 31 36 5f 45 4e 43 4f 44 45 XML_UTF16_ENCODE
14b0: 5f 4d 41 58 20 32 0a 0a 74 79 70 65 64 65 66 20 _MAX 2..typedef
14c0: 73 74 72 75 63 74 20 70 6f 73 69 74 69 6f 6e 20 struct position
14d0: 7b 0a 20 20 2f 2a 20 66 69 72 73 74 20 6c 69 6e {. /* first lin
14e0: 65 20 61 6e 64 20 66 69 72 73 74 20 63 6f 6c 75 e and first colu
14f0: 6d 6e 20 61 72 65 20 30 20 6e 6f 74 20 31 20 2a mn are 0 not 1 *
1500: 2f 0a 20 20 58 4d 4c 5f 53 69 7a 65 20 6c 69 6e /. XML_Size lin
1510: 65 4e 75 6d 62 65 72 3b 0a 20 20 58 4d 4c 5f 53 eNumber;. XML_S
1520: 69 7a 65 20 63 6f 6c 75 6d 6e 4e 75 6d 62 65 72 ize columnNumber
1530: 3b 0a 7d 20 50 4f 53 49 54 49 4f 4e 3b 0a 0a 74 ;.} POSITION;..t
1540: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 0a ypedef struct {.
1550: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 6e 61 const char *na
1560: 6d 65 3b 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 me;. const char
1570: 20 2a 76 61 6c 75 65 50 74 72 3b 0a 20 20 63 6f *valuePtr;. co
1580: 6e 73 74 20 63 68 61 72 20 2a 76 61 6c 75 65 45 nst char *valueE
1590: 6e 64 3b 0a 20 20 63 68 61 72 20 6e 6f 72 6d 61 nd;. char norma
15a0: 6c 69 7a 65 64 3b 0a 7d 20 41 54 54 52 49 42 55 lized;.} ATTRIBU
15b0: 54 45 3b 0a 0a 73 74 72 75 63 74 20 65 6e 63 6f TE;..struct enco
15c0: 64 69 6e 67 3b 0a 74 79 70 65 64 65 66 20 73 74 ding;.typedef st
15d0: 72 75 63 74 20 65 6e 63 6f 64 69 6e 67 20 45 4e ruct encoding EN
15e0: 43 4f 44 49 4e 47 3b 0a 0a 74 79 70 65 64 65 66 CODING;..typedef
15f0: 20 69 6e 74 20 28 50 54 52 43 41 4c 4c 20 2a 53 int (PTRCALL *S
1600: 43 41 4e 4e 45 52 29 28 63 6f 6e 73 74 20 45 4e CANNER)(const EN
1610: 43 4f 44 49 4e 47 20 2a 2c 0a 20 20 20 20 20 20 CODING *,.
1620: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1630: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
1640: 68 61 72 20 2a 2c 0a 20 20 20 20 20 20 20 20 20 har *,.
1650: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1660: 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 const char
1670: 20 2a 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 *,.
1680: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1690: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 2a const char **
16a0: 29 3b 0a 0a 65 6e 75 6d 20 58 4d 4c 5f 43 6f 6e );..enum XML_Con
16b0: 76 65 72 74 5f 52 65 73 75 6c 74 20 7b 0a 20 20 vert_Result {.
16c0: 58 4d 4c 5f 43 4f 4e 56 45 52 54 5f 43 4f 4d 50 XML_CONVERT_COMP
16d0: 4c 45 54 45 44 20 3d 20 30 2c 0a 20 20 58 4d 4c LETED = 0,. XML
16e0: 5f 43 4f 4e 56 45 52 54 5f 49 4e 50 55 54 5f 49 _CONVERT_INPUT_I
16f0: 4e 43 4f 4d 50 4c 45 54 45 20 3d 20 31 2c 0a 20 NCOMPLETE = 1,.
1700: 20 58 4d 4c 5f 43 4f 4e 56 45 52 54 5f 4f 55 54 XML_CONVERT_OUT
1710: 50 55 54 5f 45 58 48 41 55 53 54 45 44 20 3d 20 PUT_EXHAUSTED =
1720: 32 20 20 2f 2a 20 61 6e 64 20 74 68 65 72 65 66 2 /* and theref
1730: 6f 72 65 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 ore potentially
1740: 69 6e 70 75 74 20 72 65 6d 61 69 6e 69 6e 67 20 input remaining
1750: 61 73 20 77 65 6c 6c 20 2a 2f 0a 7d 3b 0a 0a 73 as well */.};..s
1760: 74 72 75 63 74 20 65 6e 63 6f 64 69 6e 67 20 7b truct encoding {
1770: 0a 20 20 53 43 41 4e 4e 45 52 20 73 63 61 6e 6e . SCANNER scann
1780: 65 72 73 5b 58 4d 4c 5f 4e 5f 53 54 41 54 45 53 ers[XML_N_STATES
1790: 5d 3b 0a 20 20 53 43 41 4e 4e 45 52 20 6c 69 74 ];. SCANNER lit
17a0: 65 72 61 6c 53 63 61 6e 6e 65 72 73 5b 58 4d 4c eralScanners[XML
17b0: 5f 4e 5f 4c 49 54 45 52 41 4c 5f 54 59 50 45 53 _N_LITERAL_TYPES
17c0: 5d 3b 0a 20 20 69 6e 74 20 28 50 54 52 43 41 4c ];. int (PTRCAL
17d0: 4c 20 2a 6e 61 6d 65 4d 61 74 63 68 65 73 41 73 L *nameMatchesAs
17e0: 63 69 69 29 28 63 6f 6e 73 74 20 45 4e 43 4f 44 cii)(const ENCOD
17f0: 49 4e 47 20 2a 2c 0a 20 20 20 20 20 20 20 20 20 ING *,.
1800: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1810: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
1820: 68 61 72 20 2a 2c 0a 20 20 20 20 20 20 20 20 20 har *,.
1830: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1840: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
1850: 68 61 72 20 2a 2c 0a 20 20 20 20 20 20 20 20 20 har *,.
1860: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1870: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
1880: 68 61 72 20 2a 29 3b 0a 20 20 69 6e 74 20 28 50 har *);. int (P
1890: 54 52 46 41 53 54 43 41 4c 4c 20 2a 6e 61 6d 65 TRFASTCALL *name
18a0: 4c 65 6e 67 74 68 29 28 63 6f 6e 73 74 20 45 4e Length)(const EN
18b0: 43 4f 44 49 4e 47 20 2a 2c 20 63 6f 6e 73 74 20 CODING *, const
18c0: 63 68 61 72 20 2a 29 3b 0a 20 20 63 6f 6e 73 74 char *);. const
18d0: 20 63 68 61 72 20 2a 28 50 54 52 46 41 53 54 43 char *(PTRFASTC
18e0: 41 4c 4c 20 2a 73 6b 69 70 53 29 28 63 6f 6e 73 ALL *skipS)(cons
18f0: 74 20 45 4e 43 4f 44 49 4e 47 20 2a 2c 20 63 6f t ENCODING *, co
1900: 6e 73 74 20 63 68 61 72 20 2a 29 3b 0a 20 20 69 nst char *);. i
1910: 6e 74 20 28 50 54 52 43 41 4c 4c 20 2a 67 65 74 nt (PTRCALL *get
1920: 41 74 74 73 29 28 63 6f 6e 73 74 20 45 4e 43 4f Atts)(const ENCO
1930: 44 49 4e 47 20 2a 65 6e 63 2c 0a 20 20 20 20 20 DING *enc,.
1940: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1950: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
1960: 70 74 72 2c 0a 20 20 20 20 20 20 20 20 20 20 20 ptr,.
1970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e in
1980: 74 20 61 74 74 73 4d 61 78 2c 0a 20 20 20 20 20 t attsMax,.
1990: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19a0: 20 20 20 20 41 54 54 52 49 42 55 54 45 20 2a 61 ATTRIBUTE *a
19b0: 74 74 73 29 3b 0a 20 20 69 6e 74 20 28 50 54 52 tts);. int (PTR
19c0: 46 41 53 54 43 41 4c 4c 20 2a 63 68 61 72 52 65 FASTCALL *charRe
19d0: 66 4e 75 6d 62 65 72 29 28 63 6f 6e 73 74 20 45 fNumber)(const E
19e0: 4e 43 4f 44 49 4e 47 20 2a 65 6e 63 2c 20 63 6f NCODING *enc, co
19f0: 6e 73 74 20 63 68 61 72 20 2a 70 74 72 29 3b 0a nst char *ptr);.
1a00: 20 20 69 6e 74 20 28 50 54 52 43 41 4c 4c 20 2a int (PTRCALL *
1a10: 70 72 65 64 65 66 69 6e 65 64 45 6e 74 69 74 79 predefinedEntity
1a20: 4e 61 6d 65 29 28 63 6f 6e 73 74 20 45 4e 43 4f Name)(const ENCO
1a30: 44 49 4e 47 20 2a 2c 0a 20 20 20 20 20 20 20 20 DING *,.
1a40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f co
1a60: 6e 73 74 20 63 68 61 72 20 2a 2c 0a 20 20 20 20 nst char *,.
1a70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a90: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 29 3b const char *);
1aa0: 0a 20 20 76 6f 69 64 20 28 50 54 52 43 41 4c 4c . void (PTRCALL
1ab0: 20 2a 75 70 64 61 74 65 50 6f 73 69 74 69 6f 6e *updatePosition
1ac0: 29 28 63 6f 6e 73 74 20 45 4e 43 4f 44 49 4e 47 )(const ENCODING
1ad0: 20 2a 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 *,.
1ae0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1af0: 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 const char
1b00: 2a 70 74 72 2c 0a 20 20 20 20 20 20 20 20 20 20 *ptr,.
1b10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b20: 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 const cha
1b30: 72 20 2a 65 6e 64 2c 0a 20 20 20 20 20 20 20 20 r *end,.
1b40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b50: 20 20 20 20 20 20 20 20 20 50 4f 53 49 54 49 4f POSITIO
1b60: 4e 20 2a 29 3b 0a 20 20 69 6e 74 20 28 50 54 52 N *);. int (PTR
1b70: 43 41 4c 4c 20 2a 69 73 50 75 62 6c 69 63 49 64 CALL *isPublicId
1b80: 29 28 63 6f 6e 73 74 20 45 4e 43 4f 44 49 4e 47 )(const ENCODING
1b90: 20 2a 65 6e 63 2c 0a 20 20 20 20 20 20 20 20 20 *enc,.
1ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1bb0: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 const char *p
1bc0: 74 72 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 tr,.
1bd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1be0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 65 6e 64 2c const char *end,
1bf0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1c00: 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e con
1c10: 73 74 20 63 68 61 72 20 2a 2a 62 61 64 50 74 72 st char **badPtr
1c20: 29 3b 0a 20 20 65 6e 75 6d 20 58 4d 4c 5f 43 6f );. enum XML_Co
1c30: 6e 76 65 72 74 5f 52 65 73 75 6c 74 20 28 50 54 nvert_Result (PT
1c40: 52 43 41 4c 4c 20 2a 75 74 66 38 43 6f 6e 76 65 RCALL *utf8Conve
1c50: 72 74 29 28 63 6f 6e 73 74 20 45 4e 43 4f 44 49 rt)(const ENCODI
1c60: 4e 47 20 2a 65 6e 63 2c 0a 20 20 20 20 20 20 20 NG *enc,.
1c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c80: 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 const cha
1c90: 72 20 2a 2a 66 72 6f 6d 50 2c 0a 20 20 20 20 20 r **fromP,.
1ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1cb0: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
1cc0: 68 61 72 20 2a 66 72 6f 6d 4c 69 6d 2c 0a 20 20 har *fromLim,.
1cd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ce0: 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 char
1cf0: 20 2a 2a 74 6f 50 2c 0a 20 20 20 20 20 20 20 20 **toP,.
1d00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d10: 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 const char
1d20: 20 2a 74 6f 4c 69 6d 29 3b 0a 20 20 65 6e 75 6d *toLim);. enum
1d30: 20 58 4d 4c 5f 43 6f 6e 76 65 72 74 5f 52 65 73 XML_Convert_Res
1d40: 75 6c 74 20 28 50 54 52 43 41 4c 4c 20 2a 75 74 ult (PTRCALL *ut
1d50: 66 31 36 43 6f 6e 76 65 72 74 29 28 63 6f 6e 73 f16Convert)(cons
1d60: 74 20 45 4e 43 4f 44 49 4e 47 20 2a 65 6e 63 2c t ENCODING *enc,
1d70: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1d80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d90: 63 6f 6e 73 74 20 63 68 61 72 20 2a 2a 66 72 6f const char **fro
1da0: 6d 50 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 mP,.
1db0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1dc0: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 66 const char *f
1dd0: 72 6f 6d 4c 69 6d 2c 0a 20 20 20 20 20 20 20 20 romLim,.
1de0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1df0: 20 20 20 20 20 20 20 75 6e 73 69 67 6e 65 64 20 unsigned
1e00: 73 68 6f 72 74 20 2a 2a 74 6f 50 2c 0a 20 20 20 short **toP,.
1e10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e20: 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 cons
1e30: 74 20 75 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 t unsigned short
1e40: 20 2a 74 6f 4c 69 6d 29 3b 0a 20 20 69 6e 74 20 *toLim);. int
1e50: 6d 69 6e 42 79 74 65 73 50 65 72 43 68 61 72 3b minBytesPerChar;
1e60: 0a 20 20 63 68 61 72 20 69 73 55 74 66 38 3b 0a . char isUtf8;.
1e70: 20 20 63 68 61 72 20 69 73 55 74 66 31 36 3b 0a char isUtf16;.
1e80: 7d 3b 0a 0a 2f 2a 20 53 63 61 6e 20 74 68 65 20 };../* Scan the
1e90: 73 74 72 69 6e 67 20 73 74 61 72 74 69 6e 67 20 string starting
1ea0: 61 74 20 70 74 72 20 75 6e 74 69 6c 20 74 68 65 at ptr until the
1eb0: 20 65 6e 64 20 6f 66 20 74 68 65 20 6e 65 78 74 end of the next
1ec0: 20 63 6f 6d 70 6c 65 74 65 0a 20 20 20 74 6f 6b complete. tok
1ed0: 65 6e 2c 20 62 75 74 20 64 6f 20 6e 6f 74 20 73 en, but do not s
1ee0: 63 61 6e 20 70 61 73 74 20 65 70 74 72 2e 20 20 can past eptr.
1ef0: 52 65 74 75 72 6e 20 61 6e 20 69 6e 74 65 67 65 Return an intege
1f00: 72 20 67 69 76 69 6e 67 20 74 68 65 0a 20 20 20 r giving the.
1f10: 74 79 70 65 20 6f 66 20 74 6f 6b 65 6e 2e 0a 0a type of token...
1f20: 20 20 20 52 65 74 75 72 6e 20 58 4d 4c 5f 54 4f Return XML_TO
1f30: 4b 5f 4e 4f 4e 45 20 77 68 65 6e 20 70 74 72 20 K_NONE when ptr
1f40: 3d 3d 20 65 70 74 72 3b 20 6e 65 78 74 54 6f 6b == eptr; nextTok
1f50: 50 74 72 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 Ptr will not be
1f60: 73 65 74 2e 0a 0a 20 20 20 52 65 74 75 72 6e 20 set... Return
1f70: 58 4d 4c 5f 54 4f 4b 5f 50 41 52 54 49 41 4c 20 XML_TOK_PARTIAL
1f80: 77 68 65 6e 20 74 68 65 20 73 74 72 69 6e 67 20 when the string
1f90: 64 6f 65 73 20 6e 6f 74 20 63 6f 6e 74 61 69 6e does not contain
1fa0: 20 61 20 63 6f 6d 70 6c 65 74 65 0a 20 20 20 74 a complete. t
1fb0: 6f 6b 65 6e 3b 20 6e 65 78 74 54 6f 6b 50 74 72 oken; nextTokPtr
1fc0: 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 73 65 74 will not be set
1fd0: 2e 0a 0a 20 20 20 52 65 74 75 72 6e 20 58 4d 4c ... Return XML
1fe0: 5f 54 4f 4b 5f 49 4e 56 41 4c 49 44 20 77 68 65 _TOK_INVALID whe
1ff0: 6e 20 74 68 65 20 73 74 72 69 6e 67 20 64 6f 65 n the string doe
2000: 73 20 6e 6f 74 20 73 74 61 72 74 20 61 20 76 61 s not start a va
2010: 6c 69 64 0a 20 20 20 74 6f 6b 65 6e 3b 20 6e 65 lid. token; ne
2020: 78 74 54 6f 6b 50 74 72 20 77 69 6c 6c 20 62 65 xtTokPtr will be
2030: 20 73 65 74 20 74 6f 20 70 6f 69 6e 74 20 74 6f set to point to
2040: 20 74 68 65 20 63 68 61 72 61 63 74 65 72 20 77 the character w
2050: 68 69 63 68 20 6d 61 64 65 0a 20 20 20 74 68 65 hich made. the
2060: 20 74 6f 6b 65 6e 20 69 6e 76 61 6c 69 64 2e 0a token invalid..
2070: 0a 20 20 20 4f 74 68 65 72 77 69 73 65 20 74 68 . Otherwise th
2080: 65 20 73 74 72 69 6e 67 20 73 74 61 72 74 73 20 e string starts
2090: 77 69 74 68 20 61 20 76 61 6c 69 64 20 74 6f 6b with a valid tok
20a0: 65 6e 3b 20 6e 65 78 74 54 6f 6b 50 74 72 20 77 en; nextTokPtr w
20b0: 69 6c 6c 20 62 65 0a 20 20 20 73 65 74 20 74 6f ill be. set to
20c0: 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 63 68 point to the ch
20d0: 61 72 61 63 74 65 72 20 66 6f 6c 6c 6f 77 69 6e aracter followin
20e0: 67 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 61 g the end of tha
20f0: 74 20 74 6f 6b 65 6e 2e 0a 0a 20 20 20 45 61 63 t token... Eac
2100: 68 20 64 61 74 61 20 63 68 61 72 61 63 74 65 72 h data character
2110: 20 63 6f 75 6e 74 73 20 61 73 20 61 20 73 69 6e counts as a sin
2120: 67 6c 65 20 74 6f 6b 65 6e 2c 20 62 75 74 20 61 gle token, but a
2130: 64 6a 61 63 65 6e 74 20 64 61 74 61 0a 20 20 20 djacent data.
2140: 63 68 61 72 61 63 74 65 72 73 20 6d 61 79 20 62 characters may b
2150: 65 20 72 65 74 75 72 6e 65 64 20 74 6f 67 65 74 e returned toget
2160: 68 65 72 2e 20 20 53 69 6d 69 6c 61 72 6c 79 20 her. Similarly
2170: 66 6f 72 20 63 68 61 72 61 63 74 65 72 73 20 69 for characters i
2180: 6e 0a 20 20 20 74 68 65 20 70 72 6f 6c 6f 67 20 n. the prolog
2190: 6f 75 74 73 69 64 65 20 6c 69 74 65 72 61 6c 73 outside literals
21a0: 2c 20 63 6f 6d 6d 65 6e 74 73 20 61 6e 64 20 70 , comments and p
21b0: 72 6f 63 65 73 73 69 6e 67 20 69 6e 73 74 72 75 rocessing instru
21c0: 63 74 69 6f 6e 73 2e 0a 2a 2f 0a 0a 0a 23 64 65 ctions..*/...#de
21d0: 66 69 6e 65 20 58 6d 6c 54 6f 6b 28 65 6e 63 2c fine XmlTok(enc,
21e0: 20 73 74 61 74 65 2c 20 70 74 72 2c 20 65 6e 64 state, ptr, end
21f0: 2c 20 6e 65 78 74 54 6f 6b 50 74 72 29 20 5c 0a , nextTokPtr) \.
2200: 20 20 28 28 28 65 6e 63 29 2d 3e 73 63 61 6e 6e (((enc)->scann
2210: 65 72 73 5b 73 74 61 74 65 5d 29 28 65 6e 63 2c ers[state])(enc,
2220: 20 70 74 72 2c 20 65 6e 64 2c 20 6e 65 78 74 54 ptr, end, nextT
2230: 6f 6b 50 74 72 29 29 0a 0a 23 64 65 66 69 6e 65 okPtr))..#define
2240: 20 58 6d 6c 50 72 6f 6c 6f 67 54 6f 6b 28 65 6e XmlPrologTok(en
2250: 63 2c 20 70 74 72 2c 20 65 6e 64 2c 20 6e 65 78 c, ptr, end, nex
2260: 74 54 6f 6b 50 74 72 29 20 5c 0a 20 20 20 58 6d tTokPtr) \. Xm
2270: 6c 54 6f 6b 28 65 6e 63 2c 20 58 4d 4c 5f 50 52 lTok(enc, XML_PR
2280: 4f 4c 4f 47 5f 53 54 41 54 45 2c 20 70 74 72 2c OLOG_STATE, ptr,
2290: 20 65 6e 64 2c 20 6e 65 78 74 54 6f 6b 50 74 72 end, nextTokPtr
22a0: 29 0a 0a 23 64 65 66 69 6e 65 20 58 6d 6c 43 6f )..#define XmlCo
22b0: 6e 74 65 6e 74 54 6f 6b 28 65 6e 63 2c 20 70 74 ntentTok(enc, pt
22c0: 72 2c 20 65 6e 64 2c 20 6e 65 78 74 54 6f 6b 50 r, end, nextTokP
22d0: 74 72 29 20 5c 0a 20 20 20 58 6d 6c 54 6f 6b 28 tr) \. XmlTok(
22e0: 65 6e 63 2c 20 58 4d 4c 5f 43 4f 4e 54 45 4e 54 enc, XML_CONTENT
22f0: 5f 53 54 41 54 45 2c 20 70 74 72 2c 20 65 6e 64 _STATE, ptr, end
2300: 2c 20 6e 65 78 74 54 6f 6b 50 74 72 29 0a 0a 23 , nextTokPtr)..#
2310: 64 65 66 69 6e 65 20 58 6d 6c 43 64 61 74 61 53 define XmlCdataS
2320: 65 63 74 69 6f 6e 54 6f 6b 28 65 6e 63 2c 20 70 ectionTok(enc, p
2330: 74 72 2c 20 65 6e 64 2c 20 6e 65 78 74 54 6f 6b tr, end, nextTok
2340: 50 74 72 29 20 5c 0a 20 20 20 58 6d 6c 54 6f 6b Ptr) \. XmlTok
2350: 28 65 6e 63 2c 20 58 4d 4c 5f 43 44 41 54 41 5f (enc, XML_CDATA_
2360: 53 45 43 54 49 4f 4e 5f 53 54 41 54 45 2c 20 70 SECTION_STATE, p
2370: 74 72 2c 20 65 6e 64 2c 20 6e 65 78 74 54 6f 6b tr, end, nextTok
2380: 50 74 72 29 0a 0a 23 69 66 64 65 66 20 58 4d 4c Ptr)..#ifdef XML
2390: 5f 44 54 44 0a 0a 23 64 65 66 69 6e 65 20 58 6d _DTD..#define Xm
23a0: 6c 49 67 6e 6f 72 65 53 65 63 74 69 6f 6e 54 6f lIgnoreSectionTo
23b0: 6b 28 65 6e 63 2c 20 70 74 72 2c 20 65 6e 64 2c k(enc, ptr, end,
23c0: 20 6e 65 78 74 54 6f 6b 50 74 72 29 20 5c 0a 20 nextTokPtr) \.
23d0: 20 20 58 6d 6c 54 6f 6b 28 65 6e 63 2c 20 58 4d XmlTok(enc, XM
23e0: 4c 5f 49 47 4e 4f 52 45 5f 53 45 43 54 49 4f 4e L_IGNORE_SECTION
23f0: 5f 53 54 41 54 45 2c 20 70 74 72 2c 20 65 6e 64 _STATE, ptr, end
2400: 2c 20 6e 65 78 74 54 6f 6b 50 74 72 29 0a 0a 23 , nextTokPtr)..#
2410: 65 6e 64 69 66 20 2f 2a 20 58 4d 4c 5f 44 54 44 endif /* XML_DTD
2420: 20 2a 2f 0a 0a 2f 2a 20 54 68 69 73 20 69 73 20 */../* This is
2430: 75 73 65 64 20 66 6f 72 20 70 65 72 66 6f 72 6d used for perform
2440: 69 6e 67 20 61 20 32 6e 64 2d 6c 65 76 65 6c 20 ing a 2nd-level
2450: 74 6f 6b 65 6e 69 7a 61 74 69 6f 6e 20 6f 6e 20 tokenization on
2460: 74 68 65 20 63 6f 6e 74 65 6e 74 0a 20 20 20 6f the content. o
2470: 66 20 61 20 6c 69 74 65 72 61 6c 20 74 68 61 74 f a literal that
2480: 20 68 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 has already bee
2490: 6e 20 72 65 74 75 72 6e 65 64 20 62 79 20 58 6d n returned by Xm
24a0: 6c 54 6f 6b 2e 0a 2a 2f 0a 23 64 65 66 69 6e 65 lTok..*/.#define
24b0: 20 58 6d 6c 4c 69 74 65 72 61 6c 54 6f 6b 28 65 XmlLiteralTok(e
24c0: 6e 63 2c 20 6c 69 74 65 72 61 6c 54 79 70 65 2c nc, literalType,
24d0: 20 70 74 72 2c 20 65 6e 64 2c 20 6e 65 78 74 54 ptr, end, nextT
24e0: 6f 6b 50 74 72 29 20 5c 0a 20 20 28 28 28 65 6e okPtr) \. (((en
24f0: 63 29 2d 3e 6c 69 74 65 72 61 6c 53 63 61 6e 6e c)->literalScann
2500: 65 72 73 5b 6c 69 74 65 72 61 6c 54 79 70 65 5d ers[literalType]
2510: 29 28 65 6e 63 2c 20 70 74 72 2c 20 65 6e 64 2c )(enc, ptr, end,
2520: 20 6e 65 78 74 54 6f 6b 50 74 72 29 29 0a 0a 23 nextTokPtr))..#
2530: 64 65 66 69 6e 65 20 58 6d 6c 41 74 74 72 69 62 define XmlAttrib
2540: 75 74 65 56 61 6c 75 65 54 6f 6b 28 65 6e 63 2c uteValueTok(enc,
2550: 20 70 74 72 2c 20 65 6e 64 2c 20 6e 65 78 74 54 ptr, end, nextT
2560: 6f 6b 50 74 72 29 20 5c 0a 20 20 20 58 6d 6c 4c okPtr) \. XmlL
2570: 69 74 65 72 61 6c 54 6f 6b 28 65 6e 63 2c 20 58 iteralTok(enc, X
2580: 4d 4c 5f 41 54 54 52 49 42 55 54 45 5f 56 41 4c ML_ATTRIBUTE_VAL
2590: 55 45 5f 4c 49 54 45 52 41 4c 2c 20 70 74 72 2c UE_LITERAL, ptr,
25a0: 20 65 6e 64 2c 20 6e 65 78 74 54 6f 6b 50 74 72 end, nextTokPtr
25b0: 29 0a 0a 23 64 65 66 69 6e 65 20 58 6d 6c 45 6e )..#define XmlEn
25c0: 74 69 74 79 56 61 6c 75 65 54 6f 6b 28 65 6e 63 tityValueTok(enc
25d0: 2c 20 70 74 72 2c 20 65 6e 64 2c 20 6e 65 78 74 , ptr, end, next
25e0: 54 6f 6b 50 74 72 29 20 5c 0a 20 20 20 58 6d 6c TokPtr) \. Xml
25f0: 4c 69 74 65 72 61 6c 54 6f 6b 28 65 6e 63 2c 20 LiteralTok(enc,
2600: 58 4d 4c 5f 45 4e 54 49 54 59 5f 56 41 4c 55 45 XML_ENTITY_VALUE
2610: 5f 4c 49 54 45 52 41 4c 2c 20 70 74 72 2c 20 65 _LITERAL, ptr, e
2620: 6e 64 2c 20 6e 65 78 74 54 6f 6b 50 74 72 29 0a nd, nextTokPtr).
2630: 0a 23 64 65 66 69 6e 65 20 58 6d 6c 4e 61 6d 65 .#define XmlName
2640: 4d 61 74 63 68 65 73 41 73 63 69 69 28 65 6e 63 MatchesAscii(enc
2650: 2c 20 70 74 72 31 2c 20 65 6e 64 31 2c 20 70 74 , ptr1, end1, pt
2660: 72 32 29 20 5c 0a 20 20 28 28 28 65 6e 63 29 2d r2) \. (((enc)-
2670: 3e 6e 61 6d 65 4d 61 74 63 68 65 73 41 73 63 69 >nameMatchesAsci
2680: 69 29 28 65 6e 63 2c 20 70 74 72 31 2c 20 65 6e i)(enc, ptr1, en
2690: 64 31 2c 20 70 74 72 32 29 29 0a 0a 23 64 65 66 d1, ptr2))..#def
26a0: 69 6e 65 20 58 6d 6c 4e 61 6d 65 4c 65 6e 67 74 ine XmlNameLengt
26b0: 68 28 65 6e 63 2c 20 70 74 72 29 20 5c 0a 20 20 h(enc, ptr) \.
26c0: 28 28 28 65 6e 63 29 2d 3e 6e 61 6d 65 4c 65 6e (((enc)->nameLen
26d0: 67 74 68 29 28 65 6e 63 2c 20 70 74 72 29 29 0a gth)(enc, ptr)).
26e0: 0a 23 64 65 66 69 6e 65 20 58 6d 6c 53 6b 69 70 .#define XmlSkip
26f0: 53 28 65 6e 63 2c 20 70 74 72 29 20 5c 0a 20 20 S(enc, ptr) \.
2700: 28 28 28 65 6e 63 29 2d 3e 73 6b 69 70 53 29 28 (((enc)->skipS)(
2710: 65 6e 63 2c 20 70 74 72 29 29 0a 0a 23 64 65 66 enc, ptr))..#def
2720: 69 6e 65 20 58 6d 6c 47 65 74 41 74 74 72 69 62 ine XmlGetAttrib
2730: 75 74 65 73 28 65 6e 63 2c 20 70 74 72 2c 20 61 utes(enc, ptr, a
2740: 74 74 73 4d 61 78 2c 20 61 74 74 73 29 20 5c 0a ttsMax, atts) \.
2750: 20 20 28 28 28 65 6e 63 29 2d 3e 67 65 74 41 74 (((enc)->getAt
2760: 74 73 29 28 65 6e 63 2c 20 70 74 72 2c 20 61 74 ts)(enc, ptr, at
2770: 74 73 4d 61 78 2c 20 61 74 74 73 29 29 0a 0a 23 tsMax, atts))..#
2780: 64 65 66 69 6e 65 20 58 6d 6c 43 68 61 72 52 65 define XmlCharRe
2790: 66 4e 75 6d 62 65 72 28 65 6e 63 2c 20 70 74 72 fNumber(enc, ptr
27a0: 29 20 5c 0a 20 20 28 28 28 65 6e 63 29 2d 3e 63 ) \. (((enc)->c
27b0: 68 61 72 52 65 66 4e 75 6d 62 65 72 29 28 65 6e harRefNumber)(en
27c0: 63 2c 20 70 74 72 29 29 0a 0a 23 64 65 66 69 6e c, ptr))..#defin
27d0: 65 20 58 6d 6c 50 72 65 64 65 66 69 6e 65 64 45 e XmlPredefinedE
27e0: 6e 74 69 74 79 4e 61 6d 65 28 65 6e 63 2c 20 70 ntityName(enc, p
27f0: 74 72 2c 20 65 6e 64 29 20 5c 0a 20 20 28 28 28 tr, end) \. (((
2800: 65 6e 63 29 2d 3e 70 72 65 64 65 66 69 6e 65 64 enc)->predefined
2810: 45 6e 74 69 74 79 4e 61 6d 65 29 28 65 6e 63 2c EntityName)(enc,
2820: 20 70 74 72 2c 20 65 6e 64 29 29 0a 0a 23 64 65 ptr, end))..#de
2830: 66 69 6e 65 20 58 6d 6c 55 70 64 61 74 65 50 6f fine XmlUpdatePo
2840: 73 69 74 69 6f 6e 28 65 6e 63 2c 20 70 74 72 2c sition(enc, ptr,
2850: 20 65 6e 64 2c 20 70 6f 73 29 20 5c 0a 20 20 28 end, pos) \. (
2860: 28 28 65 6e 63 29 2d 3e 75 70 64 61 74 65 50 6f ((enc)->updatePo
2870: 73 69 74 69 6f 6e 29 28 65 6e 63 2c 20 70 74 72 sition)(enc, ptr
2880: 2c 20 65 6e 64 2c 20 70 6f 73 29 29 0a 0a 23 64 , end, pos))..#d
2890: 65 66 69 6e 65 20 58 6d 6c 49 73 50 75 62 6c 69 efine XmlIsPubli
28a0: 63 49 64 28 65 6e 63 2c 20 70 74 72 2c 20 65 6e cId(enc, ptr, en
28b0: 64 2c 20 62 61 64 50 74 72 29 20 5c 0a 20 20 28 d, badPtr) \. (
28c0: 28 28 65 6e 63 29 2d 3e 69 73 50 75 62 6c 69 63 ((enc)->isPublic
28d0: 49 64 29 28 65 6e 63 2c 20 70 74 72 2c 20 65 6e Id)(enc, ptr, en
28e0: 64 2c 20 62 61 64 50 74 72 29 29 0a 0a 23 64 65 d, badPtr))..#de
28f0: 66 69 6e 65 20 58 6d 6c 55 74 66 38 43 6f 6e 76 fine XmlUtf8Conv
2900: 65 72 74 28 65 6e 63 2c 20 66 72 6f 6d 50 2c 20 ert(enc, fromP,
2910: 66 72 6f 6d 4c 69 6d 2c 20 74 6f 50 2c 20 74 6f fromLim, toP, to
2920: 4c 69 6d 29 20 5c 0a 20 20 28 28 28 65 6e 63 29 Lim) \. (((enc)
2930: 2d 3e 75 74 66 38 43 6f 6e 76 65 72 74 29 28 65 ->utf8Convert)(e
2940: 6e 63 2c 20 66 72 6f 6d 50 2c 20 66 72 6f 6d 4c nc, fromP, fromL
2950: 69 6d 2c 20 74 6f 50 2c 20 74 6f 4c 69 6d 29 29 im, toP, toLim))
2960: 0a 0a 23 64 65 66 69 6e 65 20 58 6d 6c 55 74 66 ..#define XmlUtf
2970: 31 36 43 6f 6e 76 65 72 74 28 65 6e 63 2c 20 66 16Convert(enc, f
2980: 72 6f 6d 50 2c 20 66 72 6f 6d 4c 69 6d 2c 20 74 romP, fromLim, t
2990: 6f 50 2c 20 74 6f 4c 69 6d 29 20 5c 0a 20 20 28 oP, toLim) \. (
29a0: 28 28 65 6e 63 29 2d 3e 75 74 66 31 36 43 6f 6e ((enc)->utf16Con
29b0: 76 65 72 74 29 28 65 6e 63 2c 20 66 72 6f 6d 50 vert)(enc, fromP
29c0: 2c 20 66 72 6f 6d 4c 69 6d 2c 20 74 6f 50 2c 20 , fromLim, toP,
29d0: 74 6f 4c 69 6d 29 29 0a 0a 74 79 70 65 64 65 66 toLim))..typedef
29e0: 20 73 74 72 75 63 74 20 7b 0a 20 20 45 4e 43 4f struct {. ENCO
29f0: 44 49 4e 47 20 69 6e 69 74 45 6e 63 3b 0a 20 20 DING initEnc;.
2a00: 63 6f 6e 73 74 20 45 4e 43 4f 44 49 4e 47 20 2a const ENCODING *
2a10: 2a 65 6e 63 50 74 72 3b 0a 7d 20 49 4e 49 54 5f *encPtr;.} INIT_
2a20: 45 4e 43 4f 44 49 4e 47 3b 0a 0a 69 6e 74 20 58 ENCODING;..int X
2a30: 6d 6c 50 61 72 73 65 58 6d 6c 44 65 63 6c 28 69 mlParseXmlDecl(i
2a40: 6e 74 20 69 73 47 65 6e 65 72 61 6c 54 65 78 74 nt isGeneralText
2a50: 45 6e 74 69 74 79 2c 0a 20 20 20 20 20 20 20 20 Entity,.
2a60: 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 cons
2a70: 74 20 45 4e 43 4f 44 49 4e 47 20 2a 65 6e 63 2c t ENCODING *enc,
2a80: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2a90: 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 const char
2aa0: 2a 70 74 72 2c 0a 20 20 20 20 20 20 20 20 20 20 *ptr,.
2ab0: 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 const
2ac0: 63 68 61 72 20 2a 65 6e 64 2c 0a 20 20 20 20 20 char *end,.
2ad0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 c
2ae0: 6f 6e 73 74 20 63 68 61 72 20 2a 2a 62 61 64 50 onst char **badP
2af0: 74 72 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 tr,.
2b00: 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 const ch
2b10: 61 72 20 2a 2a 76 65 72 73 69 6f 6e 50 74 72 2c ar **versionPtr,
2b20: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2b30: 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 const char
2b40: 2a 2a 76 65 72 73 69 6f 6e 45 6e 64 50 74 72 2c **versionEndPtr,
2b50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2b60: 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 const char
2b70: 2a 2a 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 50 74 **encodingNamePt
2b80: 72 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 r,.
2b90: 20 20 20 20 20 20 20 63 6f 6e 73 74 20 45 4e 43 const ENC
2ba0: 4f 44 49 4e 47 20 2a 2a 6e 61 6d 65 64 45 6e 63 ODING **namedEnc
2bb0: 6f 64 69 6e 67 50 74 72 2c 0a 20 20 20 20 20 20 odingPtr,.
2bc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e in
2bd0: 74 20 2a 73 74 61 6e 64 61 6c 6f 6e 65 50 74 72 t *standalonePtr
2be0: 29 3b 0a 0a 69 6e 74 20 58 6d 6c 49 6e 69 74 45 );..int XmlInitE
2bf0: 6e 63 6f 64 69 6e 67 28 49 4e 49 54 5f 45 4e 43 ncoding(INIT_ENC
2c00: 4f 44 49 4e 47 20 2a 2c 20 63 6f 6e 73 74 20 45 ODING *, const E
2c10: 4e 43 4f 44 49 4e 47 20 2a 2a 2c 20 63 6f 6e 73 NCODING **, cons
2c20: 74 20 63 68 61 72 20 2a 6e 61 6d 65 29 3b 0a 63 t char *name);.c
2c30: 6f 6e 73 74 20 45 4e 43 4f 44 49 4e 47 20 2a 58 onst ENCODING *X
2c40: 6d 6c 47 65 74 55 74 66 38 49 6e 74 65 72 6e 61 mlGetUtf8Interna
2c50: 6c 45 6e 63 6f 64 69 6e 67 28 76 6f 69 64 29 3b lEncoding(void);
2c60: 0a 63 6f 6e 73 74 20 45 4e 43 4f 44 49 4e 47 20 .const ENCODING
2c70: 2a 58 6d 6c 47 65 74 55 74 66 31 36 49 6e 74 65 *XmlGetUtf16Inte
2c80: 72 6e 61 6c 45 6e 63 6f 64 69 6e 67 28 76 6f 69 rnalEncoding(voi
2c90: 64 29 3b 0a 69 6e 74 20 46 41 53 54 43 41 4c 4c d);.int FASTCALL
2ca0: 20 58 6d 6c 55 74 66 38 45 6e 63 6f 64 65 28 69 XmlUtf8Encode(i
2cb0: 6e 74 20 63 68 61 72 4e 75 6d 62 65 72 2c 20 63 nt charNumber, c
2cc0: 68 61 72 20 2a 62 75 66 29 3b 0a 69 6e 74 20 46 har *buf);.int F
2cd0: 41 53 54 43 41 4c 4c 20 58 6d 6c 55 74 66 31 36 ASTCALL XmlUtf16
2ce0: 45 6e 63 6f 64 65 28 69 6e 74 20 63 68 61 72 4e Encode(int charN
2cf0: 75 6d 62 65 72 2c 20 75 6e 73 69 67 6e 65 64 20 umber, unsigned
2d00: 73 68 6f 72 74 20 2a 62 75 66 29 3b 0a 69 6e 74 short *buf);.int
2d10: 20 58 6d 6c 53 69 7a 65 4f 66 55 6e 6b 6e 6f 77 XmlSizeOfUnknow
2d20: 6e 45 6e 63 6f 64 69 6e 67 28 76 6f 69 64 29 3b nEncoding(void);
2d30: 0a 0a 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 ...typedef int (
2d40: 58 4d 4c 43 41 4c 4c 20 2a 43 4f 4e 56 45 52 54 XMLCALL *CONVERT
2d50: 45 52 29 20 28 76 6f 69 64 20 2a 75 73 65 72 44 ER) (void *userD
2d60: 61 74 61 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 ata, const char
2d70: 2a 70 29 3b 0a 0a 45 4e 43 4f 44 49 4e 47 20 2a *p);..ENCODING *
2d80: 0a 58 6d 6c 49 6e 69 74 55 6e 6b 6e 6f 77 6e 45 .XmlInitUnknownE
2d90: 6e 63 6f 64 69 6e 67 28 76 6f 69 64 20 2a 6d 65 ncoding(void *me
2da0: 6d 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 m,.
2db0: 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 2a 74 int *t
2dc0: 61 62 6c 65 2c 0a 20 20 20 20 20 20 20 20 20 20 able,.
2dd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e CON
2de0: 56 45 52 54 45 52 20 63 6f 6e 76 65 72 74 2c 0a VERTER convert,.
2df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2e00: 20 20 20 20 20 20 20 76 6f 69 64 20 2a 75 73 65 void *use
2e10: 72 44 61 74 61 29 3b 0a 0a 69 6e 74 20 58 6d 6c rData);..int Xml
2e20: 50 61 72 73 65 58 6d 6c 44 65 63 6c 4e 53 28 69 ParseXmlDeclNS(i
2e30: 6e 74 20 69 73 47 65 6e 65 72 61 6c 54 65 78 74 nt isGeneralText
2e40: 45 6e 74 69 74 79 2c 0a 20 20 20 20 20 20 20 20 Entity,.
2e50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f co
2e60: 6e 73 74 20 45 4e 43 4f 44 49 4e 47 20 2a 65 6e nst ENCODING *en
2e70: 63 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 c,.
2e80: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
2e90: 68 61 72 20 2a 70 74 72 2c 0a 20 20 20 20 20 20 har *ptr,.
2ea0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2eb0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 65 6e 64 2c const char *end,
2ec0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2ed0: 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 61 const cha
2ee0: 72 20 2a 2a 62 61 64 50 74 72 2c 0a 20 20 20 20 r **badPtr,.
2ef0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2f00: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 2a 76 const char **v
2f10: 65 72 73 69 6f 6e 50 74 72 2c 0a 20 20 20 20 20 ersionPtr,.
2f20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2f30: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 2a 76 65 const char **ve
2f40: 72 73 69 6f 6e 45 6e 64 50 74 72 2c 0a 20 20 20 rsionEndPtr,.
2f50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2f60: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 2a const char **
2f70: 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 50 74 72 2c encodingNamePtr,
2f80: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2f90: 20 20 20 20 20 20 20 63 6f 6e 73 74 20 45 4e 43 const ENC
2fa0: 4f 44 49 4e 47 20 2a 2a 6e 61 6d 65 64 45 6e 63 ODING **namedEnc
2fb0: 6f 64 69 6e 67 50 74 72 2c 0a 20 20 20 20 20 20 odingPtr,.
2fc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2fd0: 69 6e 74 20 2a 73 74 61 6e 64 61 6c 6f 6e 65 50 int *standaloneP
2fe0: 74 72 29 3b 0a 0a 69 6e 74 20 58 6d 6c 49 6e 69 tr);..int XmlIni
2ff0: 74 45 6e 63 6f 64 69 6e 67 4e 53 28 49 4e 49 54 tEncodingNS(INIT
3000: 5f 45 4e 43 4f 44 49 4e 47 20 2a 2c 20 63 6f 6e _ENCODING *, con
3010: 73 74 20 45 4e 43 4f 44 49 4e 47 20 2a 2a 2c 20 st ENCODING **,
3020: 63 6f 6e 73 74 20 63 68 61 72 20 2a 6e 61 6d 65 const char *name
3030: 29 3b 0a 63 6f 6e 73 74 20 45 4e 43 4f 44 49 4e );.const ENCODIN
3040: 47 20 2a 58 6d 6c 47 65 74 55 74 66 38 49 6e 74 G *XmlGetUtf8Int
3050: 65 72 6e 61 6c 45 6e 63 6f 64 69 6e 67 4e 53 28 ernalEncodingNS(
3060: 76 6f 69 64 29 3b 0a 63 6f 6e 73 74 20 45 4e 43 void);.const ENC
3070: 4f 44 49 4e 47 20 2a 58 6d 6c 47 65 74 55 74 66 ODING *XmlGetUtf
3080: 31 36 49 6e 74 65 72 6e 61 6c 45 6e 63 6f 64 69 16InternalEncodi
3090: 6e 67 4e 53 28 76 6f 69 64 29 3b 0a 45 4e 43 4f ngNS(void);.ENCO
30a0: 44 49 4e 47 20 2a 0a 58 6d 6c 49 6e 69 74 55 6e DING *.XmlInitUn
30b0: 6b 6e 6f 77 6e 45 6e 63 6f 64 69 6e 67 4e 53 28 knownEncodingNS(
30c0: 76 6f 69 64 20 2a 6d 65 6d 2c 0a 20 20 20 20 20 void *mem,.
30d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
30e0: 20 20 20 20 69 6e 74 20 2a 74 61 62 6c 65 2c 0a int *table,.
30f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3100: 20 20 20 20 20 20 20 20 20 43 4f 4e 56 45 52 54 CONVERT
3110: 45 52 20 63 6f 6e 76 65 72 74 2c 0a 20 20 20 20 ER convert,.
3120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3130: 20 20 20 20 20 76 6f 69 64 20 2a 75 73 65 72 44 void *userD
3140: 61 74 61 29 3b 0a 23 69 66 64 65 66 20 5f 5f 63 ata);.#ifdef __c
3150: 70 6c 75 73 70 6c 75 73 0a 7d 0a 23 65 6e 64 69 plusplus.}.#endi
3160: 66 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 6e 6f 74 f..#endif /* not
3170: 20 58 6d 6c 54 6f 6b 5f 49 4e 43 4c 55 44 45 44 XmlTok_INCLUDED
3180: 20 2a 2f 0a */.