Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xmlparse.c File Reference
#include <expat_config.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "ascii.h"
#include "expat.h"
#include "siphash.h"
#include "internal.h"
#include "xmltok.h"
#include "xmlrole.h"

Go to the source code of this file.

Classes

struct  NAMED
 
struct  HASH_TABLE
 
struct  HASH_TABLE_ITER
 
struct  binding
 
struct  prefix
 
struct  TAG_NAME
 
struct  tag
 
struct  ENTITY
 
struct  CONTENT_SCAFFOLD
 
struct  block
 
struct  STRING_POOL
 
struct  attribute_id
 
struct  DEFAULT_ATTRIBUTE
 
struct  NS_ATT
 
struct  ELEMENT_TYPE
 
struct  DTD
 
struct  open_internal_entity
 
struct  accounting
 
struct  entity_stats
 
struct  XML_ParserStruct
 

Macros

#define XML_BUILDING_EXPAT   1
 
#define _GNU_SOURCE   1 /* syscall prototype */
 
#define XML_ENCODE_MAX   XML_UTF8_ENCODE_MAX
 
#define XmlConvert   XmlUtf8Convert
 
#define XmlGetInternalEncoding   XmlGetUtf8InternalEncoding
 
#define XmlGetInternalEncodingNS   XmlGetUtf8InternalEncodingNS
 
#define XmlEncode   XmlUtf8Encode
 
#define MUST_CONVERT(enc, s)
 
#define XML_T(x)
 
#define XML_L(x)
 
#define ROUND_UP(n, sz)
 
#define EXPAT_SAFE_PTR_DIFF(p, q)
 
#define SECOND_HASH(hash, mask, power)
 
#define PROBE_STEP(hash, mask, power)
 
#define INIT_TAG_BUF_SIZE   32 /* must be a multiple of sizeof(XML_Char) */
 
#define INIT_DATA_BUF_SIZE   1024
 
#define INIT_ATTS_SIZE   16
 
#define INIT_ATTS_VERSION   0xFFFFFFFF
 
#define INIT_BLOCK_SIZE   1024
 
#define INIT_BUFFER_SIZE   1024
 
#define EXPAND_SPARE   24
 
#define INIT_SCAFFOLD_ELEMENTS   32
 
#define poolStart(pool)
 
#define poolEnd(pool)
 
#define poolLength(pool)
 
#define poolChop(pool)
 
#define poolLastChar(pool)
 
#define poolDiscard(pool)
 
#define poolFinish(pool)
 
#define poolAppendChar(pool, c)
 
#define MALLOC(parser, s)
 
#define REALLOC(parser, p, s)
 
#define FREE(parser, p)
 
#define V1(a, b, c)
 
#define V2(a, b, c)
 
#define CONTEXT_SEP   XML_T(ASCII_FF)
 
#define INIT_POWER   6
 

Typedefs

typedef char ICHAR
 
typedef const XML_CharKEY
 
typedef struct binding BINDING
 
typedef struct prefix PREFIX
 
typedef struct tag TAG
 
typedef struct block BLOCK
 
typedef struct attribute_id ATTRIBUTE_ID
 
typedef struct open_internal_entity OPEN_INTERNAL_ENTITY
 
typedef unsigned long long XmlBigCount
 
typedef struct accounting ACCOUNTING
 
typedef struct entity_stats ENTITY_STATS
 

Enumerations

enum  XML_Account { XML_ACCOUNT_DIRECT , XML_ACCOUNT_ENTITY_EXPANSION , XML_ACCOUNT_NONE }
 

Functions

enum XML_Error PTRCALL Processor (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
XML_Parser XMLCALL XML_ParserCreate (const XML_Char *encodingName)
 
XML_Parser XMLCALL XML_ParserCreateNS (const XML_Char *encodingName, XML_Char nsSep)
 
XML_Parser XMLCALL XML_ParserCreate_MM (const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep)
 
XML_Bool XMLCALL XML_ParserReset (XML_Parser parser, const XML_Char *encodingName)
 
enum XML_Status XMLCALL XML_SetEncoding (XML_Parser parser, const XML_Char *encodingName)
 
XML_Parser XMLCALL XML_ExternalEntityParserCreate (XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName)
 
void XMLCALL XML_ParserFree (XML_Parser parser)
 
void XMLCALL XML_UseParserAsHandlerArg (XML_Parser parser)
 
enum XML_Error XMLCALL XML_UseForeignDTD (XML_Parser parser, XML_Bool useDTD)
 
void XMLCALL XML_SetReturnNSTriplet (XML_Parser parser, int do_nst)
 
void XMLCALL XML_SetUserData (XML_Parser parser, void *p)
 
enum XML_Status XMLCALL XML_SetBase (XML_Parser parser, const XML_Char *p)
 
const XML_Char *XMLCALL XML_GetBase (XML_Parser parser)
 
int XMLCALL XML_GetSpecifiedAttributeCount (XML_Parser parser)
 
int XMLCALL XML_GetIdAttributeIndex (XML_Parser parser)
 
void XMLCALL XML_SetElementHandler (XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
 
void XMLCALL XML_SetStartElementHandler (XML_Parser parser, XML_StartElementHandler start)
 
void XMLCALL XML_SetEndElementHandler (XML_Parser parser, XML_EndElementHandler end)
 
void XMLCALL XML_SetCharacterDataHandler (XML_Parser parser, XML_CharacterDataHandler handler)
 
void XMLCALL XML_SetProcessingInstructionHandler (XML_Parser parser, XML_ProcessingInstructionHandler handler)
 
void XMLCALL XML_SetCommentHandler (XML_Parser parser, XML_CommentHandler handler)
 
void XMLCALL XML_SetCdataSectionHandler (XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end)
 
void XMLCALL XML_SetStartCdataSectionHandler (XML_Parser parser, XML_StartCdataSectionHandler start)
 
void XMLCALL XML_SetEndCdataSectionHandler (XML_Parser parser, XML_EndCdataSectionHandler end)
 
void XMLCALL XML_SetDefaultHandler (XML_Parser parser, XML_DefaultHandler handler)
 
void XMLCALL XML_SetDefaultHandlerExpand (XML_Parser parser, XML_DefaultHandler handler)
 
void XMLCALL XML_SetDoctypeDeclHandler (XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end)
 
void XMLCALL XML_SetStartDoctypeDeclHandler (XML_Parser parser, XML_StartDoctypeDeclHandler start)
 
void XMLCALL XML_SetEndDoctypeDeclHandler (XML_Parser parser, XML_EndDoctypeDeclHandler end)
 
void XMLCALL XML_SetUnparsedEntityDeclHandler (XML_Parser parser, XML_UnparsedEntityDeclHandler handler)
 
void XMLCALL XML_SetNotationDeclHandler (XML_Parser parser, XML_NotationDeclHandler handler)
 
void XMLCALL XML_SetNamespaceDeclHandler (XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)
 
void XMLCALL XML_SetStartNamespaceDeclHandler (XML_Parser parser, XML_StartNamespaceDeclHandler start)
 
void XMLCALL XML_SetEndNamespaceDeclHandler (XML_Parser parser, XML_EndNamespaceDeclHandler end)
 
void XMLCALL XML_SetNotStandaloneHandler (XML_Parser parser, XML_NotStandaloneHandler handler)
 
void XMLCALL XML_SetExternalEntityRefHandler (XML_Parser parser, XML_ExternalEntityRefHandler handler)
 
void XMLCALL XML_SetExternalEntityRefHandlerArg (XML_Parser parser, void *arg)
 
void XMLCALL XML_SetSkippedEntityHandler (XML_Parser parser, XML_SkippedEntityHandler handler)
 
void XMLCALL XML_SetUnknownEncodingHandler (XML_Parser parser, XML_UnknownEncodingHandler handler, void *data)
 
void XMLCALL XML_SetElementDeclHandler (XML_Parser parser, XML_ElementDeclHandler eldecl)
 
void XMLCALL XML_SetAttlistDeclHandler (XML_Parser parser, XML_AttlistDeclHandler attdecl)
 
void XMLCALL XML_SetEntityDeclHandler (XML_Parser parser, XML_EntityDeclHandler handler)
 
void XMLCALL XML_SetXmlDeclHandler (XML_Parser parser, XML_XmlDeclHandler handler)
 
int XMLCALL XML_SetParamEntityParsing (XML_Parser parser, enum XML_ParamEntityParsing peParsing)
 
int XMLCALL XML_SetHashSalt (XML_Parser parser, unsigned long hash_salt)
 
enum XML_Status XMLCALL XML_Parse (XML_Parser parser, const char *s, int len, int isFinal)
 
enum XML_Status XMLCALL XML_ParseBuffer (XML_Parser parser, int len, int isFinal)
 
void *XMLCALL XML_GetBuffer (XML_Parser parser, int len)
 
enum XML_Status XMLCALL XML_StopParser (XML_Parser parser, XML_Bool resumable)
 
enum XML_Status XMLCALL XML_ResumeParser (XML_Parser parser)
 
void XMLCALL XML_GetParsingStatus (XML_Parser parser, XML_ParsingStatus *status)
 
enum XML_Error XMLCALL XML_GetErrorCode (XML_Parser parser)
 
XML_Index XMLCALL XML_GetCurrentByteIndex (XML_Parser parser)
 
int XMLCALL XML_GetCurrentByteCount (XML_Parser parser)
 
const char *XMLCALL XML_GetInputContext (XML_Parser parser, int *offset, int *size)
 
XML_Size XMLCALL XML_GetCurrentLineNumber (XML_Parser parser)
 
XML_Size XMLCALL XML_GetCurrentColumnNumber (XML_Parser parser)
 
void XMLCALL XML_FreeContentModel (XML_Parser parser, XML_Content *model)
 
void *XMLCALL XML_MemMalloc (XML_Parser parser, size_t size)
 
void *XMLCALL XML_MemRealloc (XML_Parser parser, void *ptr, size_t size)
 
void XMLCALL XML_MemFree (XML_Parser parser, void *ptr)
 
void XMLCALL XML_DefaultCurrent (XML_Parser parser)
 
const XML_LChar *XMLCALL XML_ErrorString (enum XML_Error code)
 
const XML_LChar *XMLCALL XML_ExpatVersion (void)
 
XML_Expat_Version XMLCALL XML_ExpatVersionInfo (void)
 
const XML_Feature *XMLCALL XML_GetFeatureList (void)
 
XML_Bool XMLCALL XML_SetBillionLaughsAttackProtectionMaximumAmplification (XML_Parser parser, float maximumAmplificationFactor)
 
XML_Bool XMLCALL XML_SetBillionLaughsAttackProtectionActivationThreshold (XML_Parser parser, unsigned long long activationThresholdBytes)
 
unsigned long long testingAccountingGetCountBytesDirect (XML_Parser parser)
 
unsigned long long testingAccountingGetCountBytesIndirect (XML_Parser parser)
 
const char * unsignedCharToPrintable (unsigned char c)
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE   1 /* syscall prototype */

Definition at line 65 of file xmlparse.c.

◆ CONTEXT_SEP

#define CONTEXT_SEP   XML_T(ASCII_FF)

Definition at line 6516 of file xmlparse.c.

◆ EXPAND_SPARE

#define EXPAND_SPARE   24

Definition at line 245 of file xmlparse.c.

◆ EXPAT_SAFE_PTR_DIFF

#define EXPAT_SAFE_PTR_DIFF ( p,
q )
Value:
(((p) && (q)) ? ((p) - (q)) : 0)

Definition at line 196 of file xmlparse.c.

Referenced by XML_GetBuffer().

◆ FREE

#define FREE ( parser,
p )
Value:
(parser->m_mem.free_fcn((p)))

Definition at line 713 of file xmlparse.c.

Referenced by XML_FreeContentModel(), XML_GetBuffer(), XML_MemFree(), XML_ParserFree(), XML_ParserReset(), and XML_SetEncoding().

◆ INIT_ATTS_SIZE

#define INIT_ATTS_SIZE   16

Definition at line 240 of file xmlparse.c.

◆ INIT_ATTS_VERSION

#define INIT_ATTS_VERSION   0xFFFFFFFF

Definition at line 241 of file xmlparse.c.

◆ INIT_BLOCK_SIZE

#define INIT_BLOCK_SIZE   1024

Definition at line 242 of file xmlparse.c.

◆ INIT_BUFFER_SIZE

#define INIT_BUFFER_SIZE   1024

Definition at line 243 of file xmlparse.c.

Referenced by XML_GetBuffer().

◆ INIT_DATA_BUF_SIZE

#define INIT_DATA_BUF_SIZE   1024

Definition at line 239 of file xmlparse.c.

◆ INIT_POWER

#define INIT_POWER   6

Definition at line 6987 of file xmlparse.c.

◆ INIT_SCAFFOLD_ELEMENTS

#define INIT_SCAFFOLD_ELEMENTS   32

Definition at line 318 of file xmlparse.c.

◆ INIT_TAG_BUF_SIZE

#define INIT_TAG_BUF_SIZE   32 /* must be a multiple of sizeof(XML_Char) */

Definition at line 238 of file xmlparse.c.

◆ MALLOC

#define MALLOC ( parser,
s )
Value:
(parser->m_mem.malloc_fcn((s)))

Definition at line 711 of file xmlparse.c.

Referenced by XML_GetBuffer(), and XML_MemMalloc().

◆ MUST_CONVERT

#define MUST_CONVERT ( enc,
s )
Value:
(! (enc)->isUtf8)

Definition at line 161 of file xmlparse.c.

◆ poolAppendChar

#define poolAppendChar ( pool,
c )
Value:
(((pool)->ptr == (pool)->end && ! poolGrow(pool)) \
? 0 \
: ((*((pool)->ptr)++ = c), 1))

Definition at line 599 of file xmlparse.c.

599#define poolAppendChar(pool, c) \
600 (((pool)->ptr == (pool)->end && ! poolGrow(pool)) \
601 ? 0 \
602 : ((*((pool)->ptr)++ = c), 1))

◆ poolChop

#define poolChop ( pool)
Value:
((void)--(pool->ptr))

Definition at line 595 of file xmlparse.c.

◆ poolDiscard

#define poolDiscard ( pool)
Value:
((pool)->ptr = (pool)->start)

Definition at line 597 of file xmlparse.c.

◆ poolEnd

#define poolEnd ( pool)
Value:
((pool)->ptr)

Definition at line 593 of file xmlparse.c.

◆ poolFinish

#define poolFinish ( pool)
Value:
((pool)->start = (pool)->ptr)

Definition at line 598 of file xmlparse.c.

◆ poolLastChar

#define poolLastChar ( pool)
Value:
(((pool)->ptr)[-1])

Definition at line 596 of file xmlparse.c.

◆ poolLength

#define poolLength ( pool)
Value:
((pool)->ptr - (pool)->start)

Definition at line 594 of file xmlparse.c.

◆ poolStart

#define poolStart ( pool)
Value:
((pool)->start)

Definition at line 592 of file xmlparse.c.

◆ PROBE_STEP

#define PROBE_STEP ( hash,
mask,
power )
Value:
((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
#define SECOND_HASH(hash, mask, power)
Definition xmlparse.c:228

Definition at line 230 of file xmlparse.c.

230#define PROBE_STEP(hash, mask, power) \
231 ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))

◆ REALLOC

#define REALLOC ( parser,
p,
s )
Value:
(parser->m_mem.realloc_fcn((p), (s)))

Definition at line 712 of file xmlparse.c.

Referenced by XML_MemRealloc(), and XML_Parse().

◆ ROUND_UP

#define ROUND_UP ( n,
sz )
Value:
(((n) + ((sz)-1)) & ~((sz)-1))

Definition at line 193 of file xmlparse.c.

◆ SECOND_HASH

#define SECOND_HASH ( hash,
mask,
power )
Value:
((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2))

Definition at line 228 of file xmlparse.c.

228#define SECOND_HASH(hash, mask, power) \
229 ((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2))

◆ V1

#define V1 ( a,
b,
c )
Value:
XML_L(#a) XML_L(".") XML_L(#b) XML_L(".") XML_L(#c)
#define XML_L(x)
Definition xmlparse.c:188

Referenced by G4Abla::DeexcitationAblaxx(), and G4TwistedTrd::GetSurfaceArea().

◆ V2

#define V2 ( a,
b,
c )
Value:
XML_L("expat_") V1(a, b, c)
#define V1(a, b, c)

Referenced by G4Abla::DeexcitationAblaxx(), G4TwistedTrd::GetSurfaceArea(), and XML_ExpatVersion().

◆ XML_BUILDING_EXPAT

#define XML_BUILDING_EXPAT   1

Definition at line 60 of file xmlparse.c.

◆ XML_ENCODE_MAX

#define XML_ENCODE_MAX   XML_UTF8_ENCODE_MAX

Definition at line 156 of file xmlparse.c.

◆ XML_L

#define XML_L ( x)
Value:
x

Definition at line 188 of file xmlparse.c.

Referenced by XML_ErrorString(), and XML_GetFeatureList().

◆ XML_T

#define XML_T ( x)
Value:
x

Definition at line 187 of file xmlparse.c.

◆ XmlConvert

#define XmlConvert   XmlUtf8Convert

Definition at line 157 of file xmlparse.c.

◆ XmlEncode

#define XmlEncode   XmlUtf8Encode

Definition at line 160 of file xmlparse.c.

◆ XmlGetInternalEncoding

#define XmlGetInternalEncoding   XmlGetUtf8InternalEncoding

Definition at line 158 of file xmlparse.c.

◆ XmlGetInternalEncodingNS

#define XmlGetInternalEncodingNS   XmlGetUtf8InternalEncodingNS

Definition at line 159 of file xmlparse.c.

Typedef Documentation

◆ ACCOUNTING

typedef struct accounting ACCOUNTING

◆ ATTRIBUTE_ID

typedef struct attribute_id ATTRIBUTE_ID

◆ BINDING

typedef struct binding BINDING

◆ BLOCK

typedef struct block BLOCK

◆ ENTITY_STATS

typedef struct entity_stats ENTITY_STATS

◆ ICHAR

typedef char ICHAR

Definition at line 162 of file xmlparse.c.

◆ KEY

typedef const XML_Char* KEY

Definition at line 202 of file xmlparse.c.

◆ OPEN_INTERNAL_ENTITY

◆ PREFIX

typedef struct prefix PREFIX

◆ TAG

typedef struct tag TAG

◆ XmlBigCount

typedef unsigned long long XmlBigCount

Definition at line 411 of file xmlparse.c.

Enumeration Type Documentation

◆ XML_Account

Enumerator
XML_ACCOUNT_DIRECT 
XML_ACCOUNT_ENTITY_EXPANSION 
XML_ACCOUNT_NONE 

Definition at line 403 of file xmlparse.c.

403 {
404 XML_ACCOUNT_DIRECT, /* bytes directly passed to the Expat parser */
405 XML_ACCOUNT_ENTITY_EXPANSION, /* intermediate bytes produced during entity
406 expansion */
407 XML_ACCOUNT_NONE /* i.e. do not account, was accounted already */
408};
@ XML_ACCOUNT_DIRECT
Definition xmlparse.c:404
@ XML_ACCOUNT_NONE
Definition xmlparse.c:407
@ XML_ACCOUNT_ENTITY_EXPANSION
Definition xmlparse.c:405

Function Documentation

◆ Processor()

enum XML_Error PTRCALL Processor ( XML_Parser parser,
const char * start,
const char * end,
const char ** endPtr )

◆ testingAccountingGetCountBytesDirect()

unsigned long long testingAccountingGetCountBytesDirect ( XML_Parser parser)

Definition at line 7770 of file xmlparse.c.

7770 {
7771 if (! parser)
7772 return 0;
7773 return parser->m_accounting.countBytesDirect;
7774}
ACCOUNTING m_accounting
Definition xmlparse.c:706
XmlBigCount countBytesDirect
Definition xmlparse.c:413

◆ testingAccountingGetCountBytesIndirect()

unsigned long long testingAccountingGetCountBytesIndirect ( XML_Parser parser)

Definition at line 7777 of file xmlparse.c.

7777 {
7778 if (! parser)
7779 return 0;
7780 return parser->m_accounting.countBytesIndirect;
7781}
XmlBigCount countBytesIndirect
Definition xmlparse.c:414

◆ unsignedCharToPrintable()

const char * unsignedCharToPrintable ( unsigned char c)

Definition at line 7847 of file xmlparse.c.

7847 {
7848 switch (c) {
7849 case 0:
7850 return "\\0";
7851 case 1:
7852 return "\\x1";
7853 case 2:
7854 return "\\x2";
7855 case 3:
7856 return "\\x3";
7857 case 4:
7858 return "\\x4";
7859 case 5:
7860 return "\\x5";
7861 case 6:
7862 return "\\x6";
7863 case 7:
7864 return "\\x7";
7865 case 8:
7866 return "\\x8";
7867 case 9:
7868 return "\\t";
7869 case 10:
7870 return "\\n";
7871 case 11:
7872 return "\\xB";
7873 case 12:
7874 return "\\xC";
7875 case 13:
7876 return "\\r";
7877 case 14:
7878 return "\\xE";
7879 case 15:
7880 return "\\xF";
7881 case 16:
7882 return "\\x10";
7883 case 17:
7884 return "\\x11";
7885 case 18:
7886 return "\\x12";
7887 case 19:
7888 return "\\x13";
7889 case 20:
7890 return "\\x14";
7891 case 21:
7892 return "\\x15";
7893 case 22:
7894 return "\\x16";
7895 case 23:
7896 return "\\x17";
7897 case 24:
7898 return "\\x18";
7899 case 25:
7900 return "\\x19";
7901 case 26:
7902 return "\\x1A";
7903 case 27:
7904 return "\\x1B";
7905 case 28:
7906 return "\\x1C";
7907 case 29:
7908 return "\\x1D";
7909 case 30:
7910 return "\\x1E";
7911 case 31:
7912 return "\\x1F";
7913 case 32:
7914 return " ";
7915 case 33:
7916 return "!";
7917 case 34:
7918 return "\\\"";
7919 case 35:
7920 return "#";
7921 case 36:
7922 return "$";
7923 case 37:
7924 return "%";
7925 case 38:
7926 return "&";
7927 case 39:
7928 return "'";
7929 case 40:
7930 return "(";
7931 case 41:
7932 return ")";
7933 case 42:
7934 return "*";
7935 case 43:
7936 return "+";
7937 case 44:
7938 return ",";
7939 case 45:
7940 return "-";
7941 case 46:
7942 return ".";
7943 case 47:
7944 return "/";
7945 case 48:
7946 return "0";
7947 case 49:
7948 return "1";
7949 case 50:
7950 return "2";
7951 case 51:
7952 return "3";
7953 case 52:
7954 return "4";
7955 case 53:
7956 return "5";
7957 case 54:
7958 return "6";
7959 case 55:
7960 return "7";
7961 case 56:
7962 return "8";
7963 case 57:
7964 return "9";
7965 case 58:
7966 return ":";
7967 case 59:
7968 return ";";
7969 case 60:
7970 return "<";
7971 case 61:
7972 return "=";
7973 case 62:
7974 return ">";
7975 case 63:
7976 return "?";
7977 case 64:
7978 return "@";
7979 case 65:
7980 return "A";
7981 case 66:
7982 return "B";
7983 case 67:
7984 return "C";
7985 case 68:
7986 return "D";
7987 case 69:
7988 return "E";
7989 case 70:
7990 return "F";
7991 case 71:
7992 return "G";
7993 case 72:
7994 return "H";
7995 case 73:
7996 return "I";
7997 case 74:
7998 return "J";
7999 case 75:
8000 return "K";
8001 case 76:
8002 return "L";
8003 case 77:
8004 return "M";
8005 case 78:
8006 return "N";
8007 case 79:
8008 return "O";
8009 case 80:
8010 return "P";
8011 case 81:
8012 return "Q";
8013 case 82:
8014 return "R";
8015 case 83:
8016 return "S";
8017 case 84:
8018 return "T";
8019 case 85:
8020 return "U";
8021 case 86:
8022 return "V";
8023 case 87:
8024 return "W";
8025 case 88:
8026 return "X";
8027 case 89:
8028 return "Y";
8029 case 90:
8030 return "Z";
8031 case 91:
8032 return "[";
8033 case 92:
8034 return "\\\\";
8035 case 93:
8036 return "]";
8037 case 94:
8038 return "^";
8039 case 95:
8040 return "_";
8041 case 96:
8042 return "`";
8043 case 97:
8044 return "a";
8045 case 98:
8046 return "b";
8047 case 99:
8048 return "c";
8049 case 100:
8050 return "d";
8051 case 101:
8052 return "e";
8053 case 102:
8054 return "f";
8055 case 103:
8056 return "g";
8057 case 104:
8058 return "h";
8059 case 105:
8060 return "i";
8061 case 106:
8062 return "j";
8063 case 107:
8064 return "k";
8065 case 108:
8066 return "l";
8067 case 109:
8068 return "m";
8069 case 110:
8070 return "n";
8071 case 111:
8072 return "o";
8073 case 112:
8074 return "p";
8075 case 113:
8076 return "q";
8077 case 114:
8078 return "r";
8079 case 115:
8080 return "s";
8081 case 116:
8082 return "t";
8083 case 117:
8084 return "u";
8085 case 118:
8086 return "v";
8087 case 119:
8088 return "w";
8089 case 120:
8090 return "x";
8091 case 121:
8092 return "y";
8093 case 122:
8094 return "z";
8095 case 123:
8096 return "{";
8097 case 124:
8098 return "|";
8099 case 125:
8100 return "}";
8101 case 126:
8102 return "~";
8103 case 127:
8104 return "\\x7F";
8105 case 128:
8106 return "\\x80";
8107 case 129:
8108 return "\\x81";
8109 case 130:
8110 return "\\x82";
8111 case 131:
8112 return "\\x83";
8113 case 132:
8114 return "\\x84";
8115 case 133:
8116 return "\\x85";
8117 case 134:
8118 return "\\x86";
8119 case 135:
8120 return "\\x87";
8121 case 136:
8122 return "\\x88";
8123 case 137:
8124 return "\\x89";
8125 case 138:
8126 return "\\x8A";
8127 case 139:
8128 return "\\x8B";
8129 case 140:
8130 return "\\x8C";
8131 case 141:
8132 return "\\x8D";
8133 case 142:
8134 return "\\x8E";
8135 case 143:
8136 return "\\x8F";
8137 case 144:
8138 return "\\x90";
8139 case 145:
8140 return "\\x91";
8141 case 146:
8142 return "\\x92";
8143 case 147:
8144 return "\\x93";
8145 case 148:
8146 return "\\x94";
8147 case 149:
8148 return "\\x95";
8149 case 150:
8150 return "\\x96";
8151 case 151:
8152 return "\\x97";
8153 case 152:
8154 return "\\x98";
8155 case 153:
8156 return "\\x99";
8157 case 154:
8158 return "\\x9A";
8159 case 155:
8160 return "\\x9B";
8161 case 156:
8162 return "\\x9C";
8163 case 157:
8164 return "\\x9D";
8165 case 158:
8166 return "\\x9E";
8167 case 159:
8168 return "\\x9F";
8169 case 160:
8170 return "\\xA0";
8171 case 161:
8172 return "\\xA1";
8173 case 162:
8174 return "\\xA2";
8175 case 163:
8176 return "\\xA3";
8177 case 164:
8178 return "\\xA4";
8179 case 165:
8180 return "\\xA5";
8181 case 166:
8182 return "\\xA6";
8183 case 167:
8184 return "\\xA7";
8185 case 168:
8186 return "\\xA8";
8187 case 169:
8188 return "\\xA9";
8189 case 170:
8190 return "\\xAA";
8191 case 171:
8192 return "\\xAB";
8193 case 172:
8194 return "\\xAC";
8195 case 173:
8196 return "\\xAD";
8197 case 174:
8198 return "\\xAE";
8199 case 175:
8200 return "\\xAF";
8201 case 176:
8202 return "\\xB0";
8203 case 177:
8204 return "\\xB1";
8205 case 178:
8206 return "\\xB2";
8207 case 179:
8208 return "\\xB3";
8209 case 180:
8210 return "\\xB4";
8211 case 181:
8212 return "\\xB5";
8213 case 182:
8214 return "\\xB6";
8215 case 183:
8216 return "\\xB7";
8217 case 184:
8218 return "\\xB8";
8219 case 185:
8220 return "\\xB9";
8221 case 186:
8222 return "\\xBA";
8223 case 187:
8224 return "\\xBB";
8225 case 188:
8226 return "\\xBC";
8227 case 189:
8228 return "\\xBD";
8229 case 190:
8230 return "\\xBE";
8231 case 191:
8232 return "\\xBF";
8233 case 192:
8234 return "\\xC0";
8235 case 193:
8236 return "\\xC1";
8237 case 194:
8238 return "\\xC2";
8239 case 195:
8240 return "\\xC3";
8241 case 196:
8242 return "\\xC4";
8243 case 197:
8244 return "\\xC5";
8245 case 198:
8246 return "\\xC6";
8247 case 199:
8248 return "\\xC7";
8249 case 200:
8250 return "\\xC8";
8251 case 201:
8252 return "\\xC9";
8253 case 202:
8254 return "\\xCA";
8255 case 203:
8256 return "\\xCB";
8257 case 204:
8258 return "\\xCC";
8259 case 205:
8260 return "\\xCD";
8261 case 206:
8262 return "\\xCE";
8263 case 207:
8264 return "\\xCF";
8265 case 208:
8266 return "\\xD0";
8267 case 209:
8268 return "\\xD1";
8269 case 210:
8270 return "\\xD2";
8271 case 211:
8272 return "\\xD3";
8273 case 212:
8274 return "\\xD4";
8275 case 213:
8276 return "\\xD5";
8277 case 214:
8278 return "\\xD6";
8279 case 215:
8280 return "\\xD7";
8281 case 216:
8282 return "\\xD8";
8283 case 217:
8284 return "\\xD9";
8285 case 218:
8286 return "\\xDA";
8287 case 219:
8288 return "\\xDB";
8289 case 220:
8290 return "\\xDC";
8291 case 221:
8292 return "\\xDD";
8293 case 222:
8294 return "\\xDE";
8295 case 223:
8296 return "\\xDF";
8297 case 224:
8298 return "\\xE0";
8299 case 225:
8300 return "\\xE1";
8301 case 226:
8302 return "\\xE2";
8303 case 227:
8304 return "\\xE3";
8305 case 228:
8306 return "\\xE4";
8307 case 229:
8308 return "\\xE5";
8309 case 230:
8310 return "\\xE6";
8311 case 231:
8312 return "\\xE7";
8313 case 232:
8314 return "\\xE8";
8315 case 233:
8316 return "\\xE9";
8317 case 234:
8318 return "\\xEA";
8319 case 235:
8320 return "\\xEB";
8321 case 236:
8322 return "\\xEC";
8323 case 237:
8324 return "\\xED";
8325 case 238:
8326 return "\\xEE";
8327 case 239:
8328 return "\\xEF";
8329 case 240:
8330 return "\\xF0";
8331 case 241:
8332 return "\\xF1";
8333 case 242:
8334 return "\\xF2";
8335 case 243:
8336 return "\\xF3";
8337 case 244:
8338 return "\\xF4";
8339 case 245:
8340 return "\\xF5";
8341 case 246:
8342 return "\\xF6";
8343 case 247:
8344 return "\\xF7";
8345 case 248:
8346 return "\\xF8";
8347 case 249:
8348 return "\\xF9";
8349 case 250:
8350 return "\\xFA";
8351 case 251:
8352 return "\\xFB";
8353 case 252:
8354 return "\\xFC";
8355 case 253:
8356 return "\\xFD";
8357 case 254:
8358 return "\\xFE";
8359 case 255:
8360 return "\\xFF";
8361 default:
8362 assert(0); /* never gets here */
8363 return "dead code";
8364 }
8365 assert(0); /* never gets here */
8366}

◆ XML_DefaultCurrent()

void XMLCALL XML_DefaultCurrent ( XML_Parser parser)

Definition at line 2335 of file xmlparse.c.

2335 {
2336 if (parser == NULL)
2337 return;
2338 if (parser->m_defaultHandler) {
2339 if (parser->m_openInternalEntities)
2340 reportDefault(parser, parser->m_internalEncoding,
2343 else
2344 reportDefault(parser, parser->m_encoding, parser->m_eventPtr,
2345 parser->m_eventEndPtr);
2346 }
2347}
const ENCODING * m_encoding
Definition xmlparse.c:644
const char * m_eventEndPtr
Definition xmlparse.c:658
const ENCODING * m_internalEncoding
Definition xmlparse.c:646
OPEN_INTERNAL_ENTITY * m_openInternalEntities
Definition xmlparse.c:660
XML_DefaultHandler m_defaultHandler
Definition xmlparse.c:628
const char * m_eventPtr
Definition xmlparse.c:657
const char * internalEventEndPtr
Definition xmlparse.c:396
const char * internalEventPtr
Definition xmlparse.c:395

◆ XML_ErrorString()

const XML_LChar *XMLCALL XML_ErrorString ( enum XML_Error code)

Definition at line 2350 of file xmlparse.c.

2350 {
2351 switch (code) {
2352 case XML_ERROR_NONE:
2353 return NULL;
2355 return XML_L("out of memory");
2356 case XML_ERROR_SYNTAX:
2357 return XML_L("syntax error");
2359 return XML_L("no element found");
2361 return XML_L("not well-formed (invalid token)");
2363 return XML_L("unclosed token");
2365 return XML_L("partial character");
2367 return XML_L("mismatched tag");
2369 return XML_L("duplicate attribute");
2371 return XML_L("junk after document element");
2373 return XML_L("illegal parameter entity reference");
2375 return XML_L("undefined entity");
2377 return XML_L("recursive entity reference");
2379 return XML_L("asynchronous entity");
2381 return XML_L("reference to invalid character number");
2383 return XML_L("reference to binary entity");
2385 return XML_L("reference to external entity in attribute");
2387 return XML_L("XML or text declaration not at start of entity");
2389 return XML_L("unknown encoding");
2391 return XML_L("encoding specified in XML declaration is incorrect");
2393 return XML_L("unclosed CDATA section");
2395 return XML_L("error in processing external entity reference");
2397 return XML_L("document is not standalone");
2399 return XML_L("unexpected parser state - please send a bug report");
2401 return XML_L("entity declared in parameter entity");
2403 return XML_L("requested feature requires XML_DTD support in Expat");
2405 return XML_L("cannot change setting once parsing has begun");
2406 /* Added in 1.95.7. */
2408 return XML_L("unbound prefix");
2409 /* Added in 1.95.8. */
2411 return XML_L("must not undeclare prefix");
2413 return XML_L("incomplete markup in parameter entity");
2414 case XML_ERROR_XML_DECL:
2415 return XML_L("XML declaration not well-formed");
2417 return XML_L("text declaration not well-formed");
2418 case XML_ERROR_PUBLICID:
2419 return XML_L("illegal character(s) in public id");
2421 return XML_L("parser suspended");
2423 return XML_L("parser not suspended");
2424 case XML_ERROR_ABORTED:
2425 return XML_L("parsing aborted");
2426 case XML_ERROR_FINISHED:
2427 return XML_L("parsing finished");
2429 return XML_L("cannot suspend in external parameter entity");
2430 /* Added in 2.0.0. */
2432 return XML_L(
2433 "reserved prefix (xml) must not be undeclared or bound to another namespace name");
2435 return XML_L("reserved prefix (xmlns) must not be declared or undeclared");
2437 return XML_L(
2438 "prefix must not be bound to one of the reserved namespace names");
2439 /* Added in 2.2.5. */
2440 case XML_ERROR_INVALID_ARGUMENT: /* Constant added in 2.2.1, already */
2441 return XML_L("invalid argument");
2442 /* Added in 2.3.0. */
2444 return XML_L(
2445 "a successful prior call to function XML_GetBuffer is required");
2446 /* Added in 2.4.0. */
2448 return XML_L(
2449 "limit on input amplification factor (from DTD and entities) breached");
2450 }
2451 return NULL;
2452}
@ XML_ERROR_UNCLOSED_TOKEN
Definition expat.h:86
@ XML_ERROR_ASYNC_ENTITY
Definition expat.h:94
@ XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
Definition expat.h:97
@ XML_ERROR_NO_BUFFER
Definition expat.h:128
@ XML_ERROR_ABORTED
Definition expat.h:118
@ XML_ERROR_XML_DECL
Definition expat.h:113
@ XML_ERROR_NO_ELEMENTS
Definition expat.h:84
@ XML_ERROR_NOT_STANDALONE
Definition expat.h:103
@ XML_ERROR_INCOMPLETE_PE
Definition expat.h:112
@ XML_ERROR_TEXT_DECL
Definition expat.h:114
@ XML_ERROR_RECURSIVE_ENTITY_REF
Definition expat.h:93
@ XML_ERROR_PARTIAL_CHAR
Definition expat.h:87
@ XML_ERROR_SUSPENDED
Definition expat.h:116
@ XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
Definition expat.h:107
@ XML_ERROR_ENTITY_DECLARED_IN_PE
Definition expat.h:105
@ XML_ERROR_DUPLICATE_ATTRIBUTE
Definition expat.h:89
@ XML_ERROR_EXTERNAL_ENTITY_HANDLING
Definition expat.h:102
@ XML_ERROR_INCORRECT_ENCODING
Definition expat.h:100
@ XML_ERROR_NO_MEMORY
Definition expat.h:82
@ XML_ERROR_MISPLACED_XML_PI
Definition expat.h:98
@ XML_ERROR_AMPLIFICATION_LIMIT_BREACH
Definition expat.h:130
@ XML_ERROR_NONE
Definition expat.h:81
@ XML_ERROR_PARAM_ENTITY_REF
Definition expat.h:91
@ XML_ERROR_FEATURE_REQUIRES_XML_DTD
Definition expat.h:106
@ XML_ERROR_RESERVED_PREFIX_XML
Definition expat.h:122
@ XML_ERROR_UNEXPECTED_STATE
Definition expat.h:104
@ XML_ERROR_TAG_MISMATCH
Definition expat.h:88
@ XML_ERROR_FINISHED
Definition expat.h:119
@ XML_ERROR_JUNK_AFTER_DOC_ELEMENT
Definition expat.h:90
@ XML_ERROR_NOT_SUSPENDED
Definition expat.h:117
@ XML_ERROR_UNCLOSED_CDATA_SECTION
Definition expat.h:101
@ XML_ERROR_RESERVED_NAMESPACE_URI
Definition expat.h:124
@ XML_ERROR_BAD_CHAR_REF
Definition expat.h:95
@ XML_ERROR_UNDEFINED_ENTITY
Definition expat.h:92
@ XML_ERROR_UNBOUND_PREFIX
Definition expat.h:109
@ XML_ERROR_PUBLICID
Definition expat.h:115
@ XML_ERROR_UNDECLARING_PREFIX
Definition expat.h:111
@ XML_ERROR_INVALID_TOKEN
Definition expat.h:85
@ XML_ERROR_BINARY_ENTITY_REF
Definition expat.h:96
@ XML_ERROR_UNKNOWN_ENCODING
Definition expat.h:99
@ XML_ERROR_SUSPEND_PE
Definition expat.h:120
@ XML_ERROR_INVALID_ARGUMENT
Definition expat.h:126
@ XML_ERROR_SYNTAX
Definition expat.h:83
@ XML_ERROR_RESERVED_PREFIX_XMLNS
Definition expat.h:123

◆ XML_ExpatVersion()

const XML_LChar *XMLCALL XML_ExpatVersion ( void )

Definition at line 2455 of file xmlparse.c.

2455 {
2456 /* V1 is used to string-ize the version number. However, it would
2457 string-ize the actual version macro *names* unless we get them
2458 substituted before being passed to V1. CPP is defined to expand
2459 a macro, then rescan for more expansions. Thus, we use V2 to expand
2460 the version macros, then CPP will expand the resulting V1() macro
2461 with the correct numerals. */
2462 /* ### I'm assuming cpp is portable in this respect... */
2463
2464#define V1(a, b, c) XML_L(#a) XML_L(".") XML_L(#b) XML_L(".") XML_L(#c)
2465#define V2(a, b, c) XML_L("expat_") V1(a, b, c)
2466
2468
2469#undef V1
2470#undef V2
2471}
#define XML_MAJOR_VERSION
Definition expat.h:1056
#define XML_MINOR_VERSION
Definition expat.h:1057
#define XML_MICRO_VERSION
Definition expat.h:1058
#define V2(a, b, c)

◆ XML_ExpatVersionInfo()

XML_Expat_Version XMLCALL XML_ExpatVersionInfo ( void )

Definition at line 2474 of file xmlparse.c.

2474 {
2475 XML_Expat_Version version;
2476
2477 version.major = XML_MAJOR_VERSION;
2478 version.minor = XML_MINOR_VERSION;
2479 version.micro = XML_MICRO_VERSION;
2480
2481 return version;
2482}

◆ XML_ExternalEntityParserCreate()

XML_Parser XMLCALL XML_ExternalEntityParserCreate ( XML_Parser oldParser,
const XML_Char * context,
const XML_Char * encodingName )

Definition at line 1250 of file xmlparse.c.

1251 {
1252 XML_Parser parser = oldParser;
1253 DTD *newDtd = NULL;
1254 DTD *oldDtd;
1255 XML_StartElementHandler oldStartElementHandler;
1256 XML_EndElementHandler oldEndElementHandler;
1257 XML_CharacterDataHandler oldCharacterDataHandler;
1258 XML_ProcessingInstructionHandler oldProcessingInstructionHandler;
1259 XML_CommentHandler oldCommentHandler;
1260 XML_StartCdataSectionHandler oldStartCdataSectionHandler;
1261 XML_EndCdataSectionHandler oldEndCdataSectionHandler;
1262 XML_DefaultHandler oldDefaultHandler;
1263 XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler;
1264 XML_NotationDeclHandler oldNotationDeclHandler;
1265 XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler;
1266 XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler;
1267 XML_NotStandaloneHandler oldNotStandaloneHandler;
1268 XML_ExternalEntityRefHandler oldExternalEntityRefHandler;
1269 XML_SkippedEntityHandler oldSkippedEntityHandler;
1270 XML_UnknownEncodingHandler oldUnknownEncodingHandler;
1271 XML_ElementDeclHandler oldElementDeclHandler;
1272 XML_AttlistDeclHandler oldAttlistDeclHandler;
1273 XML_EntityDeclHandler oldEntityDeclHandler;
1274 XML_XmlDeclHandler oldXmlDeclHandler;
1275 ELEMENT_TYPE *oldDeclElementType;
1276
1277 void *oldUserData;
1278 void *oldHandlerArg;
1279 XML_Bool oldDefaultExpandInternalEntities;
1280 XML_Parser oldExternalEntityRefHandlerArg;
1281#ifdef XML_DTD
1282 enum XML_ParamEntityParsing oldParamEntityParsing;
1283 int oldInEntityValue;
1284#endif
1285 XML_Bool oldns_triplets;
1286 /* Note that the new parser shares the same hash secret as the old
1287 parser, so that dtdCopy and copyEntityTable can lookup values
1288 from hash tables associated with either parser without us having
1289 to worry which hash secrets each table has.
1290 */
1291 unsigned long oldhash_secret_salt;
1292
1293 /* Validate the oldParser parameter before we pull everything out of it */
1294 if (oldParser == NULL)
1295 return NULL;
1296
1297 /* Stash the original parser contents on the stack */
1298 oldDtd = parser->m_dtd;
1299 oldStartElementHandler = parser->m_startElementHandler;
1300 oldEndElementHandler = parser->m_endElementHandler;
1301 oldCharacterDataHandler = parser->m_characterDataHandler;
1302 oldProcessingInstructionHandler = parser->m_processingInstructionHandler;
1303 oldCommentHandler = parser->m_commentHandler;
1304 oldStartCdataSectionHandler = parser->m_startCdataSectionHandler;
1305 oldEndCdataSectionHandler = parser->m_endCdataSectionHandler;
1306 oldDefaultHandler = parser->m_defaultHandler;
1307 oldUnparsedEntityDeclHandler = parser->m_unparsedEntityDeclHandler;
1308 oldNotationDeclHandler = parser->m_notationDeclHandler;
1309 oldStartNamespaceDeclHandler = parser->m_startNamespaceDeclHandler;
1310 oldEndNamespaceDeclHandler = parser->m_endNamespaceDeclHandler;
1311 oldNotStandaloneHandler = parser->m_notStandaloneHandler;
1312 oldExternalEntityRefHandler = parser->m_externalEntityRefHandler;
1313 oldSkippedEntityHandler = parser->m_skippedEntityHandler;
1314 oldUnknownEncodingHandler = parser->m_unknownEncodingHandler;
1315 oldElementDeclHandler = parser->m_elementDeclHandler;
1316 oldAttlistDeclHandler = parser->m_attlistDeclHandler;
1317 oldEntityDeclHandler = parser->m_entityDeclHandler;
1318 oldXmlDeclHandler = parser->m_xmlDeclHandler;
1319 oldDeclElementType = parser->m_declElementType;
1320
1321 oldUserData = parser->m_userData;
1322 oldHandlerArg = parser->m_handlerArg;
1323 oldDefaultExpandInternalEntities = parser->m_defaultExpandInternalEntities;
1324 oldExternalEntityRefHandlerArg = parser->m_externalEntityRefHandlerArg;
1325#ifdef XML_DTD
1326 oldParamEntityParsing = parser->m_paramEntityParsing;
1327 oldInEntityValue = parser->m_prologState.inEntityValue;
1328#endif
1329 oldns_triplets = parser->m_ns_triplets;
1330 /* Note that the new parser shares the same hash secret as the old
1331 parser, so that dtdCopy and copyEntityTable can lookup values
1332 from hash tables associated with either parser without us having
1333 to worry which hash secrets each table has.
1334 */
1335 oldhash_secret_salt = parser->m_hash_secret_salt;
1336
1337#ifdef XML_DTD
1338 if (! context)
1339 newDtd = oldDtd;
1340#endif /* XML_DTD */
1341
1342 /* Note that the magical uses of the pre-processor to make field
1343 access look more like C++ require that `parser' be overwritten
1344 here. This makes this function more painful to follow than it
1345 would be otherwise.
1346 */
1347 if (parser->m_ns) {
1348 XML_Char tmp[2] = {parser->m_namespaceSeparator, 0};
1349 parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
1350 } else {
1351 parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd);
1352 }
1353
1354 if (! parser)
1355 return NULL;
1356
1357 parser->m_startElementHandler = oldStartElementHandler;
1358 parser->m_endElementHandler = oldEndElementHandler;
1359 parser->m_characterDataHandler = oldCharacterDataHandler;
1360 parser->m_processingInstructionHandler = oldProcessingInstructionHandler;
1361 parser->m_commentHandler = oldCommentHandler;
1362 parser->m_startCdataSectionHandler = oldStartCdataSectionHandler;
1363 parser->m_endCdataSectionHandler = oldEndCdataSectionHandler;
1364 parser->m_defaultHandler = oldDefaultHandler;
1365 parser->m_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
1366 parser->m_notationDeclHandler = oldNotationDeclHandler;
1367 parser->m_startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
1368 parser->m_endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
1369 parser->m_notStandaloneHandler = oldNotStandaloneHandler;
1370 parser->m_externalEntityRefHandler = oldExternalEntityRefHandler;
1371 parser->m_skippedEntityHandler = oldSkippedEntityHandler;
1372 parser->m_unknownEncodingHandler = oldUnknownEncodingHandler;
1373 parser->m_elementDeclHandler = oldElementDeclHandler;
1374 parser->m_attlistDeclHandler = oldAttlistDeclHandler;
1375 parser->m_entityDeclHandler = oldEntityDeclHandler;
1376 parser->m_xmlDeclHandler = oldXmlDeclHandler;
1377 parser->m_declElementType = oldDeclElementType;
1378 parser->m_userData = oldUserData;
1379 if (oldUserData == oldHandlerArg)
1380 parser->m_handlerArg = parser->m_userData;
1381 else
1382 parser->m_handlerArg = parser;
1383 if (oldExternalEntityRefHandlerArg != oldParser)
1384 parser->m_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
1385 parser->m_defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
1386 parser->m_ns_triplets = oldns_triplets;
1387 parser->m_hash_secret_salt = oldhash_secret_salt;
1388 parser->m_parentParser = oldParser;
1389#ifdef XML_DTD
1390 parser->m_paramEntityParsing = oldParamEntityParsing;
1391 parser->m_prologState.inEntityValue = oldInEntityValue;
1392 if (context) {
1393#endif /* XML_DTD */
1394 if (! dtdCopy(oldParser, parser->m_dtd, oldDtd, &parser->m_mem)
1395 || ! setContext(parser, context)) {
1396 XML_ParserFree(parser);
1397 return NULL;
1398 }
1399 parser->m_processor = externalEntityInitProcessor;
1400#ifdef XML_DTD
1401 } else {
1402 /* The DTD instance referenced by parser->m_dtd is shared between the
1403 document's root parser and external PE parsers, therefore one does not
1404 need to call setContext. In addition, one also *must* not call
1405 setContext, because this would overwrite existing prefix->binding
1406 pointers in parser->m_dtd with ones that get destroyed with the external
1407 PE parser. This would leave those prefixes with dangling pointers.
1408 */
1409 parser->m_isParamEntity = XML_TRUE;
1411 parser->m_processor = externalParEntInitProcessor;
1412 }
1413#endif /* XML_DTD */
1414 return parser;
1415}
void(XMLCALL * XML_CommentHandler)(void *userData, const XML_Char *data)
Definition expat.h:304
void(XMLCALL * XML_EndElementHandler)(void *userData, const XML_Char *name)
Definition expat.h:291
void(XMLCALL * XML_EndNamespaceDeclHandler)(void *userData, const XML_Char *prefix)
Definition expat.h:401
void(XMLCALL * XML_SkippedEntityHandler)(void *userData, const XML_Char *entityName, int is_parameter_entity)
Definition expat.h:465
int(XMLCALL * XML_ExternalEntityRefHandler)(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId)
Definition expat.h:449
void(XMLCALL * XML_EndCdataSectionHandler)(void *userData)
Definition expat.h:307
int(XMLCALL * XML_UnknownEncodingHandler)(void *encodingHandlerData, const XML_Char *name, XML_Encoding *info)
Definition expat.h:543
void(XMLCALL * XML_StartElementHandler)(void *userData, const XML_Char *name, const XML_Char **atts)
Definition expat.h:287
void(XMLCALL * XML_ProcessingInstructionHandler)(void *userData, const XML_Char *target, const XML_Char *data)
Definition expat.h:299
void(XMLCALL * XML_StartNamespaceDeclHandler)(void *userData, const XML_Char *prefix, const XML_Char *uri)
Definition expat.h:397
unsigned char XML_Bool
Definition expat.h:54
void(XMLCALL * XML_XmlDeclHandler)(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
Definition expat.h:213
void(XMLCALL * XML_StartCdataSectionHandler)(void *userData)
Definition expat.h:306
void(XMLCALL * XML_UnparsedEntityDeclHandler)(void *userData, const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName)
Definition expat.h:376
XML_ParamEntityParsing
Definition expat.h:875
void(XMLCALL * XML_AttlistDeclHandler)(void *userData, const XML_Char *elname, const XML_Char *attname, const XML_Char *att_type, const XML_Char *dflt, int isrequired)
Definition expat.h:198
int(XMLCALL * XML_NotStandaloneHandler)(void *userData)
Definition expat.h:413
#define XML_TRUE
Definition expat.h:55
void(XMLCALL * XML_CharacterDataHandler)(void *userData, const XML_Char *s, int len)
Definition expat.h:295
void(XMLCALL * XML_EntityDeclHandler)(void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName)
Definition expat.h:358
void(XMLCALL * XML_NotationDeclHandler)(void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId)
Definition expat.h:385
void(XMLCALL * XML_DefaultHandler)(void *userData, const XML_Char *s, int len)
Definition expat.h:322
void(XMLCALL * XML_ElementDeclHandler)(void *userData, const XML_Char *name, XML_Content *model)
Definition expat.h:183
char XML_Char
XML_XmlDeclHandler m_xmlDeclHandler
Definition xmlparse.c:643
XML_Bool m_ns
Definition xmlparse.c:648
XML_CommentHandler m_commentHandler
Definition xmlparse.c:625
XML_ExternalEntityRefHandler m_externalEntityRefHandler
Definition xmlparse.c:636
XML_UnknownEncodingHandler m_unknownEncodingHandler
Definition xmlparse.c:639
XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler
Definition xmlparse.c:634
XML_StartElementHandler m_startElementHandler
Definition xmlparse.c:621
XML_Bool m_defaultExpandInternalEntities
Definition xmlparse.c:662
XML_SkippedEntityHandler m_skippedEntityHandler
Definition xmlparse.c:638
XML_EndElementHandler m_endElementHandler
Definition xmlparse.c:622
XML_EntityDeclHandler m_entityDeclHandler
Definition xmlparse.c:642
XML_Parser m_externalEntityRefHandlerArg
Definition xmlparse.c:637
const XML_Memory_Handling_Suite m_mem
Definition xmlparse.c:610
enum XML_ParamEntityParsing m_paramEntityParsing
Definition xmlparse.c:702
XML_AttlistDeclHandler m_attlistDeclHandler
Definition xmlparse.c:641
void * m_userData
Definition xmlparse.c:607
XML_Parser m_parentParser
Definition xmlparse.c:697
ELEMENT_TYPE * m_declElementType
Definition xmlparse.c:671
unsigned long m_hash_secret_salt
Definition xmlparse.c:704
XML_Bool m_ns_triplets
Definition xmlparse.c:649
XML_EndCdataSectionHandler m_endCdataSectionHandler
Definition xmlparse.c:627
XML_NotationDeclHandler m_notationDeclHandler
Definition xmlparse.c:632
XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler
Definition xmlparse.c:631
XML_ElementDeclHandler m_elementDeclHandler
Definition xmlparse.c:640
Processor * m_processor
Definition xmlparse.c:655
XML_Bool m_isParamEntity
Definition xmlparse.c:700
XML_Char m_namespaceSeparator
Definition xmlparse.c:696
XML_NotStandaloneHandler m_notStandaloneHandler
Definition xmlparse.c:635
XML_ProcessingInstructionHandler m_processingInstructionHandler
Definition xmlparse.c:624
XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler
Definition xmlparse.c:633
XML_CharacterDataHandler m_characterDataHandler
Definition xmlparse.c:623
PROLOG_STATE m_prologState
Definition xmlparse.c:654
XML_StartCdataSectionHandler m_startCdataSectionHandler
Definition xmlparse.c:626
void * m_handlerArg
Definition xmlparse.c:608
void XMLCALL XML_ParserFree(XML_Parser parser)
Definition xmlparse.c:1430
void XmlPrologStateInitExternalEntity(PROLOG_STATE *state)
Definition xmlrole.c:1249

◆ XML_FreeContentModel()

void XMLCALL XML_FreeContentModel ( XML_Parser parser,
XML_Content * model )

Definition at line 2309 of file xmlparse.c.

2309 {
2310 if (parser != NULL)
2311 FREE(parser, model);
2312}
#define FREE(parser, p)
Definition xmlparse.c:713

◆ XML_GetBase()

const XML_Char *XMLCALL XML_GetBase ( XML_Parser parser)

Definition at line 1554 of file xmlparse.c.

1554 {
1555 if (parser == NULL)
1556 return NULL;
1557 return parser->m_curBase;
1558}
const XML_Char * m_curBase
Definition xmlparse.c:676

◆ XML_GetBuffer()

void *XMLCALL XML_GetBuffer ( XML_Parser parser,
int len )

Definition at line 2038 of file xmlparse.c.

2038 {
2039 if (parser == NULL)
2040 return NULL;
2041 if (len < 0) {
2043 return NULL;
2044 }
2045 switch (parser->m_parsingStatus.parsing) {
2046 case XML_SUSPENDED:
2048 return NULL;
2049 case XML_FINISHED:
2051 return NULL;
2052 default:;
2053 }
2054
2055 if (len > EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_bufferEnd)) {
2056#ifdef XML_CONTEXT_BYTES
2057 int keep;
2058#endif /* defined XML_CONTEXT_BYTES */
2059 /* Do not invoke signed arithmetic overflow: */
2060 int neededSize = (int)((unsigned)len
2061 + (unsigned)EXPAT_SAFE_PTR_DIFF(
2062 parser->m_bufferEnd, parser->m_bufferPtr));
2063 if (neededSize < 0) {
2065 return NULL;
2066 }
2067#ifdef XML_CONTEXT_BYTES
2068 keep = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer);
2069 if (keep > XML_CONTEXT_BYTES)
2070 keep = XML_CONTEXT_BYTES;
2071 /* Detect and prevent integer overflow */
2072 if (keep > INT_MAX - neededSize) {
2074 return NULL;
2075 }
2076 neededSize += keep;
2077#endif /* defined XML_CONTEXT_BYTES */
2078 if (neededSize
2079 <= EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_buffer)) {
2080#ifdef XML_CONTEXT_BYTES
2081 if (keep < EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer)) {
2082 int offset
2083 = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer)
2084 - keep;
2085 /* The buffer pointers cannot be NULL here; we have at least some bytes
2086 * in the buffer */
2087 memmove(parser->m_buffer, &parser->m_buffer[offset],
2088 parser->m_bufferEnd - parser->m_bufferPtr + keep);
2089 parser->m_bufferEnd -= offset;
2090 parser->m_bufferPtr -= offset;
2091 }
2092#else
2093 if (parser->m_buffer && parser->m_bufferPtr) {
2094 memmove(parser->m_buffer, parser->m_bufferPtr,
2095 EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr));
2096 parser->m_bufferEnd
2097 = parser->m_buffer
2098 + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr);
2099 parser->m_bufferPtr = parser->m_buffer;
2100 }
2101#endif /* not defined XML_CONTEXT_BYTES */
2102 } else {
2103 char *newBuf;
2104 int bufferSize
2105 = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_bufferPtr);
2106 if (bufferSize == 0)
2107 bufferSize = INIT_BUFFER_SIZE;
2108 do {
2109 /* Do not invoke signed arithmetic overflow: */
2110 bufferSize = (int)(2U * (unsigned)bufferSize);
2111 } while (bufferSize < neededSize && bufferSize > 0);
2112 if (bufferSize <= 0) {
2114 return NULL;
2115 }
2116 newBuf = (char *)MALLOC(parser, bufferSize);
2117 if (newBuf == 0) {
2119 return NULL;
2120 }
2121 parser->m_bufferLim = newBuf + bufferSize;
2122#ifdef XML_CONTEXT_BYTES
2123 if (parser->m_bufferPtr) {
2124 memcpy(newBuf, &parser->m_bufferPtr[-keep],
2126 + keep);
2127 FREE(parser, parser->m_buffer);
2128 parser->m_buffer = newBuf;
2129 parser->m_bufferEnd
2130 = parser->m_buffer
2131 + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr)
2132 + keep;
2133 parser->m_bufferPtr = parser->m_buffer + keep;
2134 } else {
2135 /* This must be a brand new buffer with no data in it yet */
2136 parser->m_bufferEnd = newBuf;
2137 parser->m_bufferPtr = parser->m_buffer = newBuf;
2138 }
2139#else
2140 if (parser->m_bufferPtr) {
2141 memcpy(newBuf, parser->m_bufferPtr,
2142 EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr));
2143 FREE(parser, parser->m_buffer);
2144 parser->m_bufferEnd
2145 = newBuf
2146 + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr);
2147 } else {
2148 /* This must be a brand new buffer with no data in it yet */
2149 parser->m_bufferEnd = newBuf;
2150 }
2151 parser->m_bufferPtr = parser->m_buffer = newBuf;
2152#endif /* not defined XML_CONTEXT_BYTES */
2153 }
2154 parser->m_eventPtr = parser->m_eventEndPtr = NULL;
2155 parser->m_positionPtr = NULL;
2156 }
2157 return parser->m_bufferEnd;
2158}
@ XML_SUSPENDED
Definition expat.h:840
@ XML_FINISHED
Definition expat.h:840
#define XML_CONTEXT_BYTES
char * m_bufferEnd
Definition xmlparse.c:614
enum XML_Error m_errorCode
Definition xmlparse.c:656
const char * m_bufferLim
Definition xmlparse.c:616
XML_ParsingStatus m_parsingStatus
Definition xmlparse.c:698
const char * m_bufferPtr
Definition xmlparse.c:612
const char * m_positionPtr
Definition xmlparse.c:659
enum XML_Parsing parsing
Definition expat.h:843
#define INT_MAX
Definition templates.hh:90
#define INIT_BUFFER_SIZE
Definition xmlparse.c:243
#define MALLOC(parser, s)
Definition xmlparse.c:711
#define EXPAT_SAFE_PTR_DIFF(p, q)
Definition xmlparse.c:196

Referenced by XML_Parse().

◆ XML_GetCurrentByteCount()

int XMLCALL XML_GetCurrentByteCount ( XML_Parser parser)

Definition at line 2256 of file xmlparse.c.

2256 {
2257 if (parser == NULL)
2258 return 0;
2259 if (parser->m_eventEndPtr && parser->m_eventPtr)
2260 return (int)(parser->m_eventEndPtr - parser->m_eventPtr);
2261 return 0;
2262}

◆ XML_GetCurrentByteIndex()

XML_Index XMLCALL XML_GetCurrentByteIndex ( XML_Parser parser)

Definition at line 2246 of file xmlparse.c.

2246 {
2247 if (parser == NULL)
2248 return -1;
2249 if (parser->m_eventPtr)
2250 return (XML_Index)(parser->m_parseEndByteIndex
2251 - (parser->m_parseEndPtr - parser->m_eventPtr));
2252 return -1;
2253}
long XML_Index
XML_Index m_parseEndByteIndex
Definition xmlparse.c:617
const char * m_parseEndPtr
Definition xmlparse.c:618

◆ XML_GetCurrentColumnNumber()

XML_Size XMLCALL XML_GetCurrentColumnNumber ( XML_Parser parser)

Definition at line 2297 of file xmlparse.c.

2297 {
2298 if (parser == NULL)
2299 return 0;
2300 if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) {
2302 parser->m_eventPtr, &parser->m_position);
2303 parser->m_positionPtr = parser->m_eventPtr;
2304 }
2305 return parser->m_position.columnNumber;
2306}
POSITION m_position
Definition xmlparse.c:691
XML_Size columnNumber
Definition xmltok.h:147
#define XmlUpdatePosition(enc, ptr, end, pos)
Definition xmltok.h:267

◆ XML_GetCurrentLineNumber()

XML_Size XMLCALL XML_GetCurrentLineNumber ( XML_Parser parser)

Definition at line 2285 of file xmlparse.c.

2285 {
2286 if (parser == NULL)
2287 return 0;
2288 if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) {
2290 parser->m_eventPtr, &parser->m_position);
2291 parser->m_positionPtr = parser->m_eventPtr;
2292 }
2293 return parser->m_position.lineNumber + 1;
2294}
XML_Size lineNumber
Definition xmltok.h:146

◆ XML_GetErrorCode()

enum XML_Error XMLCALL XML_GetErrorCode ( XML_Parser parser)

Definition at line 2239 of file xmlparse.c.

2239 {
2240 if (parser == NULL)
2242 return parser->m_errorCode;
2243}

◆ XML_GetFeatureList()

const XML_Feature *XMLCALL XML_GetFeatureList ( void )

Definition at line 2485 of file xmlparse.c.

2485 {
2486 static const XML_Feature features[] = {
2487 {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
2488 sizeof(XML_Char)},
2489 {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"),
2490 sizeof(XML_LChar)},
2491#ifdef XML_UNICODE
2492 {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0},
2493#endif
2494#ifdef XML_UNICODE_WCHAR_T
2495 {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0},
2496#endif
2497#ifdef XML_DTD
2498 {XML_FEATURE_DTD, XML_L("XML_DTD"), 0},
2499#endif
2500#ifdef XML_CONTEXT_BYTES
2501 {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
2503#endif
2504#ifdef XML_MIN_SIZE
2505 {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0},
2506#endif
2507#ifdef XML_NS
2508 {XML_FEATURE_NS, XML_L("XML_NS"), 0},
2509#endif
2510#ifdef XML_LARGE_SIZE
2511 {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0},
2512#endif
2513#ifdef XML_ATTR_INFO
2514 {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0},
2515#endif
2516#ifdef XML_DTD
2517 /* Added in Expat 2.4.0. */
2519 XML_L("XML_BLAP_MAX_AMP"),
2520 (long int)
2523 XML_L("XML_BLAP_ACT_THRES"),
2525#endif
2526 {XML_FEATURE_END, NULL, 0}};
2527
2528 return features;
2529}
@ XML_FEATURE_DTD
Definition expat.h:1018
@ XML_FEATURE_SIZEOF_XML_LCHAR
Definition expat.h:1022
@ XML_FEATURE_NS
Definition expat.h:1023
@ XML_FEATURE_UNICODE
Definition expat.h:1016
@ XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT
Definition expat.h:1027
@ XML_FEATURE_SIZEOF_XML_CHAR
Definition expat.h:1021
@ XML_FEATURE_MIN_SIZE
Definition expat.h:1020
@ XML_FEATURE_END
Definition expat.h:1015
@ XML_FEATURE_UNICODE_WCHAR_T
Definition expat.h:1017
@ XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT
Definition expat.h:1028
@ XML_FEATURE_CONTEXT_BYTES
Definition expat.h:1019
@ XML_FEATURE_LARGE_SIZE
Definition expat.h:1024
@ XML_FEATURE_ATTR_INFO
Definition expat.h:1025
char XML_LChar
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT
Definition internal.h:142
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT
Definition internal.h:144
#define XML_Char

◆ XML_GetIdAttributeIndex()

int XMLCALL XML_GetIdAttributeIndex ( XML_Parser parser)

Definition at line 1568 of file xmlparse.c.

1568 {
1569 if (parser == NULL)
1570 return -1;
1571 return parser->m_idAttIndex;
1572}

◆ XML_GetInputContext()

const char *XMLCALL XML_GetInputContext ( XML_Parser parser,
int * offset,
int * size )

Definition at line 2265 of file xmlparse.c.

2265 {
2266#ifdef XML_CONTEXT_BYTES
2267 if (parser == NULL)
2268 return NULL;
2269 if (parser->m_eventPtr && parser->m_buffer) {
2270 if (offset != NULL)
2271 *offset = (int)(parser->m_eventPtr - parser->m_buffer);
2272 if (size != NULL)
2273 *size = (int)(parser->m_bufferEnd - parser->m_buffer);
2274 return parser->m_buffer;
2275 }
2276#else
2277 (void)parser;
2278 (void)offset;
2279 (void)size;
2280#endif /* defined XML_CONTEXT_BYTES */
2281 return (const char *)0;
2282}

◆ XML_GetParsingStatus()

void XMLCALL XML_GetParsingStatus ( XML_Parser parser,
XML_ParsingStatus * status )

Definition at line 2231 of file xmlparse.c.

2231 {
2232 if (parser == NULL)
2233 return;
2234 assert(status != NULL);
2235 *status = parser->m_parsingStatus;
2236}

◆ XML_GetSpecifiedAttributeCount()

int XMLCALL XML_GetSpecifiedAttributeCount ( XML_Parser parser)

Definition at line 1561 of file xmlparse.c.

1561 {
1562 if (parser == NULL)
1563 return -1;
1564 return parser->m_nSpecifiedAtts;
1565}

◆ XML_MemFree()

void XMLCALL XML_MemFree ( XML_Parser parser,
void * ptr )

Definition at line 2329 of file xmlparse.c.

2329 {
2330 if (parser != NULL)
2331 FREE(parser, ptr);
2332}

◆ XML_MemMalloc()

void *XMLCALL XML_MemMalloc ( XML_Parser parser,
size_t size )

Definition at line 2315 of file xmlparse.c.

2315 {
2316 if (parser == NULL)
2317 return NULL;
2318 return MALLOC(parser, size);
2319}

◆ XML_MemRealloc()

void *XMLCALL XML_MemRealloc ( XML_Parser parser,
void * ptr,
size_t size )

Definition at line 2322 of file xmlparse.c.

2322 {
2323 if (parser == NULL)
2324 return NULL;
2325 return REALLOC(parser, ptr, size);
2326}
#define REALLOC(parser, p, s)
Definition xmlparse.c:712

◆ XML_Parse()

enum XML_Status XMLCALL XML_Parse ( XML_Parser parser,
const char * s,
int len,
int isFinal )

Definition at line 1819 of file xmlparse.c.

1819 {
1820 if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) {
1821 if (parser != NULL)
1823 return XML_STATUS_ERROR;
1824 }
1825 switch (parser->m_parsingStatus.parsing) {
1826 case XML_SUSPENDED:
1828 return XML_STATUS_ERROR;
1829 case XML_FINISHED:
1831 return XML_STATUS_ERROR;
1832 case XML_INITIALIZED:
1833 if (parser->m_parentParser == NULL && ! startParsing(parser)) {
1835 return XML_STATUS_ERROR;
1836 }
1837 /* fall through */
1838 default:
1840 }
1841
1842 if (len == 0) {
1843 parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal;
1844 if (! isFinal)
1845 return XML_STATUS_OK;
1846 parser->m_positionPtr = parser->m_bufferPtr;
1847 parser->m_parseEndPtr = parser->m_bufferEnd;
1848
1849 /* If data are left over from last buffer, and we now know that these
1850 data are the final chunk of input, then we have to check them again
1851 to detect errors based on that fact.
1852 */
1853 parser->m_errorCode
1854 = parser->m_processor(parser, parser->m_bufferPtr,
1855 parser->m_parseEndPtr, &parser->m_bufferPtr);
1856
1857 if (parser->m_errorCode == XML_ERROR_NONE) {
1858 switch (parser->m_parsingStatus.parsing) {
1859 case XML_SUSPENDED:
1860 /* It is hard to be certain, but it seems that this case
1861 * cannot occur. This code is cleaning up a previous parse
1862 * with no new data (since len == 0). Changing the parsing
1863 * state requires getting to execute a handler function, and
1864 * there doesn't seem to be an opportunity for that while in
1865 * this circumstance.
1866 *
1867 * Given the uncertainty, we retain the code but exclude it
1868 * from coverage tests.
1869 *
1870 * LCOV_EXCL_START
1871 */
1873 parser->m_bufferPtr, &parser->m_position);
1874 parser->m_positionPtr = parser->m_bufferPtr;
1875 return XML_STATUS_SUSPENDED;
1876 /* LCOV_EXCL_STOP */
1877 case XML_INITIALIZED:
1878 case XML_PARSING:
1880 /* fall through */
1881 default:
1882 return XML_STATUS_OK;
1883 }
1884 }
1885 parser->m_eventEndPtr = parser->m_eventPtr;
1886 parser->m_processor = errorProcessor;
1887 return XML_STATUS_ERROR;
1888 }
1889#ifndef XML_CONTEXT_BYTES
1890 else if (parser->m_bufferPtr == parser->m_bufferEnd) {
1891 const char *end;
1892 int nLeftOver;
1893 enum XML_Status result;
1894 /* Detect overflow (a+b > MAX <==> b > MAX-a) */
1895 if ((XML_Size)len > ((XML_Size)-1) / 2 - parser->m_parseEndByteIndex) {
1897 parser->m_eventPtr = parser->m_eventEndPtr = NULL;
1898 parser->m_processor = errorProcessor;
1899 return XML_STATUS_ERROR;
1900 }
1901 parser->m_parseEndByteIndex += len;
1902 parser->m_positionPtr = s;
1903 parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal;
1904
1905 parser->m_errorCode
1906 = parser->m_processor(parser, s, parser->m_parseEndPtr = s + len, &end);
1907
1908 if (parser->m_errorCode != XML_ERROR_NONE) {
1909 parser->m_eventEndPtr = parser->m_eventPtr;
1910 parser->m_processor = errorProcessor;
1911 return XML_STATUS_ERROR;
1912 } else {
1913 switch (parser->m_parsingStatus.parsing) {
1914 case XML_SUSPENDED:
1915 result = XML_STATUS_SUSPENDED;
1916 break;
1917 case XML_INITIALIZED:
1918 case XML_PARSING:
1919 if (isFinal) {
1921 return XML_STATUS_OK;
1922 }
1923 /* fall through */
1924 default:
1925 result = XML_STATUS_OK;
1926 }
1927 }
1928
1929 XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, end,
1930 &parser->m_position);
1931 nLeftOver = s + len - end;
1932 if (nLeftOver) {
1933 if (parser->m_buffer == NULL
1934 || nLeftOver > parser->m_bufferLim - parser->m_buffer) {
1935 /* avoid _signed_ integer overflow */
1936 char *temp = NULL;
1937 const int bytesToAllocate = (int)((unsigned)len * 2U);
1938 if (bytesToAllocate > 0) {
1939 temp = (char *)REALLOC(parser, parser->m_buffer, bytesToAllocate);
1940 }
1941 if (temp == NULL) {
1943 parser->m_eventPtr = parser->m_eventEndPtr = NULL;
1944 parser->m_processor = errorProcessor;
1945 return XML_STATUS_ERROR;
1946 }
1947 parser->m_buffer = temp;
1948 parser->m_bufferLim = parser->m_buffer + bytesToAllocate;
1949 }
1950 memcpy(parser->m_buffer, end, nLeftOver);
1951 }
1952 parser->m_bufferPtr = parser->m_buffer;
1953 parser->m_bufferEnd = parser->m_buffer + nLeftOver;
1954 parser->m_positionPtr = parser->m_bufferPtr;
1955 parser->m_parseEndPtr = parser->m_bufferEnd;
1956 parser->m_eventPtr = parser->m_bufferPtr;
1957 parser->m_eventEndPtr = parser->m_bufferPtr;
1958 return result;
1959 }
1960#endif /* not defined XML_CONTEXT_BYTES */
1961 else {
1962 void *buff = XML_GetBuffer(parser, len);
1963 if (buff == NULL)
1964 return XML_STATUS_ERROR;
1965 else {
1966 memcpy(buff, s, len);
1967 return XML_ParseBuffer(parser, len, isFinal);
1968 }
1969 }
1970}
@ XML_PARSING
Definition expat.h:840
@ XML_INITIALIZED
Definition expat.h:840
#define XML_STATUS_ERROR
Definition expat.h:73
#define XML_STATUS_SUSPENDED
#define XML_STATUS_OK
Definition expat.h:75
XML_Status
Definition expat.h:71
unsigned long XML_Size
XML_Bool finalBuffer
Definition expat.h:844
void *XMLCALL XML_GetBuffer(XML_Parser parser, int len)
Definition xmlparse.c:2038
enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
Definition xmlparse.c:1973

◆ XML_ParseBuffer()

enum XML_Status XMLCALL XML_ParseBuffer ( XML_Parser parser,
int len,
int isFinal )

Definition at line 1973 of file xmlparse.c.

1973 {
1974 const char *start;
1975 enum XML_Status result = XML_STATUS_OK;
1976
1977 if (parser == NULL)
1978 return XML_STATUS_ERROR;
1979 switch (parser->m_parsingStatus.parsing) {
1980 case XML_SUSPENDED:
1982 return XML_STATUS_ERROR;
1983 case XML_FINISHED:
1985 return XML_STATUS_ERROR;
1986 case XML_INITIALIZED:
1987 /* Has someone called XML_GetBuffer successfully before? */
1988 if (! parser->m_bufferPtr) {
1990 return XML_STATUS_ERROR;
1991 }
1992
1993 if (parser->m_parentParser == NULL && ! startParsing(parser)) {
1995 return XML_STATUS_ERROR;
1996 }
1997 /* fall through */
1998 default:
2000 }
2001
2002 start = parser->m_bufferPtr;
2003 parser->m_positionPtr = start;
2004 parser->m_bufferEnd += len;
2005 parser->m_parseEndPtr = parser->m_bufferEnd;
2006 parser->m_parseEndByteIndex += len;
2007 parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal;
2008
2009 parser->m_errorCode = parser->m_processor(
2010 parser, start, parser->m_parseEndPtr, &parser->m_bufferPtr);
2011
2012 if (parser->m_errorCode != XML_ERROR_NONE) {
2013 parser->m_eventEndPtr = parser->m_eventPtr;
2014 parser->m_processor = errorProcessor;
2015 return XML_STATUS_ERROR;
2016 } else {
2017 switch (parser->m_parsingStatus.parsing) {
2018 case XML_SUSPENDED:
2019 result = XML_STATUS_SUSPENDED;
2020 break;
2021 case XML_INITIALIZED:
2022 case XML_PARSING:
2023 if (isFinal) {
2025 return result;
2026 }
2027 default:; /* should not happen */
2028 }
2029 }
2030
2032 parser->m_bufferPtr, &parser->m_position);
2033 parser->m_positionPtr = parser->m_bufferPtr;
2034 return result;
2035}

Referenced by XML_Parse().

◆ XML_ParserCreate()

XML_Parser XMLCALL XML_ParserCreate ( const XML_Char * encodingName)

Definition at line 716 of file xmlparse.c.

716 {
717 return XML_ParserCreate_MM(encodingName, NULL, NULL);
718}
XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep)
Definition xmlparse.c:965

◆ XML_ParserCreate_MM()

XML_Parser XMLCALL XML_ParserCreate_MM ( const XML_Char * encodingName,
const XML_Memory_Handling_Suite * memsuite,
const XML_Char * nameSep )

Definition at line 965 of file xmlparse.c.

967 {
968 return parserCreate(encodingName, memsuite, nameSep, NULL);
969}

Referenced by XML_ParserCreate(), and XML_ParserCreateNS().

◆ XML_ParserCreateNS()

XML_Parser XMLCALL XML_ParserCreateNS ( const XML_Char * encodingName,
XML_Char nsSep )

Definition at line 721 of file xmlparse.c.

721 {
722 XML_Char tmp[2] = {nsSep, 0};
723 return XML_ParserCreate_MM(encodingName, NULL, tmp);
724}

◆ XML_ParserFree()

void XMLCALL XML_ParserFree ( XML_Parser parser)

Definition at line 1430 of file xmlparse.c.

1430 {
1431 TAG *tagList;
1432 OPEN_INTERNAL_ENTITY *entityList;
1433 if (parser == NULL)
1434 return;
1435 /* free m_tagStack and m_freeTagList */
1436 tagList = parser->m_tagStack;
1437 for (;;) {
1438 TAG *p;
1439 if (tagList == NULL) {
1440 if (parser->m_freeTagList == NULL)
1441 break;
1442 tagList = parser->m_freeTagList;
1443 parser->m_freeTagList = NULL;
1444 }
1445 p = tagList;
1446 tagList = tagList->parent;
1447 FREE(parser, p->buf);
1448 destroyBindings(p->bindings, parser);
1449 FREE(parser, p);
1450 }
1451 /* free m_openInternalEntities and m_freeInternalEntities */
1452 entityList = parser->m_openInternalEntities;
1453 for (;;) {
1454 OPEN_INTERNAL_ENTITY *openEntity;
1455 if (entityList == NULL) {
1456 if (parser->m_freeInternalEntities == NULL)
1457 break;
1458 entityList = parser->m_freeInternalEntities;
1459 parser->m_freeInternalEntities = NULL;
1460 }
1461 openEntity = entityList;
1462 entityList = entityList->next;
1463 FREE(parser, openEntity);
1464 }
1465
1466 destroyBindings(parser->m_freeBindingList, parser);
1467 destroyBindings(parser->m_inheritedBindings, parser);
1468 poolDestroy(&parser->m_tempPool);
1469 poolDestroy(&parser->m_temp2Pool);
1470 FREE(parser, (void *)parser->m_protocolEncodingName);
1471#ifdef XML_DTD
1472 /* external parameter entity parsers share the DTD structure
1473 parser->m_dtd with the root parser, so we must not destroy it
1474 */
1475 if (! parser->m_isParamEntity && parser->m_dtd)
1476#else
1477 if (parser->m_dtd)
1478#endif /* XML_DTD */
1479 dtdDestroy(parser->m_dtd, (XML_Bool)! parser->m_parentParser,
1480 &parser->m_mem);
1481 FREE(parser, (void *)parser->m_atts);
1482#ifdef XML_ATTR_INFO
1483 FREE(parser, (void *)parser->m_attInfo);
1484#endif
1485 FREE(parser, parser->m_groupConnector);
1486 FREE(parser, parser->m_buffer);
1487 FREE(parser, parser->m_dataBuf);
1488 FREE(parser, parser->m_nsAtts);
1489 FREE(parser, parser->m_unknownEncodingMem);
1490 if (parser->m_unknownEncodingRelease)
1491 parser->m_unknownEncodingRelease(parser->m_unknownEncodingData);
1492 FREE(parser, parser);
1493}
XML_Char * m_dataBuf
Definition xmlparse.c:619
STRING_POOL m_temp2Pool
Definition xmlparse.c:693
char * m_groupConnector
Definition xmlparse.c:694
void * m_unknownEncodingMem
Definition xmlparse.c:650
NS_ATT * m_nsAtts
Definition xmlparse.c:685
void * m_unknownEncodingData
Definition xmlparse.c:651
STRING_POOL m_tempPool
Definition xmlparse.c:692
const XML_Char * m_protocolEncodingName
Definition xmlparse.c:647
OPEN_INTERNAL_ENTITY * m_freeInternalEntities
Definition xmlparse.c:661
BINDING * m_inheritedBindings
Definition xmlparse.c:679
TAG * m_freeTagList
Definition xmlparse.c:678
BINDING * m_freeBindingList
Definition xmlparse.c:680
ATTRIBUTE * m_atts
Definition xmlparse.c:684
struct open_internal_entity * next
Definition xmlparse.c:397
struct tag * parent
Definition xmlparse.c:285
BINDING * bindings
Definition xmlparse.c:291
char * buf
Definition xmlparse.c:289

Referenced by XML_ExternalEntityParserCreate().

◆ XML_ParserReset()

XML_Bool XMLCALL XML_ParserReset ( XML_Parser parser,
const XML_Char * encodingName )

Definition at line 1182 of file xmlparse.c.

1182 {
1183 TAG *tStk;
1184 OPEN_INTERNAL_ENTITY *openEntityList;
1185
1186 if (parser == NULL)
1187 return XML_FALSE;
1188
1189 if (parser->m_parentParser)
1190 return XML_FALSE;
1191 /* move m_tagStack to m_freeTagList */
1192 tStk = parser->m_tagStack;
1193 while (tStk) {
1194 TAG *tag = tStk;
1195 tStk = tStk->parent;
1196 tag->parent = parser->m_freeTagList;
1197 moveToFreeBindingList(parser, tag->bindings);
1198 tag->bindings = NULL;
1199 parser->m_freeTagList = tag;
1200 }
1201 /* move m_openInternalEntities to m_freeInternalEntities */
1202 openEntityList = parser->m_openInternalEntities;
1203 while (openEntityList) {
1204 OPEN_INTERNAL_ENTITY *openEntity = openEntityList;
1205 openEntityList = openEntity->next;
1206 openEntity->next = parser->m_freeInternalEntities;
1207 parser->m_freeInternalEntities = openEntity;
1208 }
1209 moveToFreeBindingList(parser, parser->m_inheritedBindings);
1210 FREE(parser, parser->m_unknownEncodingMem);
1211 if (parser->m_unknownEncodingRelease)
1212 parser->m_unknownEncodingRelease(parser->m_unknownEncodingData);
1213 poolClear(&parser->m_tempPool);
1214 poolClear(&parser->m_temp2Pool);
1215 FREE(parser, (void *)parser->m_protocolEncodingName);
1216 parser->m_protocolEncodingName = NULL;
1217 parserInit(parser, encodingName);
1218 dtdReset(parser->m_dtd, &parser->m_mem);
1219 return XML_TRUE;
1220}
#define XML_FALSE
Definition expat.h:56

◆ XML_ResumeParser()

enum XML_Status XMLCALL XML_ResumeParser ( XML_Parser parser)

Definition at line 2191 of file xmlparse.c.

2191 {
2192 enum XML_Status result = XML_STATUS_OK;
2193
2194 if (parser == NULL)
2195 return XML_STATUS_ERROR;
2196 if (parser->m_parsingStatus.parsing != XML_SUSPENDED) {
2198 return XML_STATUS_ERROR;
2199 }
2201
2202 parser->m_errorCode = parser->m_processor(
2203 parser, parser->m_bufferPtr, parser->m_parseEndPtr, &parser->m_bufferPtr);
2204
2205 if (parser->m_errorCode != XML_ERROR_NONE) {
2206 parser->m_eventEndPtr = parser->m_eventPtr;
2207 parser->m_processor = errorProcessor;
2208 return XML_STATUS_ERROR;
2209 } else {
2210 switch (parser->m_parsingStatus.parsing) {
2211 case XML_SUSPENDED:
2212 result = XML_STATUS_SUSPENDED;
2213 break;
2214 case XML_INITIALIZED:
2215 case XML_PARSING:
2216 if (parser->m_parsingStatus.finalBuffer) {
2218 return result;
2219 }
2220 default:;
2221 }
2222 }
2223
2225 parser->m_bufferPtr, &parser->m_position);
2226 parser->m_positionPtr = parser->m_bufferPtr;
2227 return result;
2228}

◆ XML_SetAttlistDeclHandler()

void XMLCALL XML_SetAttlistDeclHandler ( XML_Parser parser,
XML_AttlistDeclHandler attdecl )

Definition at line 1770 of file xmlparse.c.

1770 {
1771 if (parser != NULL)
1772 parser->m_attlistDeclHandler = attdecl;
1773}

◆ XML_SetBase()

enum XML_Status XMLCALL XML_SetBase ( XML_Parser parser,
const XML_Char * p )

Definition at line 1540 of file xmlparse.c.

1540 {
1541 if (parser == NULL)
1542 return XML_STATUS_ERROR;
1543 if (p) {
1544 p = poolCopyString(&parser->m_dtd->pool, p);
1545 if (! p)
1546 return XML_STATUS_ERROR;
1547 parser->m_curBase = p;
1548 } else
1549 parser->m_curBase = NULL;
1550 return XML_STATUS_OK;
1551}
STRING_POOL pool
Definition xmlparse.c:370

◆ XML_SetBillionLaughsAttackProtectionActivationThreshold()

XML_Bool XMLCALL XML_SetBillionLaughsAttackProtectionActivationThreshold ( XML_Parser parser,
unsigned long long activationThresholdBytes )

Definition at line 2545 of file xmlparse.c.

2546 {
2547 if ((parser == NULL) || (parser->m_parentParser != NULL)) {
2548 return XML_FALSE;
2549 }
2550 parser->m_accounting.activationThresholdBytes = activationThresholdBytes;
2551 return XML_TRUE;
2552}
unsigned long long activationThresholdBytes
Definition xmlparse.c:417

◆ XML_SetBillionLaughsAttackProtectionMaximumAmplification()

XML_Bool XMLCALL XML_SetBillionLaughsAttackProtectionMaximumAmplification ( XML_Parser parser,
float maximumAmplificationFactor )

Definition at line 2533 of file xmlparse.c.

2534 {
2535 if ((parser == NULL) || (parser->m_parentParser != NULL)
2536 || isnan(maximumAmplificationFactor)
2537 || (maximumAmplificationFactor < 1.0f)) {
2538 return XML_FALSE;
2539 }
2540 parser->m_accounting.maximumAmplificationFactor = maximumAmplificationFactor;
2541 return XML_TRUE;
2542}
float maximumAmplificationFactor
Definition xmlparse.c:416

◆ XML_SetCdataSectionHandler()

void XMLCALL XML_SetCdataSectionHandler ( XML_Parser parser,
XML_StartCdataSectionHandler start,
XML_EndCdataSectionHandler end )

Definition at line 1625 of file xmlparse.c.

1627 {
1628 if (parser == NULL)
1629 return;
1630 parser->m_startCdataSectionHandler = start;
1631 parser->m_endCdataSectionHandler = end;
1632}

◆ XML_SetCharacterDataHandler()

void XMLCALL XML_SetCharacterDataHandler ( XML_Parser parser,
XML_CharacterDataHandler handler )

Definition at line 1605 of file xmlparse.c.

1606 {
1607 if (parser != NULL)
1608 parser->m_characterDataHandler = handler;
1609}

◆ XML_SetCommentHandler()

void XMLCALL XML_SetCommentHandler ( XML_Parser parser,
XML_CommentHandler handler )

Definition at line 1619 of file xmlparse.c.

1619 {
1620 if (parser != NULL)
1621 parser->m_commentHandler = handler;
1622}

◆ XML_SetDefaultHandler()

void XMLCALL XML_SetDefaultHandler ( XML_Parser parser,
XML_DefaultHandler handler )

Definition at line 1649 of file xmlparse.c.

1649 {
1650 if (parser == NULL)
1651 return;
1652 parser->m_defaultHandler = handler;
1654}

◆ XML_SetDefaultHandlerExpand()

void XMLCALL XML_SetDefaultHandlerExpand ( XML_Parser parser,
XML_DefaultHandler handler )

Definition at line 1657 of file xmlparse.c.

1657 {
1658 if (parser == NULL)
1659 return;
1660 parser->m_defaultHandler = handler;
1662}

◆ XML_SetDoctypeDeclHandler()

void XMLCALL XML_SetDoctypeDeclHandler ( XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end )

Definition at line 1665 of file xmlparse.c.

1666 {
1667 if (parser == NULL)
1668 return;
1669 parser->m_startDoctypeDeclHandler = start;
1670 parser->m_endDoctypeDeclHandler = end;
1671}
XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler
Definition xmlparse.c:630
XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler
Definition xmlparse.c:629

◆ XML_SetElementDeclHandler()

void XMLCALL XML_SetElementDeclHandler ( XML_Parser parser,
XML_ElementDeclHandler eldecl )

Definition at line 1764 of file xmlparse.c.

1764 {
1765 if (parser != NULL)
1766 parser->m_elementDeclHandler = eldecl;
1767}

◆ XML_SetElementHandler()

void XMLCALL XML_SetElementHandler ( XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end )

Definition at line 1584 of file xmlparse.c.

1585 {
1586 if (parser == NULL)
1587 return;
1588 parser->m_startElementHandler = start;
1589 parser->m_endElementHandler = end;
1590}

◆ XML_SetEncoding()

enum XML_Status XMLCALL XML_SetEncoding ( XML_Parser parser,
const XML_Char * encodingName )

Definition at line 1223 of file xmlparse.c.

1223 {
1224 if (parser == NULL)
1225 return XML_STATUS_ERROR;
1226 /* Block after XML_Parse()/XML_ParseBuffer() has been called.
1227 XXX There's no way for the caller to determine which of the
1228 XXX possible error cases caused the XML_STATUS_ERROR return.
1229 */
1230 if (parser->m_parsingStatus.parsing == XML_PARSING
1232 return XML_STATUS_ERROR;
1233
1234 /* Get rid of any previous encoding name */
1235 FREE(parser, (void *)parser->m_protocolEncodingName);
1236
1237 if (encodingName == NULL)
1238 /* No new encoding name */
1239 parser->m_protocolEncodingName = NULL;
1240 else {
1241 /* Copy the new encoding name into allocated memory */
1242 parser->m_protocolEncodingName = copyString(encodingName, &(parser->m_mem));
1243 if (! parser->m_protocolEncodingName)
1244 return XML_STATUS_ERROR;
1245 }
1246 return XML_STATUS_OK;
1247}

◆ XML_SetEndCdataSectionHandler()

void XMLCALL XML_SetEndCdataSectionHandler ( XML_Parser parser,
XML_EndCdataSectionHandler end )

Definition at line 1642 of file xmlparse.c.

1643 {
1644 if (parser != NULL)
1645 parser->m_endCdataSectionHandler = end;
1646}

◆ XML_SetEndDoctypeDeclHandler()

void XMLCALL XML_SetEndDoctypeDeclHandler ( XML_Parser parser,
XML_EndDoctypeDeclHandler end )

Definition at line 1681 of file xmlparse.c.

1681 {
1682 if (parser != NULL)
1683 parser->m_endDoctypeDeclHandler = end;
1684}

◆ XML_SetEndElementHandler()

void XMLCALL XML_SetEndElementHandler ( XML_Parser parser,
XML_EndElementHandler end )

Definition at line 1599 of file xmlparse.c.

1599 {
1600 if (parser != NULL)
1601 parser->m_endElementHandler = end;
1602}

◆ XML_SetEndNamespaceDeclHandler()

void XMLCALL XML_SetEndNamespaceDeclHandler ( XML_Parser parser,
XML_EndNamespaceDeclHandler end )

Definition at line 1717 of file xmlparse.c.

1718 {
1719 if (parser != NULL)
1720 parser->m_endNamespaceDeclHandler = end;
1721}

◆ XML_SetEntityDeclHandler()

void XMLCALL XML_SetEntityDeclHandler ( XML_Parser parser,
XML_EntityDeclHandler handler )

Definition at line 1776 of file xmlparse.c.

1776 {
1777 if (parser != NULL)
1778 parser->m_entityDeclHandler = handler;
1779}

◆ XML_SetExternalEntityRefHandler()

void XMLCALL XML_SetExternalEntityRefHandler ( XML_Parser parser,
XML_ExternalEntityRefHandler handler )

Definition at line 1731 of file xmlparse.c.

1732 {
1733 if (parser != NULL)
1734 parser->m_externalEntityRefHandler = handler;
1735}

◆ XML_SetExternalEntityRefHandlerArg()

void XMLCALL XML_SetExternalEntityRefHandlerArg ( XML_Parser parser,
void * arg )

Definition at line 1738 of file xmlparse.c.

1738 {
1739 if (parser == NULL)
1740 return;
1741 if (arg)
1743 else
1744 parser->m_externalEntityRefHandlerArg = parser;
1745}
struct XML_ParserStruct * XML_Parser
Definition expat.h:52

◆ XML_SetHashSalt()

int XMLCALL XML_SetHashSalt ( XML_Parser parser,
unsigned long hash_salt )

Definition at line 1805 of file xmlparse.c.

1805 {
1806 if (parser == NULL)
1807 return 0;
1808 if (parser->m_parentParser)
1809 return XML_SetHashSalt(parser->m_parentParser, hash_salt);
1810 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1811 if (parser->m_parsingStatus.parsing == XML_PARSING
1813 return 0;
1814 parser->m_hash_secret_salt = hash_salt;
1815 return 1;
1816}
int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt)
Definition xmlparse.c:1805

Referenced by XML_SetHashSalt().

◆ XML_SetNamespaceDeclHandler()

void XMLCALL XML_SetNamespaceDeclHandler ( XML_Parser parser,
XML_StartNamespaceDeclHandler start,
XML_EndNamespaceDeclHandler end )

Definition at line 1700 of file xmlparse.c.

1702 {
1703 if (parser == NULL)
1704 return;
1705 parser->m_startNamespaceDeclHandler = start;
1706 parser->m_endNamespaceDeclHandler = end;
1707}

◆ XML_SetNotationDeclHandler()

void XMLCALL XML_SetNotationDeclHandler ( XML_Parser parser,
XML_NotationDeclHandler handler )

Definition at line 1694 of file xmlparse.c.

1694 {
1695 if (parser != NULL)
1696 parser->m_notationDeclHandler = handler;
1697}

◆ XML_SetNotStandaloneHandler()

void XMLCALL XML_SetNotStandaloneHandler ( XML_Parser parser,
XML_NotStandaloneHandler handler )

Definition at line 1724 of file xmlparse.c.

1725 {
1726 if (parser != NULL)
1727 parser->m_notStandaloneHandler = handler;
1728}

◆ XML_SetParamEntityParsing()

int XMLCALL XML_SetParamEntityParsing ( XML_Parser parser,
enum XML_ParamEntityParsing peParsing )

Definition at line 1788 of file xmlparse.c.

1789 {
1790 if (parser == NULL)
1791 return 0;
1792 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1793 if (parser->m_parsingStatus.parsing == XML_PARSING
1795 return 0;
1796#ifdef XML_DTD
1797 parser->m_paramEntityParsing = peParsing;
1798 return 1;
1799#else
1800 return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;
1801#endif
1802}
@ XML_PARAM_ENTITY_PARSING_NEVER
Definition expat.h:876

◆ XML_SetProcessingInstructionHandler()

void XMLCALL XML_SetProcessingInstructionHandler ( XML_Parser parser,
XML_ProcessingInstructionHandler handler )

Definition at line 1612 of file xmlparse.c.

1613 {
1614 if (parser != NULL)
1615 parser->m_processingInstructionHandler = handler;
1616}

◆ XML_SetReturnNSTriplet()

void XMLCALL XML_SetReturnNSTriplet ( XML_Parser parser,
int do_nst )

Definition at line 1519 of file xmlparse.c.

1519 {
1520 if (parser == NULL)
1521 return;
1522 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1523 if (parser->m_parsingStatus.parsing == XML_PARSING
1525 return;
1526 parser->m_ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
1527}

◆ XML_SetSkippedEntityHandler()

void XMLCALL XML_SetSkippedEntityHandler ( XML_Parser parser,
XML_SkippedEntityHandler handler )

Definition at line 1748 of file xmlparse.c.

1749 {
1750 if (parser != NULL)
1751 parser->m_skippedEntityHandler = handler;
1752}

◆ XML_SetStartCdataSectionHandler()

void XMLCALL XML_SetStartCdataSectionHandler ( XML_Parser parser,
XML_StartCdataSectionHandler start )

Definition at line 1635 of file xmlparse.c.

1636 {
1637 if (parser != NULL)
1638 parser->m_startCdataSectionHandler = start;
1639}

◆ XML_SetStartDoctypeDeclHandler()

void XMLCALL XML_SetStartDoctypeDeclHandler ( XML_Parser parser,
XML_StartDoctypeDeclHandler start )

Definition at line 1674 of file xmlparse.c.

1675 {
1676 if (parser != NULL)
1677 parser->m_startDoctypeDeclHandler = start;
1678}

◆ XML_SetStartElementHandler()

void XMLCALL XML_SetStartElementHandler ( XML_Parser parser,
XML_StartElementHandler start )

Definition at line 1593 of file xmlparse.c.

1593 {
1594 if (parser != NULL)
1595 parser->m_startElementHandler = start;
1596}

◆ XML_SetStartNamespaceDeclHandler()

void XMLCALL XML_SetStartNamespaceDeclHandler ( XML_Parser parser,
XML_StartNamespaceDeclHandler start )

Definition at line 1710 of file xmlparse.c.

1711 {
1712 if (parser != NULL)
1713 parser->m_startNamespaceDeclHandler = start;
1714}

◆ XML_SetUnknownEncodingHandler()

void XMLCALL XML_SetUnknownEncodingHandler ( XML_Parser parser,
XML_UnknownEncodingHandler handler,
void * data )

Definition at line 1755 of file xmlparse.c.

1756 {
1757 if (parser == NULL)
1758 return;
1759 parser->m_unknownEncodingHandler = handler;
1760 parser->m_unknownEncodingHandlerData = data;
1761}
void * m_unknownEncodingHandlerData
Definition xmlparse.c:652

◆ XML_SetUnparsedEntityDeclHandler()

void XMLCALL XML_SetUnparsedEntityDeclHandler ( XML_Parser parser,
XML_UnparsedEntityDeclHandler handler )

Definition at line 1687 of file xmlparse.c.

1688 {
1689 if (parser != NULL)
1690 parser->m_unparsedEntityDeclHandler = handler;
1691}

◆ XML_SetUserData()

void XMLCALL XML_SetUserData ( XML_Parser parser,
void * p )

Definition at line 1530 of file xmlparse.c.

1530 {
1531 if (parser == NULL)
1532 return;
1533 if (parser->m_handlerArg == parser->m_userData)
1534 parser->m_handlerArg = parser->m_userData = p;
1535 else
1536 parser->m_userData = p;
1537}

◆ XML_SetXmlDeclHandler()

void XMLCALL XML_SetXmlDeclHandler ( XML_Parser parser,
XML_XmlDeclHandler handler )

Definition at line 1782 of file xmlparse.c.

1782 {
1783 if (parser != NULL)
1784 parser->m_xmlDeclHandler = handler;
1785}

◆ XML_StopParser()

enum XML_Status XMLCALL XML_StopParser ( XML_Parser parser,
XML_Bool resumable )

Definition at line 2161 of file xmlparse.c.

2161 {
2162 if (parser == NULL)
2163 return XML_STATUS_ERROR;
2164 switch (parser->m_parsingStatus.parsing) {
2165 case XML_SUSPENDED:
2166 if (resumable) {
2168 return XML_STATUS_ERROR;
2169 }
2171 break;
2172 case XML_FINISHED:
2174 return XML_STATUS_ERROR;
2175 default:
2176 if (resumable) {
2177#ifdef XML_DTD
2178 if (parser->m_isParamEntity) {
2180 return XML_STATUS_ERROR;
2181 }
2182#endif
2184 } else
2186 }
2187 return XML_STATUS_OK;
2188}

◆ XML_UseForeignDTD()

enum XML_Error XMLCALL XML_UseForeignDTD ( XML_Parser parser,
XML_Bool useDTD )

Definition at line 1502 of file xmlparse.c.

1502 {
1503 if (parser == NULL)
1505#ifdef XML_DTD
1506 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1507 if (parser->m_parsingStatus.parsing == XML_PARSING
1510 parser->m_useForeignDTD = useDTD;
1511 return XML_ERROR_NONE;
1512#else
1513 UNUSED_P(useDTD);
1515#endif
1516}
#define UNUSED_P(p)
Definition internal.h:135
XML_Bool m_useForeignDTD
Definition xmlparse.c:701

◆ XML_UseParserAsHandlerArg()

void XMLCALL XML_UseParserAsHandlerArg ( XML_Parser parser)

Definition at line 1496 of file xmlparse.c.

1496 {
1497 if (parser != NULL)
1498 parser->m_handlerArg = parser;
1499}