Geant4-11
Data Structures | Macros | Typedefs | Functions | Variables
xmlparse.cc File Reference
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <time.h>
#include "ascii.h"
#include "expat.h"
#include "internal.h"
#include "xmltok.h"
#include "xmlrole.h"

Go to the source code of this file.

Data Structures

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

Macros

#define _dtd   (parser->m_dtd)
 
#define attInfo   (parser->m_attInfo)
 
#define attlistDeclHandler   (parser->m_attlistDeclHandler)
 
#define atts   (parser->m_atts)
 
#define attsSize   (parser->m_attsSize)
 
#define buffer   (parser->m_buffer)
 
#define bufferEnd   (parser->m_bufferEnd)
 
#define bufferLim   (parser->m_bufferLim)
 
#define bufferPtr   (parser->m_bufferPtr)
 
#define CHAR_HASH(h, c)    (((h) * 0xF4243) ^ (unsigned char)(c))
 
#define characterDataHandler   (parser->m_characterDataHandler)
 
#define commentHandler   (parser->m_commentHandler)
 
#define CONTEXT_SEP   XML_T(ASCII_FF)
 
#define curBase   (parser->m_curBase)
 
#define dataBuf   (parser->m_dataBuf)
 
#define dataBufEnd   (parser->m_dataBufEnd)
 
#define declAttributeId   (parser->m_declAttributeId)
 
#define declAttributeIsCdata   (parser->m_declAttributeIsCdata)
 
#define declAttributeIsId   (parser->m_declAttributeIsId)
 
#define declAttributeType   (parser->m_declAttributeType)
 
#define declElementType   (parser->m_declElementType)
 
#define declEntity   (parser->m_declEntity)
 
#define declNotationName   (parser->m_declNotationName)
 
#define declNotationPublicId   (parser->m_declNotationPublicId)
 
#define defaultExpandInternalEntities    (parser->m_defaultExpandInternalEntities)
 
#define defaultHandler   (parser->m_defaultHandler)
 
#define doctypeName   (parser->m_doctypeName)
 
#define doctypePubid   (parser->m_doctypePubid)
 
#define doctypeSysid   (parser->m_doctypeSysid)
 
#define elementDeclHandler   (parser->m_elementDeclHandler)
 
#define encoding   (parser->m_encoding)
 
#define endCdataSectionHandler   (parser->m_endCdataSectionHandler)
 
#define endDoctypeDeclHandler   (parser->m_endDoctypeDeclHandler)
 
#define endElementHandler   (parser->m_endElementHandler)
 
#define endNamespaceDeclHandler   (parser->m_endNamespaceDeclHandler)
 
#define entityDeclHandler   (parser->m_entityDeclHandler)
 
#define errorCode   (parser->m_errorCode)
 
#define eventEndPtr   (parser->m_eventEndPtr)
 
#define eventPtr   (parser->m_eventPtr)
 
#define EXPAND_SPARE   24
 
#define externalEntityRefHandler    (parser->m_externalEntityRefHandler)
 
#define externalEntityRefHandlerArg    (parser->m_externalEntityRefHandlerArg)
 
#define FREE(p)   (parser->m_mem.free_fcn((p)))
 
#define freeBindingList   (parser->m_freeBindingList)
 
#define freeInternalEntities   (parser->m_freeInternalEntities)
 
#define freeTagList   (parser->m_freeTagList)
 
#define groupConnector   (parser->m_groupConnector)
 
#define groupSize   (parser->m_groupSize)
 
#define handlerArg   (parser->m_handlerArg)
 
#define hash_secret_salt   (parser->m_hash_secret_salt)
 
#define idAttIndex   (parser->m_idAttIndex)
 
#define inheritedBindings   (parser->m_inheritedBindings)
 
#define INIT_ATTS_SIZE   16
 
#define INIT_ATTS_VERSION   0xFFFFFFFF
 
#define INIT_BLOCK_SIZE   1024
 
#define INIT_BUFFER_SIZE   1024
 
#define INIT_DATA_BUF_SIZE   1024
 
#define INIT_POWER   6
 
#define INIT_SCAFFOLD_ELEMENTS   32
 
#define INIT_TAG_BUF_SIZE   32 /* must be a multiple of sizeof(XML_Char) */
 
#define initEncoding   (parser->m_initEncoding)
 
#define internalEncoding   (parser->m_internalEncoding)
 
#define internalEntityRefHandler    (parser->m_internalEntityRefHandler)
 
#define MALLOC(s)   (parser->m_mem.malloc_fcn((s)))
 
#define MUST_CONVERT(enc, s)   (!(enc)->isUtf8)
 
#define namespaceSeparator   (parser->m_namespaceSeparator)
 
#define notationDeclHandler   (parser->m_notationDeclHandler)
 
#define notStandaloneHandler   (parser->m_notStandaloneHandler)
 
#define ns   (parser->m_ns)
 
#define ns_triplets   (parser->m_ns_triplets)
 
#define nsAtts   (parser->m_nsAtts)
 
#define nsAttsPower   (parser->m_nsAttsPower)
 
#define nsAttsVersion   (parser->m_nsAttsVersion)
 
#define nSpecifiedAtts   (parser->m_nSpecifiedAtts)
 
#define openInternalEntities   (parser->m_openInternalEntities)
 
#define parentParser   (parser->m_parentParser)
 
#define parseEndByteIndex   (parser->m_parseEndByteIndex)
 
#define parseEndPtr   (parser->m_parseEndPtr)
 
#define poolAppendChar(pool, c)
 
#define poolChop(pool)   ((void)--(pool->ptr))
 
#define poolDiscard(pool)   ((pool)->ptr = (pool)->start)
 
#define poolEnd(pool)   ((pool)->ptr)
 
#define poolFinish(pool)   ((pool)->start = (pool)->ptr)
 
#define poolLastChar(pool)   (((pool)->ptr)[-1])
 
#define poolLength(pool)   ((pool)->ptr - (pool)->start)
 
#define poolStart(pool)   ((pool)->start)
 
#define position   (parser->m_position)
 
#define positionPtr   (parser->m_positionPtr)
 
#define PROBE_STEP(hash, mask, power)    ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
 
#define processingInstructionHandler    (parser->m_processingInstructionHandler)
 
#define processor   (parser->m_processor)
 
#define prologState   (parser->m_prologState)
 
#define protocolEncodingName   (parser->m_protocolEncodingName)
 
#define ps_finalBuffer   (parser->m_parsingStatus.finalBuffer)
 
#define ps_parsing   (parser->m_parsingStatus.parsing)
 
#define REALLOC(p, s)   (parser->m_mem.realloc_fcn((p),(s)))
 
#define ROUND_UP(n, sz)   (((n) + ((sz) - 1)) & ~((sz) - 1))
 
#define SECOND_HASH(hash, mask, power)    ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2))
 
#define skippedEntityHandler   (parser->m_skippedEntityHandler)
 
#define startCdataSectionHandler    (parser->m_startCdataSectionHandler)
 
#define startDoctypeDeclHandler   (parser->m_startDoctypeDeclHandler)
 
#define startElementHandler   (parser->m_startElementHandler)
 
#define startNamespaceDeclHandler    (parser->m_startNamespaceDeclHandler)
 
#define tagLevel   (parser->m_tagLevel)
 
#define tagStack   (parser->m_tagStack)
 
#define temp2Pool   (parser->m_temp2Pool)
 
#define tempPool   (parser->m_tempPool)
 
#define unknownEncodingData   (parser->m_unknownEncodingData)
 
#define unknownEncodingHandler   (parser->m_unknownEncodingHandler)
 
#define unknownEncodingHandlerData    (parser->m_unknownEncodingHandlerData)
 
#define unknownEncodingMem   (parser->m_unknownEncodingMem)
 
#define unknownEncodingRelease   (parser->m_unknownEncodingRelease)
 
#define unparsedEntityDeclHandler    (parser->m_unparsedEntityDeclHandler)
 
#define userData   (parser->m_userData)
 
#define V1(a, b, c)   XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c)
 
#define V2(a, b, c)   XML_L("expat_")V1(a,b,c)
 
#define XML_BUILDING_EXPAT   1
 
#define XML_ENCODE_MAX   XML_UTF8_ENCODE_MAX
 
#define XML_L(x)   x
 
#define XML_T(x)   x
 
#define XmlConvert   XmlUtf8Convert
 
#define xmlDeclHandler   (parser->m_xmlDeclHandler)
 
#define XmlEncode   XmlUtf8Encode
 
#define XmlGetInternalEncoding   XmlGetUtf8InternalEncoding
 
#define XmlGetInternalEncodingNS   XmlGetUtf8InternalEncodingNS
 
#define XmlGetInternalEncodingNS   XmlGetInternalEncoding
 
#define XmlInitEncodingNS   XmlInitEncoding
 
#define XmlInitUnknownEncodingNS   XmlInitUnknownEncoding
 
#define XmlParseXmlDeclNS   XmlParseXmlDecl
 

Typedefs

typedef struct attribute_id ATTRIBUTE_ID
 
typedef struct binding BINDING
 
typedef struct block BLOCK
 
typedef char ICHAR
 
typedef const XML_CharKEY
 
typedef struct open_internal_entity OPEN_INTERNAL_ENTITY
 
typedef struct prefix PREFIX
 
typedef struct tag TAG
 

Functions

static enum XML_Error addBinding (XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr)
 
static enum XML_Error appendAttributeValue (XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *)
 
static XML_Contentbuild_model (XML_Parser parser)
 
static void build_node (XML_Parser parser, int src_node, XML_Content *dest, XML_Content **contpos, XML_Char **strpos)
 
static enum XML_Error PTRCALL cdataSectionProcessor (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static enum XML_Error PTRCALL contentProcessor (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static int copyEntityTable (XML_Parser oldParser, HASH_TABLE *, STRING_POOL *, const HASH_TABLE *)
 
static int defineAttribute (ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser)
 
static void FASTCALL destroyBindings (BINDING *bindings, XML_Parser parser)
 
static enum XML_Error doCdataSection (XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore)
 
static enum XML_Error doContent (XML_Parser parser, int startTagLevel, const ENCODING *enc, const char *start, const char *end, const char **endPtr, XML_Bool haveMore)
 
static enum XML_Error doProlog (XML_Parser parser, const ENCODING *enc, const char *s, const char *end, int tok, const char *next, const char **nextPtr, XML_Bool haveMore)
 
static int dtdCopy (XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
 
static DTDdtdCreate (const XML_Memory_Handling_Suite *ms)
 
static void dtdDestroy (DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms)
 
static void dtdReset (DTD *p, const XML_Memory_Handling_Suite *ms)
 
static enum XML_Error PTRCALL epilogProcessor (XML_Parser parser, const char *s, const char *end, const char **nextPtr)
 
static enum XML_Error PTRCALL errorProcessor (XML_Parser parser, const char *s, const char *end, const char **nextPtr)
 
static enum XML_Error PTRCALL externalEntityContentProcessor (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static enum XML_Error PTRCALL externalEntityInitProcessor (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static enum XML_Error PTRCALL externalEntityInitProcessor2 (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static enum XML_Error PTRCALL externalEntityInitProcessor3 (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static unsigned long generate_hash_secret_salt (void)
 
static ATTRIBUTE_IDgetAttributeId (XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
 
static const XML_ChargetContext (XML_Parser parser)
 
static ELEMENT_TYPEgetElementType (XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end)
 
static enum XML_Error handleUnknownEncoding (XML_Parser parser, const XML_Char *encodingName)
 
static unsigned long FASTCALL hash (XML_Parser parser, KEY s)
 
static void FASTCALL hashTableClear (HASH_TABLE *)
 
static void FASTCALL hashTableDestroy (HASH_TABLE *)
 
static void FASTCALL hashTableInit (HASH_TABLE *, const XML_Memory_Handling_Suite *ms)
 
static void FASTCALL hashTableIterInit (HASH_TABLE_ITER *, const HASH_TABLE *)
 
static NAMED *FASTCALL hashTableIterNext (HASH_TABLE_ITER *)
 
static enum XML_Error initializeEncoding (XML_Parser parser)
 
static enum XML_Error PTRCALL internalEntityProcessor (XML_Parser parser, const char *s, const char *end, const char **nextPtr)
 
static XML_Bool FASTCALL keyeq (KEY s1, KEY s2)
 
static NAMEDlookup (XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize)
 
static void FASTCALL moveToFreeBindingList (XML_Parser parser, BINDING *bindings)
 
static int FASTCALL nextScaffoldPart (XML_Parser parser)
 
static void FASTCALL normalizeLines (XML_Char *s)
 
static void FASTCALL normalizePublicId (XML_Char *s)
 
static XML_Parser parserCreate (const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, DTD *dtd)
 
static void parserInit (XML_Parser parser, const XML_Char *encodingName)
 
static XML_CharpoolAppend (STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end)
 
static const XML_Char *FASTCALL poolAppendString (STRING_POOL *pool, const XML_Char *s)
 
static void FASTCALL poolClear (STRING_POOL *)
 
static const XML_Char *FASTCALL poolCopyString (STRING_POOL *pool, const XML_Char *s)
 
static const XML_CharpoolCopyStringN (STRING_POOL *pool, const XML_Char *s, int n)
 
static void FASTCALL poolDestroy (STRING_POOL *)
 
static XML_Bool FASTCALL poolGrow (STRING_POOL *pool)
 
static void FASTCALL poolInit (STRING_POOL *, const XML_Memory_Handling_Suite *ms)
 
static XML_CharpoolStoreString (STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end)
 
static enum XML_Error processInternalEntity (XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl)
 
enum XML_Error PTRCALL Processor (XML_Parser parser, const char *start, const char *end, const char **endPtr)
 
static enum XML_Error processXmlDecl (XML_Parser parser, int isGeneralTextEntity, const char *s, const char *next)
 
static enum XML_Error PTRCALL prologInitProcessor (XML_Parser parser, const char *s, const char *end, const char **nextPtr)
 
static enum XML_Error PTRCALL prologProcessor (XML_Parser parser, const char *s, const char *end, const char **nextPtr)
 
static int reportComment (XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
 
static void reportDefault (XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
 
static int reportProcessingInstruction (XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
 
static XML_Bool setContext (XML_Parser parser, const XML_Char *context)
 
static int setElementTypePrefix (XML_Parser parser, ELEMENT_TYPE *)
 
static XML_Bool startParsing (XML_Parser parser)
 
static enum XML_Error storeAttributeValue (XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *)
 
static enum XML_Error storeAtts (XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr)
 
static enum XML_Error storeEntityValue (XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
 
static XML_Bool storeRawNames (XML_Parser parser)
 
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)
 
XML_Parser XMLCALL XML_ExternalEntityParserCreate (XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName)
 
void XMLCALL XML_FreeContentModel (XML_Parser parser, XML_Content *model)
 
const XML_Char *XMLCALL XML_GetBase (XML_Parser parser)
 
void *XMLCALL XML_GetBuffer (XML_Parser parser, int len)
 
int XMLCALL XML_GetCurrentByteCount (XML_Parser parser)
 
XML_Index XMLCALL XML_GetCurrentByteIndex (XML_Parser parser)
 
XML_Size XMLCALL XML_GetCurrentColumnNumber (XML_Parser parser)
 
XML_Size XMLCALL XML_GetCurrentLineNumber (XML_Parser parser)
 
enum XML_Error XMLCALL XML_GetErrorCode (XML_Parser parser)
 
const XML_Feature *XMLCALL XML_GetFeatureList (void)
 
int XMLCALL XML_GetIdAttributeIndex (XML_Parser parser)
 
const char *XMLCALL XML_GetInputContext (XML_Parser parser, int *offset, int *size)
 
void XMLCALL XML_GetParsingStatus (XML_Parser parser, XML_ParsingStatus *status)
 
int XMLCALL XML_GetSpecifiedAttributeCount (XML_Parser parser)
 
void XMLCALL XML_MemFree (XML_Parser parser, void *ptr)
 
void *XMLCALL XML_MemMalloc (XML_Parser parser, size_t size)
 
void *XMLCALL XML_MemRealloc (XML_Parser parser, void *ptr, size_t size)
 
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)
 
XML_Parser XMLCALL XML_ParserCreate (const XML_Char *encodingName)
 
XML_Parser XMLCALL XML_ParserCreate_MM (const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep)
 
XML_Parser XMLCALL XML_ParserCreateNS (const XML_Char *encodingName, XML_Char nsSep)
 
void XMLCALL XML_ParserFree (XML_Parser parser)
 
XML_Bool XMLCALL XML_ParserReset (XML_Parser parser, const XML_Char *encodingName)
 
enum XML_Status XMLCALL XML_ResumeParser (XML_Parser parser)
 
void XMLCALL XML_SetAttlistDeclHandler (XML_Parser parser, XML_AttlistDeclHandler attdecl)
 
enum XML_Status XMLCALL XML_SetBase (XML_Parser parser, const XML_Char *p)
 
void XMLCALL XML_SetCdataSectionHandler (XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end)
 
void XMLCALL XML_SetCharacterDataHandler (XML_Parser parser, XML_CharacterDataHandler handler)
 
void XMLCALL XML_SetCommentHandler (XML_Parser parser, XML_CommentHandler handler)
 
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_SetElementDeclHandler (XML_Parser parser, XML_ElementDeclHandler eldecl)
 
void XMLCALL XML_SetElementHandler (XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
 
enum XML_Status XMLCALL XML_SetEncoding (XML_Parser parser, const XML_Char *encodingName)
 
void XMLCALL XML_SetEndCdataSectionHandler (XML_Parser parser, XML_EndCdataSectionHandler end)
 
void XMLCALL XML_SetEndDoctypeDeclHandler (XML_Parser parser, XML_EndDoctypeDeclHandler end)
 
void XMLCALL XML_SetEndElementHandler (XML_Parser parser, XML_EndElementHandler end)
 
void XMLCALL XML_SetEndNamespaceDeclHandler (XML_Parser parser, XML_EndNamespaceDeclHandler end)
 
void XMLCALL XML_SetEntityDeclHandler (XML_Parser parser, XML_EntityDeclHandler handler)
 
void XMLCALL XML_SetExternalEntityRefHandler (XML_Parser parser, XML_ExternalEntityRefHandler handler)
 
void XMLCALL XML_SetExternalEntityRefHandlerArg (XML_Parser parser, void *arg)
 
int XMLCALL XML_SetHashSalt (XML_Parser parser, unsigned long hash_salt)
 
void XMLCALL XML_SetNamespaceDeclHandler (XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)
 
void XMLCALL XML_SetNotationDeclHandler (XML_Parser parser, XML_NotationDeclHandler handler)
 
void XMLCALL XML_SetNotStandaloneHandler (XML_Parser parser, XML_NotStandaloneHandler handler)
 
int XMLCALL XML_SetParamEntityParsing (XML_Parser parser, enum XML_ParamEntityParsing peParsing)
 
void XMLCALL XML_SetProcessingInstructionHandler (XML_Parser parser, XML_ProcessingInstructionHandler handler)
 
void XMLCALL XML_SetReturnNSTriplet (XML_Parser parser, int do_nst)
 
void XMLCALL XML_SetSkippedEntityHandler (XML_Parser parser, XML_SkippedEntityHandler handler)
 
void XMLCALL XML_SetStartCdataSectionHandler (XML_Parser parser, XML_StartCdataSectionHandler start)
 
void XMLCALL XML_SetStartDoctypeDeclHandler (XML_Parser parser, XML_StartDoctypeDeclHandler start)
 
void XMLCALL XML_SetStartElementHandler (XML_Parser parser, XML_StartElementHandler start)
 
void XMLCALL XML_SetStartNamespaceDeclHandler (XML_Parser parser, XML_StartNamespaceDeclHandler start)
 
void XMLCALL XML_SetUnknownEncodingHandler (XML_Parser parser, XML_UnknownEncodingHandler handler, void *data)
 
void XMLCALL XML_SetUnparsedEntityDeclHandler (XML_Parser parser, XML_UnparsedEntityDeclHandler handler)
 
void XMLCALL XML_SetUserData (XML_Parser parser, void *p)
 
void XMLCALL XML_SetXmlDeclHandler (XML_Parser parser, XML_XmlDeclHandler handler)
 
enum XML_Status XMLCALL XML_StopParser (XML_Parser parser, XML_Bool resumable)
 
enum XML_Error XMLCALL XML_UseForeignDTD (XML_Parser parser, XML_Bool useDTD)
 
void XMLCALL XML_UseParserAsHandlerArg (XML_Parser parser)
 

Variables

static Processor cdataSectionProcessor
 
static Processor contentProcessor
 
static Processor epilogProcessor
 
static Processor errorProcessor
 
static Processor externalEntityContentProcessor
 
static Processor externalEntityInitProcessor
 
static Processor externalEntityInitProcessor2
 
static Processor externalEntityInitProcessor3
 
static const XML_Char implicitContext []
 
static Processor internalEntityProcessor
 
static Processor prologInitProcessor
 
static Processor prologProcessor
 

Macro Definition Documentation

◆ _dtd

#define _dtd   (parser->m_dtd)

Definition at line 636 of file xmlparse.cc.

◆ attInfo

#define attInfo   (parser->m_attInfo)

Definition at line 660 of file xmlparse.cc.

◆ attlistDeclHandler

#define attlistDeclHandler   (parser->m_attlistDeclHandler)

Definition at line 602 of file xmlparse.cc.

◆ atts

#define atts   (parser->m_atts)

Definition at line 653 of file xmlparse.cc.

◆ attsSize

#define attsSize   (parser->m_attsSize)

Definition at line 654 of file xmlparse.cc.

◆ buffer

#define buffer   (parser->m_buffer)

Definition at line 628 of file xmlparse.cc.

◆ bufferEnd

#define bufferEnd   (parser->m_bufferEnd)

Definition at line 630 of file xmlparse.cc.

◆ bufferLim

#define bufferLim   (parser->m_bufferLim)

Definition at line 633 of file xmlparse.cc.

◆ bufferPtr

#define bufferPtr   (parser->m_bufferPtr)

Definition at line 629 of file xmlparse.cc.

◆ CHAR_HASH

#define CHAR_HASH (   h,
 
)     (((h) * 0xF4243) ^ (unsigned char)(c))

Definition at line 119 of file xmlparse.cc.

◆ characterDataHandler

#define characterDataHandler   (parser->m_characterDataHandler)

Definition at line 576 of file xmlparse.cc.

◆ commentHandler

#define commentHandler   (parser->m_commentHandler)

Definition at line 579 of file xmlparse.cc.

◆ CONTEXT_SEP

#define CONTEXT_SEP   XML_T(ASCII_FF)

Definition at line 5496 of file xmlparse.cc.

◆ curBase

#define curBase   (parser->m_curBase)

Definition at line 637 of file xmlparse.cc.

◆ dataBuf

#define dataBuf   (parser->m_dataBuf)

Definition at line 634 of file xmlparse.cc.

◆ dataBufEnd

#define dataBufEnd   (parser->m_dataBufEnd)

Definition at line 635 of file xmlparse.cc.

◆ declAttributeId

#define declAttributeId   (parser->m_declAttributeId)

Definition at line 646 of file xmlparse.cc.

◆ declAttributeIsCdata

#define declAttributeIsCdata   (parser->m_declAttributeIsCdata)

Definition at line 647 of file xmlparse.cc.

◆ declAttributeIsId

#define declAttributeIsId   (parser->m_declAttributeIsId)

Definition at line 648 of file xmlparse.cc.

◆ declAttributeType

#define declAttributeType   (parser->m_declAttributeType)

Definition at line 642 of file xmlparse.cc.

◆ declElementType

#define declElementType   (parser->m_declElementType)

Definition at line 645 of file xmlparse.cc.

◆ declEntity

#define declEntity   (parser->m_declEntity)

Definition at line 638 of file xmlparse.cc.

◆ declNotationName

#define declNotationName   (parser->m_declNotationName)

Definition at line 643 of file xmlparse.cc.

◆ declNotationPublicId

#define declNotationPublicId   (parser->m_declNotationPublicId)

Definition at line 644 of file xmlparse.cc.

◆ defaultExpandInternalEntities

#define defaultExpandInternalEntities    (parser->m_defaultExpandInternalEntities)

Definition at line 625 of file xmlparse.cc.

◆ defaultHandler

#define defaultHandler   (parser->m_defaultHandler)

Definition at line 583 of file xmlparse.cc.

◆ doctypeName

#define doctypeName   (parser->m_doctypeName)

Definition at line 639 of file xmlparse.cc.

◆ doctypePubid

#define doctypePubid   (parser->m_doctypePubid)

Definition at line 641 of file xmlparse.cc.

◆ doctypeSysid

#define doctypeSysid   (parser->m_doctypeSysid)

Definition at line 640 of file xmlparse.cc.

◆ elementDeclHandler

#define elementDeclHandler   (parser->m_elementDeclHandler)

Definition at line 601 of file xmlparse.cc.

◆ encoding

#define encoding   (parser->m_encoding)

Definition at line 605 of file xmlparse.cc.

◆ endCdataSectionHandler

#define endCdataSectionHandler   (parser->m_endCdataSectionHandler)

Definition at line 582 of file xmlparse.cc.

◆ endDoctypeDeclHandler

#define endDoctypeDeclHandler   (parser->m_endDoctypeDeclHandler)

Definition at line 585 of file xmlparse.cc.

◆ endElementHandler

#define endElementHandler   (parser->m_endElementHandler)

Definition at line 575 of file xmlparse.cc.

◆ endNamespaceDeclHandler

#define endNamespaceDeclHandler   (parser->m_endNamespaceDeclHandler)

Definition at line 591 of file xmlparse.cc.

◆ entityDeclHandler

#define entityDeclHandler   (parser->m_entityDeclHandler)

Definition at line 603 of file xmlparse.cc.

◆ errorCode

#define errorCode   (parser->m_errorCode)

Definition at line 618 of file xmlparse.cc.

◆ eventEndPtr

#define eventEndPtr   (parser->m_eventEndPtr)

Definition at line 620 of file xmlparse.cc.

◆ eventPtr

#define eventPtr   (parser->m_eventPtr)

Definition at line 619 of file xmlparse.cc.

◆ EXPAND_SPARE

#define EXPAND_SPARE   24

Definition at line 148 of file xmlparse.cc.

◆ externalEntityRefHandler

#define externalEntityRefHandler    (parser->m_externalEntityRefHandler)

Definition at line 593 of file xmlparse.cc.

◆ externalEntityRefHandlerArg

#define externalEntityRefHandlerArg    (parser->m_externalEntityRefHandlerArg)

Definition at line 595 of file xmlparse.cc.

◆ FREE

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

Definition at line 570 of file xmlparse.cc.

◆ freeBindingList

#define freeBindingList   (parser->m_freeBindingList)

Definition at line 650 of file xmlparse.cc.

◆ freeInternalEntities

#define freeInternalEntities   (parser->m_freeInternalEntities)

Definition at line 624 of file xmlparse.cc.

◆ freeTagList

#define freeTagList   (parser->m_freeTagList)

Definition at line 649 of file xmlparse.cc.

◆ groupConnector

#define groupConnector   (parser->m_groupConnector)

Definition at line 663 of file xmlparse.cc.

◆ groupSize

#define groupSize   (parser->m_groupSize)

Definition at line 664 of file xmlparse.cc.

◆ handlerArg

#define handlerArg   (parser->m_handlerArg)

Definition at line 573 of file xmlparse.cc.

◆ hash_secret_salt

#define hash_secret_salt   (parser->m_hash_secret_salt)

Definition at line 674 of file xmlparse.cc.

◆ idAttIndex

#define idAttIndex   (parser->m_idAttIndex)

Definition at line 656 of file xmlparse.cc.

◆ inheritedBindings

#define inheritedBindings   (parser->m_inheritedBindings)

Definition at line 651 of file xmlparse.cc.

◆ INIT_ATTS_SIZE

#define INIT_ATTS_SIZE   16

Definition at line 143 of file xmlparse.cc.

◆ INIT_ATTS_VERSION

#define INIT_ATTS_VERSION   0xFFFFFFFF

Definition at line 144 of file xmlparse.cc.

◆ INIT_BLOCK_SIZE

#define INIT_BLOCK_SIZE   1024

Definition at line 145 of file xmlparse.cc.

◆ INIT_BUFFER_SIZE

#define INIT_BUFFER_SIZE   1024

Definition at line 146 of file xmlparse.cc.

◆ INIT_DATA_BUF_SIZE

#define INIT_DATA_BUF_SIZE   1024

Definition at line 142 of file xmlparse.cc.

◆ INIT_POWER

#define INIT_POWER   6

Definition at line 5955 of file xmlparse.cc.

◆ INIT_SCAFFOLD_ELEMENTS

#define INIT_SCAFFOLD_ELEMENTS   32

Definition at line 221 of file xmlparse.cc.

◆ INIT_TAG_BUF_SIZE

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

Definition at line 141 of file xmlparse.cc.

◆ initEncoding

#define initEncoding   (parser->m_initEncoding)

Definition at line 606 of file xmlparse.cc.

◆ internalEncoding

#define internalEncoding   (parser->m_internalEncoding)

Definition at line 607 of file xmlparse.cc.

◆ internalEntityRefHandler

#define internalEntityRefHandler    (parser->m_internalEntityRefHandler)

Definition at line 597 of file xmlparse.cc.

◆ MALLOC

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

Definition at line 568 of file xmlparse.cc.

◆ MUST_CONVERT

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

Definition at line 49 of file xmlparse.cc.

◆ namespaceSeparator

#define namespaceSeparator   (parser->m_namespaceSeparator)

Definition at line 665 of file xmlparse.cc.

◆ notationDeclHandler

#define notationDeclHandler   (parser->m_notationDeclHandler)

Definition at line 588 of file xmlparse.cc.

◆ notStandaloneHandler

#define notStandaloneHandler   (parser->m_notStandaloneHandler)

Definition at line 592 of file xmlparse.cc.

◆ ns

#define ns   (parser->m_ns)

Definition at line 614 of file xmlparse.cc.

◆ ns_triplets

#define ns_triplets   (parser->m_ns_triplets)

Definition at line 615 of file xmlparse.cc.

◆ nsAtts

#define nsAtts   (parser->m_nsAtts)

Definition at line 657 of file xmlparse.cc.

◆ nsAttsPower

#define nsAttsPower   (parser->m_nsAttsPower)

Definition at line 659 of file xmlparse.cc.

◆ nsAttsVersion

#define nsAttsVersion   (parser->m_nsAttsVersion)

Definition at line 658 of file xmlparse.cc.

◆ nSpecifiedAtts

#define nSpecifiedAtts   (parser->m_nSpecifiedAtts)

Definition at line 655 of file xmlparse.cc.

◆ openInternalEntities

#define openInternalEntities   (parser->m_openInternalEntities)

Definition at line 623 of file xmlparse.cc.

◆ parentParser

#define parentParser   (parser->m_parentParser)

Definition at line 666 of file xmlparse.cc.

◆ parseEndByteIndex

#define parseEndByteIndex   (parser->m_parseEndByteIndex)

Definition at line 631 of file xmlparse.cc.

◆ parseEndPtr

#define parseEndPtr   (parser->m_parseEndPtr)

Definition at line 632 of file xmlparse.cc.

◆ poolAppendChar

#define poolAppendChar (   pool,
 
)
Value:
(((pool)->ptr == (pool)->end && !poolGrow(pool)) \
? 0 \
: ((*((pool)->ptr)++ = c), 1))
static XML_Bool FASTCALL poolGrow(STRING_POOL *pool)
Definition: xmlparse.cc:6216

Definition at line 460 of file xmlparse.cc.

◆ poolChop

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

Definition at line 456 of file xmlparse.cc.

◆ poolDiscard

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

Definition at line 458 of file xmlparse.cc.

◆ poolEnd

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

Definition at line 454 of file xmlparse.cc.

◆ poolFinish

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

Definition at line 459 of file xmlparse.cc.

◆ poolLastChar

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

Definition at line 457 of file xmlparse.cc.

◆ poolLength

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

Definition at line 455 of file xmlparse.cc.

◆ poolStart

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

Definition at line 453 of file xmlparse.cc.

◆ position

#define position   (parser->m_position)

Definition at line 622 of file xmlparse.cc.

◆ positionPtr

#define positionPtr   (parser->m_positionPtr)

Definition at line 621 of file xmlparse.cc.

◆ PROBE_STEP

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

Definition at line 133 of file xmlparse.cc.

◆ processingInstructionHandler

#define processingInstructionHandler    (parser->m_processingInstructionHandler)

Definition at line 577 of file xmlparse.cc.

◆ processor

#define processor   (parser->m_processor)

Definition at line 617 of file xmlparse.cc.

◆ prologState

#define prologState   (parser->m_prologState)

Definition at line 616 of file xmlparse.cc.

◆ protocolEncodingName

#define protocolEncodingName   (parser->m_protocolEncodingName)

Definition at line 613 of file xmlparse.cc.

◆ ps_finalBuffer

#define ps_finalBuffer   (parser->m_parsingStatus.finalBuffer)

Definition at line 668 of file xmlparse.cc.

◆ ps_parsing

#define ps_parsing   (parser->m_parsingStatus.parsing)

Definition at line 667 of file xmlparse.cc.

◆ REALLOC

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

Definition at line 569 of file xmlparse.cc.

◆ ROUND_UP

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

Definition at line 82 of file xmlparse.cc.

◆ SECOND_HASH

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

Definition at line 131 of file xmlparse.cc.

◆ skippedEntityHandler

#define skippedEntityHandler   (parser->m_skippedEntityHandler)

Definition at line 599 of file xmlparse.cc.

◆ startCdataSectionHandler

#define startCdataSectionHandler    (parser->m_startCdataSectionHandler)

Definition at line 580 of file xmlparse.cc.

◆ startDoctypeDeclHandler

#define startDoctypeDeclHandler   (parser->m_startDoctypeDeclHandler)

Definition at line 584 of file xmlparse.cc.

◆ startElementHandler

#define startElementHandler   (parser->m_startElementHandler)

Definition at line 574 of file xmlparse.cc.

◆ startNamespaceDeclHandler

#define startNamespaceDeclHandler    (parser->m_startNamespaceDeclHandler)

Definition at line 589 of file xmlparse.cc.

◆ tagLevel

#define tagLevel   (parser->m_tagLevel)

Definition at line 627 of file xmlparse.cc.

◆ tagStack

#define tagStack   (parser->m_tagStack)

Definition at line 652 of file xmlparse.cc.

◆ temp2Pool

#define temp2Pool   (parser->m_temp2Pool)

Definition at line 662 of file xmlparse.cc.

◆ tempPool

#define tempPool   (parser->m_tempPool)

Definition at line 661 of file xmlparse.cc.

◆ unknownEncodingData

#define unknownEncodingData   (parser->m_unknownEncodingData)

Definition at line 609 of file xmlparse.cc.

◆ unknownEncodingHandler

#define unknownEncodingHandler   (parser->m_unknownEncodingHandler)

Definition at line 600 of file xmlparse.cc.

◆ unknownEncodingHandlerData

#define unknownEncodingHandlerData    (parser->m_unknownEncodingHandlerData)

Definition at line 610 of file xmlparse.cc.

◆ unknownEncodingMem

#define unknownEncodingMem   (parser->m_unknownEncodingMem)

Definition at line 608 of file xmlparse.cc.

◆ unknownEncodingRelease

#define unknownEncodingRelease   (parser->m_unknownEncodingRelease)

Definition at line 612 of file xmlparse.cc.

◆ unparsedEntityDeclHandler

#define unparsedEntityDeclHandler    (parser->m_unparsedEntityDeclHandler)

Definition at line 586 of file xmlparse.cc.

◆ userData

#define userData   (parser->m_userData)

Definition at line 572 of file xmlparse.cc.

◆ V1

#define V1 (   a,
  b,
 
)    XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c)

◆ V2

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

◆ XML_BUILDING_EXPAT

#define XML_BUILDING_EXPAT   1

Definition at line 17 of file xmlparse.cc.

◆ XML_ENCODE_MAX

#define XML_ENCODE_MAX   XML_UTF8_ENCODE_MAX

Definition at line 44 of file xmlparse.cc.

◆ XML_L

#define XML_L (   x)    x

Definition at line 77 of file xmlparse.cc.

◆ XML_T

#define XML_T (   x)    x

Definition at line 76 of file xmlparse.cc.

◆ XmlConvert

#define XmlConvert   XmlUtf8Convert

Definition at line 45 of file xmlparse.cc.

◆ xmlDeclHandler

#define xmlDeclHandler   (parser->m_xmlDeclHandler)

Definition at line 604 of file xmlparse.cc.

◆ XmlEncode

#define XmlEncode   XmlUtf8Encode

Definition at line 48 of file xmlparse.cc.

◆ XmlGetInternalEncoding

#define XmlGetInternalEncoding   XmlGetUtf8InternalEncoding

Definition at line 46 of file xmlparse.cc.

◆ XmlGetInternalEncodingNS [1/2]

#define XmlGetInternalEncodingNS   XmlGetUtf8InternalEncodingNS

Definition at line 59 of file xmlparse.cc.

◆ XmlGetInternalEncodingNS [2/2]

#define XmlGetInternalEncodingNS   XmlGetInternalEncoding

Definition at line 59 of file xmlparse.cc.

◆ XmlInitEncodingNS

#define XmlInitEncodingNS   XmlInitEncoding

Definition at line 56 of file xmlparse.cc.

◆ XmlInitUnknownEncodingNS

#define XmlInitUnknownEncodingNS   XmlInitUnknownEncoding

Definition at line 57 of file xmlparse.cc.

◆ XmlParseXmlDeclNS

#define XmlParseXmlDeclNS   XmlParseXmlDecl

Definition at line 60 of file xmlparse.cc.

Typedef Documentation

◆ ATTRIBUTE_ID

typedef struct attribute_id ATTRIBUTE_ID

◆ BINDING

typedef struct binding BINDING

◆ BLOCK

typedef struct block BLOCK

◆ ICHAR

typedef char ICHAR

Definition at line 50 of file xmlparse.cc.

◆ KEY

typedef const XML_Char* KEY

Definition at line 97 of file xmlparse.cc.

◆ OPEN_INTERNAL_ENTITY

◆ PREFIX

typedef struct prefix PREFIX

◆ TAG

typedef struct tag TAG

Function Documentation

◆ addBinding()

static enum XML_Error addBinding ( XML_Parser  parser,
PREFIX prefix,
const ATTRIBUTE_ID attId,
const XML_Char uri,
BINDING **  bindingsPtr 
)
static

Definition at line 3056 of file xmlparse.cc.

3058{
3059 static const XML_Char xmlNamespace[] = {
3065 ASCII_e, '\0'
3066 };
3067 static const int xmlLen =
3068 (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1;
3069 static const XML_Char xmlnsNamespace[] = {
3074 ASCII_SLASH, '\0'
3075 };
3076 static const int xmlnsLen =
3077 (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1;
3078
3079 XML_Bool mustBeXML = XML_FALSE;
3080 XML_Bool isXML = XML_TRUE;
3081 XML_Bool isXMLNS = XML_TRUE;
3082
3083 BINDING *b;
3084 int len;
3085
3086 /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
3087 if (*uri == XML_T('\0') && prefix->name)
3089
3090 if (prefix->name
3091 && prefix->name[0] == XML_T(ASCII_x)
3092 && prefix->name[1] == XML_T(ASCII_m)
3093 && prefix->name[2] == XML_T(ASCII_l)) {
3094
3095 /* Not allowed to bind xmlns */
3096 if (prefix->name[3] == XML_T(ASCII_n)
3097 && prefix->name[4] == XML_T(ASCII_s)
3098 && prefix->name[5] == XML_T('\0'))
3100
3101 if (prefix->name[3] == XML_T('\0'))
3102 mustBeXML = XML_TRUE;
3103 }
3104
3105 for (len = 0; uri[len]; len++) {
3106 if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len]))
3107 isXML = XML_FALSE;
3108
3109 if (!mustBeXML && isXMLNS
3110 && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
3111 isXMLNS = XML_FALSE;
3112 }
3113 isXML = isXML && len == xmlLen;
3114 isXMLNS = isXMLNS && len == xmlnsLen;
3115
3116 if (mustBeXML != isXML)
3117 return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML
3119
3120 if (isXMLNS)
3122
3124 len++;
3125 if (freeBindingList) {
3126 b = freeBindingList;
3127 if (len > b->uriAlloc) {
3128 XML_Char *temp = (XML_Char *)REALLOC(b->uri,
3129 sizeof(XML_Char) * (len + EXPAND_SPARE));
3130 if (temp == NULL)
3131 return XML_ERROR_NO_MEMORY;
3132 b->uri = temp;
3133 b->uriAlloc = len + EXPAND_SPARE;
3134 }
3136 }
3137 else {
3138 b = (BINDING *)MALLOC(sizeof(BINDING));
3139 if (!b)
3140 return XML_ERROR_NO_MEMORY;
3141 b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
3142 if (!b->uri) {
3143 FREE(b);
3144 return XML_ERROR_NO_MEMORY;
3145 }
3146 b->uriAlloc = len + EXPAND_SPARE;
3147 }
3148 b->uriLen = len;
3149 memcpy(b->uri, uri, len * sizeof(XML_Char));
3151 b->uri[len - 1] = namespaceSeparator;
3152 b->prefix = prefix;
3153 b->attId = attId;
3155 /* NULL binding when default namespace undeclared */
3156 if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix)
3157 prefix->binding = NULL;
3158 else
3159 prefix->binding = b;
3160 b->nextTagBinding = *bindingsPtr;
3161 *bindingsPtr = b;
3162 /* if attId == NULL then we are not starting a namespace scope */
3163 if (attId && startNamespaceDeclHandler)
3165 prefix->binding ? uri : 0);
3166 return XML_ERROR_NONE;
3167}
#define ASCII_l
Definition: ascii.h:43
#define ASCII_X
Definition: ascii.h:28
#define ASCII_SLASH
Definition: ascii.h:89
#define ASCII_o
Definition: ascii.h:46
#define ASCII_n
Definition: ascii.h:45
#define ASCII_s
Definition: ascii.h:50
#define ASCII_t
Definition: ascii.h:51
#define ASCII_c
Definition: ascii.h:34
#define ASCII_PERIOD
Definition: ascii.h:77
#define ASCII_h
Definition: ascii.h:39
#define ASCII_9
Definition: ascii.h:68
#define ASCII_e
Definition: ascii.h:36
#define ASCII_w
Definition: ascii.h:54
#define ASCII_M
Definition: ascii.h:17
#define ASCII_8
Definition: ascii.h:67
#define ASCII_r
Definition: ascii.h:49
#define ASCII_p
Definition: ascii.h:47
#define ASCII_COLON
Definition: ascii.h:78
#define ASCII_0
Definition: ascii.h:59
#define ASCII_L
Definition: ascii.h:16
#define ASCII_1
Definition: ascii.h:60
#define ASCII_a
Definition: ascii.h:32
#define ASCII_m
Definition: ascii.h:44
#define ASCII_g
Definition: ascii.h:38
#define ASCII_2
Definition: ascii.h:61
#define ASCII_x
Definition: ascii.h:55
#define ASCII_3
Definition: ascii.h:62
#define XML_FALSE
Definition: expat.h:30
unsigned char XML_Bool
Definition: expat.h:28
@ XML_ERROR_NO_MEMORY
Definition: expat.h:56
@ XML_ERROR_NONE
Definition: expat.h:55
@ XML_ERROR_RESERVED_PREFIX_XML
Definition: expat.h:96
@ XML_ERROR_RESERVED_NAMESPACE_URI
Definition: expat.h:98
@ XML_ERROR_UNDECLARING_PREFIX
Definition: expat.h:85
@ XML_ERROR_RESERVED_PREFIX_XMLNS
Definition: expat.h:97
#define XML_TRUE
Definition: expat.h:29
char XML_Char
struct binding * prevPrefixBinding
Definition: xmlparse.cc:153
const struct attribute_id * attId
Definition: xmlparse.cc:154
XML_Char * uri
Definition: xmlparse.cc:155
struct binding * nextTagBinding
Definition: xmlparse.cc:152
int uriLen
Definition: xmlparse.cc:156
struct prefix * prefix
Definition: xmlparse.cc:151
int uriAlloc
Definition: xmlparse.cc:157
const XML_Char * name
Definition: xmlparse.cc:161
BINDING * binding
Definition: xmlparse.cc:162
#define FREE(p)
Definition: xmlparse.cc:570
#define REALLOC(p, s)
Definition: xmlparse.cc:569
#define freeBindingList
Definition: xmlparse.cc:650
#define namespaceSeparator
Definition: xmlparse.cc:665
#define startNamespaceDeclHandler
Definition: xmlparse.cc:589
#define handlerArg
Definition: xmlparse.cc:573
#define _dtd
Definition: xmlparse.cc:636
#define MALLOC(s)
Definition: xmlparse.cc:568
#define EXPAND_SPARE
Definition: xmlparse.cc:148
#define XML_T(x)
Definition: xmlparse.cc:76

References _dtd, ASCII_0, ASCII_1, ASCII_2, ASCII_3, ASCII_8, ASCII_9, ASCII_a, ASCII_c, ASCII_COLON, ASCII_e, ASCII_g, ASCII_h, ASCII_L, ASCII_l, ASCII_M, ASCII_m, ASCII_n, ASCII_o, ASCII_p, ASCII_PERIOD, ASCII_r, ASCII_s, ASCII_SLASH, ASCII_t, ASCII_w, ASCII_X, ASCII_x, binding::attId, prefix::binding, EXPAND_SPARE, FREE, freeBindingList, handlerArg, MALLOC, prefix::name, namespaceSeparator, binding::nextTagBinding, binding::prefix, binding::prevPrefixBinding, REALLOC, startNamespaceDeclHandler, binding::uri, binding::uriAlloc, binding::uriLen, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_RESERVED_NAMESPACE_URI, XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, XML_ERROR_UNDECLARING_PREFIX, XML_FALSE, XML_T, and XML_TRUE.

Referenced by setContext(), and storeAtts().

◆ appendAttributeValue()

static enum XML_Error appendAttributeValue ( XML_Parser  parser,
const ENCODING enc,
XML_Bool  isCdata,
const char *  ptr,
const char *  end,
STRING_POOL pool 
)
static

Definition at line 4944 of file xmlparse.cc.

4947{
4948 DTD * const dtd = _dtd; /* save one level of indirection */
4949 for (;;) {
4950 const char *next;
4951 int tok = XmlAttributeValueTok(enc, ptr, end, &next);
4952 switch (tok) {
4953 case XML_TOK_NONE:
4954 return XML_ERROR_NONE;
4955 case XML_TOK_INVALID:
4956 if (enc == encoding)
4957 eventPtr = next;
4959 case XML_TOK_PARTIAL:
4960 if (enc == encoding)
4961 eventPtr = ptr;
4963 case XML_TOK_CHAR_REF:
4964 {
4966 int i;
4967 int n = XmlCharRefNumber(enc, ptr);
4968 if (n < 0) {
4969 if (enc == encoding)
4970 eventPtr = ptr;
4972 }
4973 if (!isCdata
4974 && n == 0x20 /* space */
4975 && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
4976 break;
4977 n = XmlEncode(n, (ICHAR *)buf);
4978 if (!n) {
4979 if (enc == encoding)
4980 eventPtr = ptr;
4982 }
4983 for (i = 0; i < n; i++) {
4984 if (!poolAppendChar(pool, buf[i]))
4985 return XML_ERROR_NO_MEMORY;
4986 }
4987 }
4988 break;
4989 case XML_TOK_DATA_CHARS:
4990 if (!poolAppend(pool, enc, ptr, next))
4991 return XML_ERROR_NO_MEMORY;
4992 break;
4994 next = ptr + enc->minBytesPerChar;
4995 /* fall through */
4998 if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
4999 break;
5000 if (!poolAppendChar(pool, 0x20))
5001 return XML_ERROR_NO_MEMORY;
5002 break;
5003 case XML_TOK_ENTITY_REF:
5004 {
5005 const XML_Char *name;
5006 ENTITY *entity;
5007 char checkEntityDecl;
5009 ptr + enc->minBytesPerChar,
5010 next - enc->minBytesPerChar);
5011 if (ch) {
5012 if (!poolAppendChar(pool, ch))
5013 return XML_ERROR_NO_MEMORY;
5014 break;
5015 }
5017 ptr + enc->minBytesPerChar,
5018 next - enc->minBytesPerChar);
5019 if (!name)
5020 return XML_ERROR_NO_MEMORY;
5021 entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0);
5023 /* First, determine if a check for an existing declaration is needed;
5024 if yes, check that the entity exists, and that it is internal.
5025 */
5026 if (pool == &dtd->pool) /* are we called from prolog? */
5027 checkEntityDecl =
5028#ifdef XML_DTD
5029 prologState.documentEntity &&
5030#endif /* XML_DTD */
5031 (dtd->standalone
5033 : !dtd->hasParamEntityRefs);
5034 else /* if (pool == &tempPool): we are called from content */
5035 checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone;
5036 if (checkEntityDecl) {
5037 if (!entity)
5039 else if (!entity->is_internal)
5041 }
5042 else if (!entity) {
5043 /* Cannot report skipped entity here - see comments on
5044 skippedEntityHandler.
5045 if (skippedEntityHandler)
5046 skippedEntityHandler(handlerArg, name, 0);
5047 */
5048 /* Cannot call the default handler because this would be
5049 out of sync with the call to the startElementHandler.
5050 if ((pool == &tempPool) && defaultHandler)
5051 reportDefault(parser, enc, ptr, next);
5052 */
5053 break;
5054 }
5055 if (entity->open) {
5056 if (enc == encoding)
5057 eventPtr = ptr;
5059 }
5060 if (entity->notation) {
5061 if (enc == encoding)
5062 eventPtr = ptr;
5064 }
5065 if (!entity->textPtr) {
5066 if (enc == encoding)
5067 eventPtr = ptr;
5069 }
5070 else {
5071 enum XML_Error result;
5072 const XML_Char *textEnd = entity->textPtr + entity->textLen;
5073 entity->open = XML_TRUE;
5074 result = appendAttributeValue(parser, internalEncoding, isCdata,
5075 (char *)entity->textPtr,
5076 (char *)textEnd, pool);
5077 entity->open = XML_FALSE;
5078 if (result)
5079 return result;
5080 }
5081 }
5082 break;
5083 default:
5084 if (enc == encoding)
5085 eventPtr = ptr;
5087 }
5088 ptr = next;
5089 }
5090 /* not reached */
5091}
XML_Error
Definition: expat.h:54
@ XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
Definition: expat.h:71
@ XML_ERROR_RECURSIVE_ENTITY_REF
Definition: expat.h:67
@ XML_ERROR_ENTITY_DECLARED_IN_PE
Definition: expat.h:79
@ XML_ERROR_UNEXPECTED_STATE
Definition: expat.h:78
@ XML_ERROR_BAD_CHAR_REF
Definition: expat.h:69
@ XML_ERROR_UNDEFINED_ENTITY
Definition: expat.h:66
@ XML_ERROR_INVALID_TOKEN
Definition: expat.h:59
@ XML_ERROR_BINARY_ENTITY_REF
Definition: expat.h:70
const char * name(G4int ptype)
Definition: xmlparse.cc:268
XML_Bool hasParamEntityRefs
Definition: xmlparse.cc:279
HASH_TABLE generalEntities
Definition: xmlparse.cc:269
STRING_POOL pool
Definition: xmlparse.cc:273
XML_Bool standalone
Definition: xmlparse.cc:280
XML_Bool is_internal
Definition: xmlparse.cc:208
const XML_Char * textPtr
Definition: xmlparse.cc:199
XML_Bool open
Definition: xmlparse.cc:206
int textLen
Definition: xmlparse.cc:200
const XML_Char * notation
Definition: xmlparse.cc:205
int minBytesPerChar
Definition: xmltok.h:169
#define eventPtr
Definition: xmlparse.cc:619
static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *)
Definition: xmlparse.cc:4944
#define internalEncoding
Definition: xmlparse.cc:607
static NAMED * lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize)
Definition: xmlparse.cc:5976
#define temp2Pool
Definition: xmlparse.cc:662
#define XML_ENCODE_MAX
Definition: xmlparse.cc:44
#define openInternalEntities
Definition: xmlparse.cc:623
#define poolLength(pool)
Definition: xmlparse.cc:455
static XML_Char * poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end)
Definition: xmlparse.cc:6204
static XML_Char * poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end)
Definition: xmlparse.cc:6151
#define poolDiscard(pool)
Definition: xmlparse.cc:458
char ICHAR
Definition: xmlparse.cc:50
#define poolAppendChar(pool, c)
Definition: xmlparse.cc:460
#define poolLastChar(pool)
Definition: xmlparse.cc:457
#define prologState
Definition: xmlparse.cc:616
#define XmlEncode
Definition: xmlparse.cc:48
#define XML_TOK_CHAR_REF
Definition: xmltok.h:35
#define XML_TOK_ENTITY_REF
Definition: xmltok.h:34
#define XML_TOK_DATA_NEWLINE
Definition: xmltok.h:32
#define XML_TOK_PARTIAL
Definition: xmltok.h:20
#define XML_TOK_DATA_CHARS
Definition: xmltok.h:31
#define XmlCharRefNumber(enc, ptr)
Definition: xmltok.h:241
#define XmlPredefinedEntityName(enc, ptr, end)
Definition: xmltok.h:244
#define XML_TOK_ATTRIBUTE_VALUE_S
Definition: xmltok.h:74
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr)
Definition: xmltok.h:221
#define XML_TOK_NONE
Definition: xmltok.h:17
#define XML_TOK_INVALID
Definition: xmltok.h:21
#define XML_TOK_TRAILING_CR
Definition: xmltok.h:18

References _dtd, appendAttributeValue(), eventPtr, DTD::generalEntities, DTD::hasParamEntityRefs, internalEncoding, ENTITY::is_internal, lookup(), encoding::minBytesPerChar, CLHEP::detail::n, G4InuclParticleNames::name(), ENTITY::notation, ENTITY::open, openInternalEntities, geant4_check_module_cycles::parser, DTD::pool, poolAppend(), poolAppendChar, poolDiscard, poolLastChar, poolLength, poolStoreString(), prologState, DTD::standalone, temp2Pool, ENTITY::textLen, ENTITY::textPtr, XML_ENCODE_MAX, XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, XML_ERROR_BAD_CHAR_REF, XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_ENTITY_DECLARED_IN_PE, XML_ERROR_INVALID_TOKEN, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_UNDEFINED_ENTITY, XML_ERROR_UNEXPECTED_STATE, XML_FALSE, XML_TOK_ATTRIBUTE_VALUE_S, XML_TOK_CHAR_REF, XML_TOK_DATA_CHARS, XML_TOK_DATA_NEWLINE, XML_TOK_ENTITY_REF, XML_TOK_INVALID, XML_TOK_NONE, XML_TOK_PARTIAL, XML_TOK_TRAILING_CR, XML_TRUE, XmlAttributeValueTok, XmlCharRefNumber, XmlEncode, and XmlPredefinedEntityName.

Referenced by appendAttributeValue(), and storeAttributeValue().

◆ build_model()

static XML_Content * build_model ( XML_Parser  parser)
static

Definition at line 6366 of file xmlparse.cc.

6367{
6368 DTD * const dtd = _dtd; /* save one level of indirection */
6369 XML_Content *ret;
6370 XML_Content *cpos;
6371 XML_Char * str;
6372 int allocsize = (dtd->scaffCount * sizeof(XML_Content)
6373 + (dtd->contentStringLen * sizeof(XML_Char)));
6374
6375 ret = (XML_Content *)MALLOC(allocsize);
6376 if (!ret)
6377 return NULL;
6378
6379 str = (XML_Char *) (&ret[dtd->scaffCount]);
6380 cpos = &ret[1];
6381
6382 build_node(parser, 0, ret, &cpos, &str);
6383 return ret;
6384}
struct XML_cp XML_Content
Definition: expat.h:135
unsigned contentStringLen
Definition: xmlparse.cc:290
unsigned scaffCount
Definition: xmlparse.cc:292
Definition: expat.h:137
static void build_node(XML_Parser parser, int src_node, XML_Content *dest, XML_Content **contpos, XML_Char **strpos)
Definition: xmlparse.cc:6328

References _dtd, build_node(), DTD::contentStringLen, MALLOC, geant4_check_module_cycles::parser, and DTD::scaffCount.

Referenced by doProlog().

◆ build_node()

static void build_node ( XML_Parser  parser,
int  src_node,
XML_Content dest,
XML_Content **  contpos,
XML_Char **  strpos 
)
static

Definition at line 6328 of file xmlparse.cc.

6333{
6334 DTD * const dtd = _dtd; /* save one level of indirection */
6335 dest->type = dtd->scaffold[src_node].type;
6336 dest->quant = dtd->scaffold[src_node].quant;
6337 if (dest->type == XML_CTYPE_NAME) {
6338 const XML_Char *src;
6339 dest->name = *strpos;
6340 src = dtd->scaffold[src_node].name;
6341 for (;;) {
6342 *(*strpos)++ = *src;
6343 if (!*src)
6344 break;
6345 src++;
6346 }
6347 dest->numchildren = 0;
6348 dest->children = NULL;
6349 }
6350 else {
6351 unsigned int i;
6352 int cn;
6353 dest->numchildren = dtd->scaffold[src_node].childcnt;
6354 dest->children = *contpos;
6355 *contpos += dest->numchildren;
6356 for (i = 0, cn = dtd->scaffold[src_node].firstchild;
6357 i < dest->numchildren;
6358 i++, cn = dtd->scaffold[cn].nextsib) {
6359 build_node(parser, cn, &(dest->children[i]), contpos, strpos);
6360 }
6361 dest->name = NULL;
6362 }
6363}
@ XML_CTYPE_NAME
Definition: expat.h:105
enum XML_Content_Quant quant
Definition: xmlparse.cc:213
enum XML_Content_Type type
Definition: xmlparse.cc:212
const XML_Char * name
Definition: xmlparse.cc:214
CONTENT_SCAFFOLD * scaffold
Definition: xmlparse.cc:289
XML_Content * children
Definition: expat.h:142
unsigned int numchildren
Definition: expat.h:141
XML_Char * name
Definition: expat.h:140
enum XML_Content_Quant quant
Definition: expat.h:139
enum XML_Content_Type type
Definition: expat.h:138

References _dtd, build_node(), CONTENT_SCAFFOLD::childcnt, XML_cp::children, CONTENT_SCAFFOLD::firstchild, XML_cp::name, CONTENT_SCAFFOLD::name, CONTENT_SCAFFOLD::nextsib, XML_cp::numchildren, geant4_check_module_cycles::parser, XML_cp::quant, CONTENT_SCAFFOLD::quant, DTD::scaffold, XML_cp::type, CONTENT_SCAFFOLD::type, and XML_CTYPE_NAME.

Referenced by build_model(), and build_node().

◆ cdataSectionProcessor()

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

Definition at line 3173 of file xmlparse.cc.

3177{
3178 enum XML_Error result = doCdataSection(parser, encoding, &start, end,
3179 endPtr, (XML_Bool)!ps_finalBuffer);
3180 if (result != XML_ERROR_NONE)
3181 return result;
3182 if (start) {
3183 if (parentParser) { /* we are parsing an external entity */
3185 return externalEntityContentProcessor(parser, start, end, endPtr);
3186 }
3187 else {
3189 return contentProcessor(parser, start, end, endPtr);
3190 }
3191 }
3192 return result;
3193}
#define ps_finalBuffer
Definition: xmlparse.cc:668
static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore)
Definition: xmlparse.cc:3199
static Processor contentProcessor
Definition: xmlparse.cc:313
#define parentParser
Definition: xmlparse.cc:666
static Processor externalEntityContentProcessor
Definition: xmlparse.cc:327
#define processor
Definition: xmlparse.cc:617

References contentProcessor, doCdataSection(), externalEntityContentProcessor, parentParser, geant4_check_module_cycles::parser, processor, ps_finalBuffer, and XML_ERROR_NONE.

◆ contentProcessor()

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

Definition at line 2106 of file xmlparse.cc.

2110{
2111 enum XML_Error result = doContent(parser, 0, encoding, start, end,
2112 endPtr, (XML_Bool)!ps_finalBuffer);
2113 if (result == XML_ERROR_NONE) {
2114 if (!storeRawNames(parser))
2115 return XML_ERROR_NO_MEMORY;
2116 }
2117 return result;
2118}
static enum XML_Error doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, const char *start, const char *end, const char **endPtr, XML_Bool haveMore)
Definition: xmlparse.cc:2237
static XML_Bool storeRawNames(XML_Parser parser)
Definition: xmlparse.cc:2061

References doContent(), geant4_check_module_cycles::parser, ps_finalBuffer, storeRawNames(), XML_ERROR_NO_MEMORY, and XML_ERROR_NONE.

◆ copyEntityTable()

static int copyEntityTable ( XML_Parser  oldParser,
HASH_TABLE newTable,
STRING_POOL newPool,
const HASH_TABLE oldTable 
)
static

Definition at line 5889 of file xmlparse.cc.

5893{
5894 HASH_TABLE_ITER iter;
5895 const XML_Char *cachedOldBase = NULL;
5896 const XML_Char *cachedNewBase = NULL;
5897
5898 hashTableIterInit(&iter, oldTable);
5899
5900 for (;;) {
5901 ENTITY *newE;
5902 const XML_Char *name;
5903 const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
5904 if (!oldE)
5905 break;
5906 name = poolCopyString(newPool, oldE->name);
5907 if (!name)
5908 return 0;
5909 newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY));
5910 if (!newE)
5911 return 0;
5912 if (oldE->systemId) {
5913 const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
5914 if (!tem)
5915 return 0;
5916 newE->systemId = tem;
5917 if (oldE->base) {
5918 if (oldE->base == cachedOldBase)
5919 newE->base = cachedNewBase;
5920 else {
5921 cachedOldBase = oldE->base;
5922 tem = poolCopyString(newPool, cachedOldBase);
5923 if (!tem)
5924 return 0;
5925 cachedNewBase = newE->base = tem;
5926 }
5927 }
5928 if (oldE->publicId) {
5929 tem = poolCopyString(newPool, oldE->publicId);
5930 if (!tem)
5931 return 0;
5932 newE->publicId = tem;
5933 }
5934 }
5935 else {
5936 const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr,
5937 oldE->textLen);
5938 if (!tem)
5939 return 0;
5940 newE->textPtr = tem;
5941 newE->textLen = oldE->textLen;
5942 }
5943 if (oldE->notation) {
5944 const XML_Char *tem = poolCopyString(newPool, oldE->notation);
5945 if (!tem)
5946 return 0;
5947 newE->notation = tem;
5948 }
5949 newE->is_param = oldE->is_param;
5950 newE->is_internal = oldE->is_internal;
5951 }
5952 return 1;
5953}
const XML_Char * base
Definition: xmlparse.cc:203
const XML_Char * publicId
Definition: xmlparse.cc:204
XML_Bool is_param
Definition: xmlparse.cc:207
const XML_Char * systemId
Definition: xmlparse.cc:202
const XML_Char * name
Definition: xmlparse.cc:198
static NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *)
Definition: xmlparse.cc:6092
static const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool, const XML_Char *s)
Definition: xmlparse.cc:6167
static const XML_Char * poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)
Definition: xmlparse.cc:6179
static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *)
Definition: xmlparse.cc:6085

References ENTITY::base, hashTableIterInit(), hashTableIterNext(), ENTITY::is_internal, ENTITY::is_param, lookup(), ENTITY::name, G4InuclParticleNames::name(), ENTITY::notation, poolCopyString(), poolCopyStringN(), ENTITY::publicId, ENTITY::systemId, ENTITY::textLen, and ENTITY::textPtr.

Referenced by dtdCopy().

◆ defineAttribute()

static int defineAttribute ( ELEMENT_TYPE type,
ATTRIBUTE_ID attId,
XML_Bool  isCdata,
XML_Bool  isId,
const XML_Char dfltValue,
XML_Parser  parser 
)
static

Definition at line 5362 of file xmlparse.cc.

5364{
5365 DEFAULT_ATTRIBUTE *att;
5366 if (value || isId) {
5367 /* The handling of default attributes gets messed up if we have
5368 a default which duplicates a non-default. */
5369 int i;
5370 for (i = 0; i < type->nDefaultAtts; i++)
5371 if (attId == type->defaultAtts[i].id)
5372 return 1;
5373 if (isId && !type->idAtt && !attId->xmlns)
5374 type->idAtt = attId;
5375 }
5376 if (type->nDefaultAtts == type->allocDefaultAtts) {
5377 if (type->allocDefaultAtts == 0) {
5378 type->allocDefaultAtts = 8;
5380 * sizeof(DEFAULT_ATTRIBUTE));
5381 if (!type->defaultAtts)
5382 return 0;
5383 }
5384 else {
5385 DEFAULT_ATTRIBUTE *temp;
5386 int count = type->allocDefaultAtts * 2;
5387 temp = (DEFAULT_ATTRIBUTE *)
5388 REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE)));
5389 if (temp == NULL)
5390 return 0;
5391 type->allocDefaultAtts = count;
5392 type->defaultAtts = temp;
5393 }
5394 }
5395 att = type->defaultAtts + type->nDefaultAtts;
5396 att->id = attId;
5397 att->value = value;
5398 att->isCdata = isCdata;
5399 if (!isCdata)
5400 attId->maybeTokenized = XML_TRUE;
5401 type->nDefaultAtts += 1;
5402 return 1;
5403}
XML_Bool isCdata
Definition: xmlparse.cc:249
const ATTRIBUTE_ID * id
Definition: xmlparse.cc:248
const XML_Char * value
Definition: xmlparse.cc:250
int nDefaultAtts
Definition: xmlparse.cc:263
int allocDefaultAtts
Definition: xmlparse.cc:264
DEFAULT_ATTRIBUTE * defaultAtts
Definition: xmlparse.cc:265
const ATTRIBUTE_ID * idAtt
Definition: xmlparse.cc:262
XML_Bool xmlns
Definition: xmlparse.cc:244
XML_Bool maybeTokenized
Definition: xmlparse.cc:243

References ELEMENT_TYPE::allocDefaultAtts, ELEMENT_TYPE::defaultAtts, DEFAULT_ATTRIBUTE::id, ELEMENT_TYPE::idAtt, DEFAULT_ATTRIBUTE::isCdata, MALLOC, attribute_id::maybeTokenized, ELEMENT_TYPE::nDefaultAtts, REALLOC, DEFAULT_ATTRIBUTE::value, XML_TRUE, and attribute_id::xmlns.

Referenced by doProlog().

◆ destroyBindings()

static void FASTCALL destroyBindings ( BINDING bindings,
XML_Parser  parser 
)
static

Definition at line 1123 of file xmlparse.cc.

1124{
1125 for (;;) {
1126 BINDING *b = bindings;
1127 if (!b)
1128 break;
1129 bindings = b->nextTagBinding;
1130 FREE(b->uri);
1131 FREE(b);
1132 }
1133}

References FREE, binding::nextTagBinding, and binding::uri.

Referenced by XML_ParserFree().

◆ doCdataSection()

static enum XML_Error doCdataSection ( XML_Parser  parser,
const ENCODING enc,
const char **  startPtr,
const char *  end,
const char **  nextPtr,
XML_Bool  haveMore 
)
static

Definition at line 3199 of file xmlparse.cc.

3205{
3206 const char *s = *startPtr;
3207 const char **eventPP;
3208 const char **eventEndPP;
3209 if (enc == encoding) {
3210 eventPP = &eventPtr;
3211 *eventPP = s;
3212 eventEndPP = &eventEndPtr;
3213 }
3214 else {
3215 eventPP = &(openInternalEntities->internalEventPtr);
3216 eventEndPP = &(openInternalEntities->internalEventEndPtr);
3217 }
3218 *eventPP = s;
3219 *startPtr = NULL;
3220
3221 for (;;) {
3222 const char *next;
3223 int tok = XmlCdataSectionTok(enc, s, end, &next);
3224 *eventEndPP = next;
3225 switch (tok) {
3229#if 0
3230 /* see comment under XML_TOK_CDATA_SECT_OPEN */
3231 else if (characterDataHandler)
3233#endif
3234 else if (defaultHandler)
3235 reportDefault(parser, enc, s, next);
3236 *startPtr = next;
3237 *nextPtr = next;
3238 if (ps_parsing == XML_FINISHED)
3239 return XML_ERROR_ABORTED;
3240 else
3241 return XML_ERROR_NONE;
3244 XML_Char c = 0xA;
3246 }
3247 else if (defaultHandler)
3248 reportDefault(parser, enc, s, next);
3249 break;
3250 case XML_TOK_DATA_CHARS:
3251 {
3253 if (charDataHandler) {
3254 if (MUST_CONVERT(enc, s)) {
3255 for (;;) {
3256 ICHAR *dataPtr = (ICHAR *)dataBuf;
3257 XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
3258 *eventEndPP = next;
3259 charDataHandler(handlerArg, dataBuf,
3260 (int)(dataPtr - (ICHAR *)dataBuf));
3261 if (s == next)
3262 break;
3263 *eventPP = s;
3264 }
3265 }
3266 else
3267 charDataHandler(handlerArg,
3268 (XML_Char *)s,
3269 (int)((XML_Char *)next - (XML_Char *)s));
3270 }
3271 else if (defaultHandler)
3272 reportDefault(parser, enc, s, next);
3273 }
3274 break;
3275 case XML_TOK_INVALID:
3276 *eventPP = next;
3279 if (haveMore) {
3280 *nextPtr = s;
3281 return XML_ERROR_NONE;
3282 }
3284 case XML_TOK_PARTIAL:
3285 case XML_TOK_NONE:
3286 if (haveMore) {
3287 *nextPtr = s;
3288 return XML_ERROR_NONE;
3289 }
3291 default:
3292 *eventPP = next;
3294 }
3295
3296 *eventPP = s = next;
3297 switch (ps_parsing) {
3298 case XML_SUSPENDED:
3299 *nextPtr = next;
3300 return XML_ERROR_NONE;
3301 case XML_FINISHED:
3302 return XML_ERROR_ABORTED;
3303 default: ;
3304 }
3305 }
3306 /* not reached */
3307}
static constexpr double s
Definition: G4SIunits.hh:154
@ XML_SUSPENDED
Definition: expat.h:839
@ XML_FINISHED
Definition: expat.h:838
@ XML_ERROR_ABORTED
Definition: expat.h:92
@ XML_ERROR_PARTIAL_CHAR
Definition: expat.h:61
@ XML_ERROR_UNCLOSED_CDATA_SECTION
Definition: expat.h:75
void(XMLCALL * XML_CharacterDataHandler)(void *userData, const XML_Char *s, int len)
Definition: expat.h:261
#define endCdataSectionHandler
Definition: xmlparse.cc:582
#define XmlConvert
Definition: xmlparse.cc:45
#define dataBuf
Definition: xmlparse.cc:634
#define MUST_CONVERT(enc, s)
Definition: xmlparse.cc:49
#define defaultHandler
Definition: xmlparse.cc:583
#define ps_parsing
Definition: xmlparse.cc:667
static void reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
Definition: xmlparse.cc:5334
#define eventEndPtr
Definition: xmlparse.cc:620
#define dataBufEnd
Definition: xmlparse.cc:635
#define characterDataHandler
Definition: xmlparse.cc:576
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr)
Definition: xmltok.h:205
#define XML_TOK_PARTIAL_CHAR
Definition: xmltok.h:19
#define XML_TOK_CDATA_SECT_CLOSE
Definition: xmltok.h:77

References characterDataHandler, dataBuf, dataBufEnd, defaultHandler, endCdataSectionHandler, eventEndPtr, eventPtr, handlerArg, MUST_CONVERT, openInternalEntities, geant4_check_module_cycles::parser, ps_parsing, reportDefault(), s, XML_ERROR_ABORTED, XML_ERROR_INVALID_TOKEN, XML_ERROR_NONE, XML_ERROR_PARTIAL_CHAR, XML_ERROR_UNCLOSED_CDATA_SECTION, XML_ERROR_UNEXPECTED_STATE, XML_FINISHED, XML_SUSPENDED, XML_TOK_CDATA_SECT_CLOSE, XML_TOK_DATA_CHARS, XML_TOK_DATA_NEWLINE, XML_TOK_INVALID, XML_TOK_NONE, XML_TOK_PARTIAL, XML_TOK_PARTIAL_CHAR, XmlCdataSectionTok, and XmlConvert.

Referenced by cdataSectionProcessor(), and doContent().

◆ doContent()

static enum XML_Error doContent ( XML_Parser  parser,
int  startTagLevel,
const ENCODING enc,
const char *  start,
const char *  end,
const char **  endPtr,
XML_Bool  haveMore 
)
static

Definition at line 2237 of file xmlparse.cc.

2244{
2245 /* save one level of indirection */
2246 DTD * const dtd = _dtd;
2247
2248 const char **eventPP;
2249 const char **eventEndPP;
2250 if (enc == encoding) {
2251 eventPP = &eventPtr;
2252 eventEndPP = &eventEndPtr;
2253 }
2254 else {
2255 eventPP = &(openInternalEntities->internalEventPtr);
2256 eventEndPP = &(openInternalEntities->internalEventEndPtr);
2257 }
2258 *eventPP = s;
2259
2260 for (;;) {
2261 const char *next = s; /* XmlContentTok doesn't always set the last arg */
2262 int tok = XmlContentTok(enc, s, end, &next);
2263 *eventEndPP = next;
2264 switch (tok) {
2266 if (haveMore) {
2267 *nextPtr = s;
2268 return XML_ERROR_NONE;
2269 }
2270 *eventEndPP = end;
2272 XML_Char c = 0xA;
2274 }
2275 else if (defaultHandler)
2276 reportDefault(parser, enc, s, end);
2277 /* We are at the end of the final buffer, should we check for
2278 XML_SUSPENDED, XML_FINISHED?
2279 */
2280 if (startTagLevel == 0)
2281 return XML_ERROR_NO_ELEMENTS;
2282 if (tagLevel != startTagLevel)
2284 *nextPtr = end;
2285 return XML_ERROR_NONE;
2286 case XML_TOK_NONE:
2287 if (haveMore) {
2288 *nextPtr = s;
2289 return XML_ERROR_NONE;
2290 }
2291 if (startTagLevel > 0) {
2292 if (tagLevel != startTagLevel)
2294 *nextPtr = s;
2295 return XML_ERROR_NONE;
2296 }
2297 return XML_ERROR_NO_ELEMENTS;
2298 case XML_TOK_INVALID:
2299 *eventPP = next;
2301 case XML_TOK_PARTIAL:
2302 if (haveMore) {
2303 *nextPtr = s;
2304 return XML_ERROR_NONE;
2305 }
2308 if (haveMore) {
2309 *nextPtr = s;
2310 return XML_ERROR_NONE;
2311 }
2313 case XML_TOK_ENTITY_REF:
2314 {
2315 const XML_Char *name;
2316 ENTITY *entity;
2318 s + enc->minBytesPerChar,
2319 next - enc->minBytesPerChar);
2320 if (ch) {
2323 else if (defaultHandler)
2324 reportDefault(parser, enc, s, next);
2325 break;
2326 }
2327 name = poolStoreString(&dtd->pool, enc,
2328 s + enc->minBytesPerChar,
2329 next - enc->minBytesPerChar);
2330 if (!name)
2331 return XML_ERROR_NO_MEMORY;
2332 entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0);
2333 poolDiscard(&dtd->pool);
2334 /* First, determine if a check for an existing declaration is needed;
2335 if yes, check that the entity exists, and that it is internal,
2336 otherwise call the skipped entity or default handler.
2337 */
2338 if (!dtd->hasParamEntityRefs || dtd->standalone) {
2339 if (!entity)
2341 else if (!entity->is_internal)
2343 }
2344 else if (!entity) {
2347 else if (defaultHandler)
2348 reportDefault(parser, enc, s, next);
2349 break;
2350 }
2351 if (entity->open)
2353 if (entity->notation)
2355 if (entity->textPtr) {
2356 enum XML_Error result;
2360 else if (defaultHandler)
2361 reportDefault(parser, enc, s, next);
2362 break;
2363 }
2364 result = processInternalEntity(parser, entity, XML_FALSE);
2365 if (result != XML_ERROR_NONE)
2366 return result;
2367 }
2368 else if (externalEntityRefHandler) {
2369 const XML_Char *context;
2370 entity->open = XML_TRUE;
2372 entity->open = XML_FALSE;
2373 if (!context)
2374 return XML_ERROR_NO_MEMORY;
2376 context,
2377 entity->base,
2378 entity->systemId,
2379 entity->publicId))
2382 }
2383 else if (defaultHandler)
2384 reportDefault(parser, enc, s, next);
2385 break;
2386 }
2388 /* fall through */
2390 {
2391 TAG *tag;
2392 enum XML_Error result;
2393 XML_Char *toPtr;
2394 if (freeTagList) {
2395 tag = freeTagList;
2396 freeTagList = freeTagList->parent;
2397 }
2398 else {
2399 tag = (TAG *)MALLOC(sizeof(TAG));
2400 if (!tag)
2401 return XML_ERROR_NO_MEMORY;
2402 tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE);
2403 if (!tag->buf) {
2404 FREE(tag);
2405 return XML_ERROR_NO_MEMORY;
2406 }
2408 }
2409 tag->bindings = NULL;
2410 tag->parent = tagStack;
2411 tagStack = tag;
2412 tag->name.localPart = NULL;
2413 tag->name.prefix = NULL;
2414 tag->rawName = s + enc->minBytesPerChar;
2416 ++tagLevel;
2417 {
2418 const char *rawNameEnd = tag->rawName + tag->rawNameLength;
2419 const char *fromPtr = tag->rawName;
2420 toPtr = (XML_Char *)tag->buf;
2421 for (;;) {
2422 int bufSize;
2423 int convLen;
2424 XmlConvert(enc,
2425 &fromPtr, rawNameEnd,
2426 (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
2427 convLen = (int)(toPtr - (XML_Char *)tag->buf);
2428 if (fromPtr == rawNameEnd) {
2429 tag->name.strLen = convLen;
2430 break;
2431 }
2432 bufSize = (int)(tag->bufEnd - tag->buf) << 1;
2433 {
2434 char *temp = (char *)REALLOC(tag->buf, bufSize);
2435 if (temp == NULL)
2436 return XML_ERROR_NO_MEMORY;
2437 tag->buf = temp;
2438 tag->bufEnd = temp + bufSize;
2439 toPtr = (XML_Char *)temp + convLen;
2440 }
2441 }
2442 }
2443 tag->name.str = (XML_Char *)tag->buf;
2444 *toPtr = XML_T('\0');
2445 result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
2446 if (result)
2447 return result;
2450 (const XML_Char **)atts);
2451 else if (defaultHandler)
2452 reportDefault(parser, enc, s, next);
2454 break;
2455 }
2457 /* fall through */
2459 {
2460 const char *rawName = s + enc->minBytesPerChar;
2461 enum XML_Error result;
2462 BINDING *bindings = NULL;
2463 XML_Bool noElmHandlers = XML_TRUE;
2464 TAG_NAME name;
2465 name.str = poolStoreString(&tempPool, enc, rawName,
2466 rawName + XmlNameLength(enc, rawName));
2467 if (!name.str)
2468 return XML_ERROR_NO_MEMORY;
2470 result = storeAtts(parser, enc, s, &name, &bindings);
2471 if (result)
2472 return result;
2474 if (startElementHandler) {
2476 noElmHandlers = XML_FALSE;
2477 }
2478 if (endElementHandler) {
2480 *eventPP = *eventEndPP;
2482 noElmHandlers = XML_FALSE;
2483 }
2484 if (noElmHandlers && defaultHandler)
2485 reportDefault(parser, enc, s, next);
2487 while (bindings) {
2488 BINDING *b = bindings;
2491 bindings = bindings->nextTagBinding;
2493 freeBindingList = b;
2495 }
2496 }
2497 if (tagLevel == 0)
2498 return epilogProcessor(parser, next, end, nextPtr);
2499 break;
2500 case XML_TOK_END_TAG:
2501 if (tagLevel == startTagLevel)
2503 else {
2504 int len;
2505 const char *rawName;
2506 TAG *tag = tagStack;
2507 tagStack = tag->parent;
2509 freeTagList = tag;
2510 rawName = s + enc->minBytesPerChar*2;
2511 len = XmlNameLength(enc, rawName);
2512 if (len != tag->rawNameLength
2513 || memcmp(tag->rawName, rawName, len) != 0) {
2514 *eventPP = rawName;
2516 }
2517 --tagLevel;
2518 if (endElementHandler) {
2519 const XML_Char *localPart;
2520 const XML_Char *prefix;
2521 XML_Char *uri;
2522 localPart = tag->name.localPart;
2523 if (ns && localPart) {
2524 /* localPart and prefix may have been overwritten in
2525 tag->name.str, since this points to the binding->uri
2526 buffer which gets re-used; so we have to add them again
2527 */
2528 uri = (XML_Char *)tag->name.str + tag->name.uriLen;
2529 /* don't need to check for space - already done in storeAtts() */
2530 while (*localPart) *uri++ = *localPart++;
2532 if (ns_triplets && prefix) {
2533 *uri++ = namespaceSeparator;
2534 while (*prefix) *uri++ = *prefix++;
2535 }
2536 *uri = XML_T('\0');
2537 }
2539 }
2540 else if (defaultHandler)
2541 reportDefault(parser, enc, s, next);
2542 while (tag->bindings) {
2543 BINDING *b = tag->bindings;
2548 freeBindingList = b;
2550 }
2551 if (tagLevel == 0)
2552 return epilogProcessor(parser, next, end, nextPtr);
2553 }
2554 break;
2555 case XML_TOK_CHAR_REF:
2556 {
2557 int n = XmlCharRefNumber(enc, s);
2558 if (n < 0)
2563 }
2564 else if (defaultHandler)
2565 reportDefault(parser, enc, s, next);
2566 }
2567 break;
2568 case XML_TOK_XML_DECL:
2572 XML_Char c = 0xA;
2574 }
2575 else if (defaultHandler)
2576 reportDefault(parser, enc, s, next);
2577 break;
2579 {
2580 enum XML_Error result;
2583#if 0
2584 /* Suppose you doing a transformation on a document that involves
2585 changing only the character data. You set up a defaultHandler
2586 and a characterDataHandler. The defaultHandler simply copies
2587 characters through. The characterDataHandler does the
2588 transformation and writes the characters out escaping them as
2589 necessary. This case will fail to work if we leave out the
2590 following two lines (because & and < inside CDATA sections will
2591 be incorrectly escaped).
2592
2593 However, now we have a start/endCdataSectionHandler, so it seems
2594 easier to let the user deal with this.
2595 */
2596 else if (characterDataHandler)
2598#endif
2599 else if (defaultHandler)
2600 reportDefault(parser, enc, s, next);
2601 result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
2602 if (result != XML_ERROR_NONE)
2603 return result;
2604 else if (!next) {
2606 return result;
2607 }
2608 }
2609 break;
2611 if (haveMore) {
2612 *nextPtr = s;
2613 return XML_ERROR_NONE;
2614 }
2616 if (MUST_CONVERT(enc, s)) {
2617 ICHAR *dataPtr = (ICHAR *)dataBuf;
2618 XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
2620 (int)(dataPtr - (ICHAR *)dataBuf));
2621 }
2622 else
2624 (XML_Char *)s,
2625 (int)((XML_Char *)end - (XML_Char *)s));
2626 }
2627 else if (defaultHandler)
2628 reportDefault(parser, enc, s, end);
2629 /* We are at the end of the final buffer, should we check for
2630 XML_SUSPENDED, XML_FINISHED?
2631 */
2632 if (startTagLevel == 0) {
2633 *eventPP = end;
2634 return XML_ERROR_NO_ELEMENTS;
2635 }
2636 if (tagLevel != startTagLevel) {
2637 *eventPP = end;
2639 }
2640 *nextPtr = end;
2641 return XML_ERROR_NONE;
2642 case XML_TOK_DATA_CHARS:
2643 {
2645 if (charDataHandler) {
2646 if (MUST_CONVERT(enc, s)) {
2647 for (;;) {
2648 ICHAR *dataPtr = (ICHAR *)dataBuf;
2649 XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
2650 *eventEndPP = s;
2651 charDataHandler(handlerArg, dataBuf,
2652 (int)(dataPtr - (ICHAR *)dataBuf));
2653 if (s == next)
2654 break;
2655 *eventPP = s;
2656 }
2657 }
2658 else
2659 charDataHandler(handlerArg,
2660 (XML_Char *)s,
2661 (int)((XML_Char *)next - (XML_Char *)s));
2662 }
2663 else if (defaultHandler)
2664 reportDefault(parser, enc, s, next);
2665 }
2666 break;
2667 case XML_TOK_PI:
2668 if (!reportProcessingInstruction(parser, enc, s, next))
2669 return XML_ERROR_NO_MEMORY;
2670 break;
2671 case XML_TOK_COMMENT:
2672 if (!reportComment(parser, enc, s, next))
2673 return XML_ERROR_NO_MEMORY;
2674 break;
2675 default:
2676 if (defaultHandler)
2677 reportDefault(parser, enc, s, next);
2678 break;
2679 }
2680 *eventPP = s = next;
2681 switch (ps_parsing) {
2682 case XML_SUSPENDED:
2683 *nextPtr = next;
2684 return XML_ERROR_NONE;
2685 case XML_FINISHED:
2686 return XML_ERROR_ABORTED;
2687 default: ;
2688 }
2689 }
2690 /* not reached */
2691}
@ XML_ERROR_UNCLOSED_TOKEN
Definition: expat.h:60
@ XML_ERROR_ASYNC_ENTITY
Definition: expat.h:68
@ XML_ERROR_NO_ELEMENTS
Definition: expat.h:58
@ XML_ERROR_EXTERNAL_ENTITY_HANDLING
Definition: expat.h:76
@ XML_ERROR_MISPLACED_XML_PI
Definition: expat.h:72
@ XML_ERROR_TAG_MISMATCH
Definition: expat.h:62
context
Definition: g4zmq.py:11
int strLen
Definition: xmlparse.cc:169
const XML_Char * localPart
Definition: xmlparse.cc:167
const XML_Char * str
Definition: xmlparse.cc:166
const XML_Char * prefix
Definition: xmlparse.cc:168
int uriLen
Definition: xmlparse.cc:170
Definition: xmlparse.cc:187
struct tag * parent
Definition: xmlparse.cc:188
int rawNameLength
Definition: xmlparse.cc:190
BINDING * bindings
Definition: xmlparse.cc:194
char * buf
Definition: xmlparse.cc:192
const char * rawName
Definition: xmlparse.cc:189
char * bufEnd
Definition: xmlparse.cc:193
TAG_NAME name
Definition: xmlparse.cc:191
#define externalEntityRefHandlerArg
Definition: xmlparse.cc:595
#define defaultExpandInternalEntities
Definition: xmlparse.cc:625
#define tagStack
Definition: xmlparse.cc:652
#define skippedEntityHandler
Definition: xmlparse.cc:599
static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
Definition: xmlparse.cc:5283
#define tempPool
Definition: xmlparse.cc:661
static Processor epilogProcessor
Definition: xmlparse.cc:322
#define atts
Definition: xmlparse.cc:653
#define startCdataSectionHandler
Definition: xmlparse.cc:580
#define externalEntityRefHandler
Definition: xmlparse.cc:593
#define endElementHandler
Definition: xmlparse.cc:575
#define ns_triplets
Definition: xmlparse.cc:615
#define INIT_TAG_BUF_SIZE
Definition: xmlparse.cc:141
#define tagLevel
Definition: xmlparse.cc:627
static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
Definition: xmlparse.cc:5312
#define startElementHandler
Definition: xmlparse.cc:574
static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr)
Definition: xmlparse.cc:2704
#define poolFinish(pool)
Definition: xmlparse.cc:459
#define ns
Definition: xmlparse.cc:614
static void FASTCALL poolClear(STRING_POOL *)
Definition: xmlparse.cc:6114
#define endNamespaceDeclHandler
Definition: xmlparse.cc:591
static Processor cdataSectionProcessor
Definition: xmlparse.cc:314
#define freeTagList
Definition: xmlparse.cc:649
static const XML_Char * getContext(XML_Parser parser)
Definition: xmlparse.cc:5499
static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl)
Definition: xmlparse.cc:4801
#define XML_TOK_PI
Definition: xmltok.h:40
#define XmlNameLength(enc, ptr)
Definition: xmltok.h:232
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS
Definition: xmltok.h:29
#define XmlContentTok(enc, ptr, end, nextTokPtr)
Definition: xmltok.h:202
#define XML_TOK_END_TAG
Definition: xmltok.h:30
#define XML_TOK_COMMENT
Definition: xmltok.h:42
#define XML_TOK_XML_DECL
Definition: xmltok.h:41
#define XML_TOK_START_TAG_WITH_ATTS
Definition: xmltok.h:26
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS
Definition: xmltok.h:28
#define XML_TOK_TRAILING_RSQB
Definition: xmltok.h:13
#define XML_TOK_START_TAG_NO_ATTS
Definition: xmltok.h:27
#define XML_TOK_CDATA_SECT_OPEN
Definition: xmltok.h:33

References _dtd, atts, ENTITY::base, prefix::binding, tag::bindings, tag::buf, tag::bufEnd, cdataSectionProcessor, characterDataHandler, g4zmq::context, dataBuf, dataBufEnd, defaultExpandInternalEntities, defaultHandler, doCdataSection(), endElementHandler, endNamespaceDeclHandler, epilogProcessor, eventEndPtr, eventPtr, externalEntityRefHandler, externalEntityRefHandlerArg, FREE, freeBindingList, freeTagList, DTD::generalEntities, getContext(), handlerArg, DTD::hasParamEntityRefs, INIT_TAG_BUF_SIZE, ENTITY::is_internal, TAG_NAME::localPart, lookup(), MALLOC, encoding::minBytesPerChar, MUST_CONVERT, CLHEP::detail::n, prefix::name, tag::name, ENTITY::name, G4InuclParticleNames::name(), namespaceSeparator, binding::nextTagBinding, ENTITY::notation, ns, ns_triplets, ENTITY::open, openInternalEntities, tag::parent, geant4_check_module_cycles::parser, DTD::pool, poolClear(), poolDiscard, poolFinish, poolStoreString(), binding::prefix, TAG_NAME::prefix, binding::prevPrefixBinding, processInternalEntity(), processor, ps_parsing, ENTITY::publicId, tag::rawName, tag::rawNameLength, REALLOC, reportComment(), reportDefault(), reportProcessingInstruction(), s, skippedEntityHandler, DTD::standalone, startCdataSectionHandler, startElementHandler, storeAtts(), TAG_NAME::str, TAG_NAME::strLen, ENTITY::systemId, tagLevel, tagStack, tempPool, ENTITY::textPtr, TAG_NAME::uriLen, XML_ENCODE_MAX, XML_ERROR_ABORTED, XML_ERROR_ASYNC_ENTITY, XML_ERROR_BAD_CHAR_REF, XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_ENTITY_DECLARED_IN_PE, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_INVALID_TOKEN, XML_ERROR_MISPLACED_XML_PI, XML_ERROR_NO_ELEMENTS, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_PARTIAL_CHAR, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_TAG_MISMATCH, XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_UNDEFINED_ENTITY, XML_FALSE, XML_FINISHED, XML_SUSPENDED, XML_T, XML_TOK_CDATA_SECT_OPEN, XML_TOK_CHAR_REF, XML_TOK_COMMENT, XML_TOK_DATA_CHARS, XML_TOK_DATA_NEWLINE, XML_TOK_EMPTY_ELEMENT_NO_ATTS, XML_TOK_EMPTY_ELEMENT_WITH_ATTS, XML_TOK_END_TAG, XML_TOK_ENTITY_REF, XML_TOK_INVALID, XML_TOK_NONE, XML_TOK_PARTIAL, XML_TOK_PARTIAL_CHAR, XML_TOK_PI, XML_TOK_START_TAG_NO_ATTS, XML_TOK_START_TAG_WITH_ATTS, XML_TOK_TRAILING_CR, XML_TOK_TRAILING_RSQB, XML_TOK_XML_DECL, XML_TRUE, XmlCharRefNumber, XmlContentTok, XmlConvert, XmlEncode, XmlNameLength, and XmlPredefinedEntityName.

Referenced by contentProcessor(), externalEntityContentProcessor(), internalEntityProcessor(), and processInternalEntity().

◆ doProlog()

static enum XML_Error doProlog ( XML_Parser  parser,
const ENCODING enc,
const char *  s,
const char *  end,
int  tok,
const char *  next,
const char **  nextPtr,
XML_Bool  haveMore 
)
static

Definition at line 3750 of file xmlparse.cc.

3758{
3759#ifdef XML_DTD
3760 static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' };
3761#endif /* XML_DTD */
3762 static const XML_Char atypeCDATA[] =
3763 { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
3764 static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' };
3765 static const XML_Char atypeIDREF[] =
3766 { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
3767 static const XML_Char atypeIDREFS[] =
3769 static const XML_Char atypeENTITY[] =
3771 static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N,
3773 static const XML_Char atypeNMTOKEN[] = {
3775 static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T,
3777 static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T,
3779 static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' };
3780 static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' };
3781
3782 /* save one level of indirection */
3783 DTD * const dtd = _dtd;
3784
3785 const char **eventPP;
3786 const char **eventEndPP;
3787 enum XML_Content_Quant quant;
3788
3789 if (enc == encoding) {
3790 eventPP = &eventPtr;
3791 eventEndPP = &eventEndPtr;
3792 }
3793 else {
3794 eventPP = &(openInternalEntities->internalEventPtr);
3795 eventEndPP = &(openInternalEntities->internalEventEndPtr);
3796 }
3797
3798 for (;;) {
3799 int role;
3800 XML_Bool handleDefault = XML_TRUE;
3801 *eventPP = s;
3802 *eventEndPP = next;
3803 if (tok <= 0) {
3804 if (haveMore && tok != XML_TOK_INVALID) {
3805 *nextPtr = s;
3806 return XML_ERROR_NONE;
3807 }
3808 switch (tok) {
3809 case XML_TOK_INVALID:
3810 *eventPP = next;
3812 case XML_TOK_PARTIAL:
3816 case -XML_TOK_PROLOG_S:
3817 tok = -tok;
3818 break;
3819 case XML_TOK_NONE:
3820#ifdef XML_DTD
3821 /* for internal PE NOT referenced between declarations */
3822 if (enc != encoding && !openInternalEntities->betweenDecl) {
3823 *nextPtr = s;
3824 return XML_ERROR_NONE;
3825 }
3826 /* WFC: PE Between Declarations - must check that PE contains
3827 complete markup, not only for external PEs, but also for
3828 internal PEs if the reference occurs between declarations.
3829 */
3830 if (isParamEntity || enc != encoding) {
3831 if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc)
3832 == XML_ROLE_ERROR)
3834 *nextPtr = s;
3835 return XML_ERROR_NONE;
3836 }
3837#endif /* XML_DTD */
3838 return XML_ERROR_NO_ELEMENTS;
3839 default:
3840 tok = -tok;
3841 next = end;
3842 break;
3843 }
3844 }
3845 role = XmlTokenRole(&prologState, tok, s, next, enc);
3846 switch (role) {
3847 case XML_ROLE_XML_DECL:
3848 {
3849 enum XML_Error result = processXmlDecl(parser, 0, s, next);
3850 if (result != XML_ERROR_NONE)
3851 return result;
3852 enc = encoding;
3853 handleDefault = XML_FALSE;
3854 }
3855 break;
3858 doctypeName = poolStoreString(&tempPool, enc, s, next);
3859 if (!doctypeName)
3860 return XML_ERROR_NO_MEMORY;
3862 doctypePubid = NULL;
3863 handleDefault = XML_FALSE;
3864 }
3865 doctypeSysid = NULL; /* always initialize to NULL */
3866 break;
3870 doctypePubid, 1);
3871 doctypeName = NULL;
3873 handleDefault = XML_FALSE;
3874 }
3875 break;
3876#ifdef XML_DTD
3877 case XML_ROLE_TEXT_DECL:
3878 {
3879 enum XML_Error result = processXmlDecl(parser, 1, s, next);
3880 if (result != XML_ERROR_NONE)
3881 return result;
3882 enc = encoding;
3883 handleDefault = XML_FALSE;
3884 }
3885 break;
3886#endif /* XML_DTD */
3888#ifdef XML_DTD
3889 useForeignDTD = XML_FALSE;
3891 &dtd->paramEntities,
3892 externalSubsetName,
3893 sizeof(ENTITY));
3894 if (!declEntity)
3895 return XML_ERROR_NO_MEMORY;
3896#endif /* XML_DTD */
3899 XML_Char *pubId;
3900 if (!XmlIsPublicId(enc, s, next, eventPP))
3901 return XML_ERROR_PUBLICID;
3902 pubId = poolStoreString(&tempPool, enc,
3903 s + enc->minBytesPerChar,
3904 next - enc->minBytesPerChar);
3905 if (!pubId)
3906 return XML_ERROR_NO_MEMORY;
3907 normalizePublicId(pubId);
3909 doctypePubid = pubId;
3910 handleDefault = XML_FALSE;
3911 goto alreadyChecked;
3912 }
3913 /* fall through */
3915 if (!XmlIsPublicId(enc, s, next, eventPP))
3916 return XML_ERROR_PUBLICID;
3917 alreadyChecked:
3918 if (dtd->keepProcessing && declEntity) {
3919 XML_Char *tem = poolStoreString(&dtd->pool,
3920 enc,
3921 s + enc->minBytesPerChar,
3922 next - enc->minBytesPerChar);
3923 if (!tem)
3924 return XML_ERROR_NO_MEMORY;
3925 normalizePublicId(tem);
3926 declEntity->publicId = tem;
3927 poolFinish(&dtd->pool);
3929 handleDefault = XML_FALSE;
3930 }
3931 break;
3933 if (doctypeName) {
3937 handleDefault = XML_FALSE;
3938 }
3939 /* doctypeSysid will be non-NULL in the case of a previous
3940 XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler
3941 was not set, indicating an external subset
3942 */
3943#ifdef XML_DTD
3944 if (doctypeSysid || useForeignDTD) {
3945 XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
3947 if (paramEntityParsing && externalEntityRefHandler) {
3948 ENTITY *entity = (ENTITY *)lookup(parser,
3949 &dtd->paramEntities,
3950 externalSubsetName,
3951 sizeof(ENTITY));
3952 if (!entity)
3953 return XML_ERROR_NO_MEMORY;
3954 if (useForeignDTD)
3955 entity->base = curBase;
3956 dtd->paramEntityRead = XML_FALSE;
3958 0,
3959 entity->base,
3960 entity->systemId,
3961 entity->publicId))
3963 if (dtd->paramEntityRead) {
3964 if (!dtd->standalone &&
3968 }
3969 /* if we didn't read the foreign DTD then this means that there
3970 is no external subset and we must reset dtd->hasParamEntityRefs
3971 */
3972 else if (!doctypeSysid)
3973 dtd->hasParamEntityRefs = hadParamEntityRefs;
3974 /* end of DTD - no need to update dtd->keepProcessing */
3975 }
3976 useForeignDTD = XML_FALSE;
3977 }
3978#endif /* XML_DTD */
3981 handleDefault = XML_FALSE;
3982 }
3983 break;
3985#ifdef XML_DTD
3986 /* if there is no DOCTYPE declaration then now is the
3987 last chance to read the foreign DTD
3988 */
3989 if (useForeignDTD) {
3990 XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
3992 if (paramEntityParsing && externalEntityRefHandler) {
3993 ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities,
3994 externalSubsetName,
3995 sizeof(ENTITY));
3996 if (!entity)
3997 return XML_ERROR_NO_MEMORY;
3998 entity->base = curBase;
3999 dtd->paramEntityRead = XML_FALSE;
4001 0,
4002 entity->base,
4003 entity->systemId,
4004 entity->publicId))
4006 if (dtd->paramEntityRead) {
4007 if (!dtd->standalone &&
4011 }
4012 /* if we didn't read the foreign DTD then this means that there
4013 is no external subset and we must reset dtd->hasParamEntityRefs
4014 */
4015 else
4016 dtd->hasParamEntityRefs = hadParamEntityRefs;
4017 /* end of DTD - no need to update dtd->keepProcessing */
4018 }
4019 }
4020#endif /* XML_DTD */
4022 return contentProcessor(parser, s, end, nextPtr);
4024 declElementType = getElementType(parser, enc, s, next);
4025 if (!declElementType)
4026 return XML_ERROR_NO_MEMORY;
4027 goto checkAttListDeclHandler;
4029 declAttributeId = getAttributeId(parser, enc, s, next);
4030 if (!declAttributeId)
4031 return XML_ERROR_NO_MEMORY;
4033 declAttributeType = NULL;
4035 goto checkAttListDeclHandler;
4038 declAttributeType = atypeCDATA;
4039 goto checkAttListDeclHandler;
4042 declAttributeType = atypeID;
4043 goto checkAttListDeclHandler;
4045 declAttributeType = atypeIDREF;
4046 goto checkAttListDeclHandler;
4048 declAttributeType = atypeIDREFS;
4049 goto checkAttListDeclHandler;
4051 declAttributeType = atypeENTITY;
4052 goto checkAttListDeclHandler;
4054 declAttributeType = atypeENTITIES;
4055 goto checkAttListDeclHandler;
4057 declAttributeType = atypeNMTOKEN;
4058 goto checkAttListDeclHandler;
4060 declAttributeType = atypeNMTOKENS;
4061 checkAttListDeclHandler:
4063 handleDefault = XML_FALSE;
4064 break;
4067 if (dtd->keepProcessing && attlistDeclHandler) {
4068 const XML_Char *prefix;
4069 if (declAttributeType) {
4070 prefix = enumValueSep;
4071 }
4072 else {
4074 ? notationPrefix
4075 : enumValueStart);
4076 }
4078 return XML_ERROR_NO_MEMORY;
4079 if (!poolAppend(&tempPool, enc, s, next))
4080 return XML_ERROR_NO_MEMORY;
4082 handleDefault = XML_FALSE;
4083 }
4084 break;
4087 if (dtd->keepProcessing) {
4090 0, parser))
4091 return XML_ERROR_NO_MEMORY;
4095 && declAttributeType[1] == XML_T(ASCII_O))) {
4096 /* Enumerated or Notation type */
4098 || !poolAppendChar(&tempPool, XML_T('\0')))
4099 return XML_ERROR_NO_MEMORY;
4102 }
4103 *eventEndPP = s;
4108 handleDefault = XML_FALSE;
4109 }
4110 }
4111 break;
4114 if (dtd->keepProcessing) {
4115 const XML_Char *attVal;
4116 enum XML_Error result =
4118 s + enc->minBytesPerChar,
4119 next - enc->minBytesPerChar,
4120 &dtd->pool);
4121 if (result)
4122 return result;
4123 attVal = poolStart(&dtd->pool);
4124 poolFinish(&dtd->pool);
4125 /* ID attributes aren't allowed to have a default */
4128 return XML_ERROR_NO_MEMORY;
4132 && declAttributeType[1] == XML_T(ASCII_O))) {
4133 /* Enumerated or Notation type */
4135 || !poolAppendChar(&tempPool, XML_T('\0')))
4136 return XML_ERROR_NO_MEMORY;
4139 }
4140 *eventEndPP = s;
4143 attVal,
4146 handleDefault = XML_FALSE;
4147 }
4148 }
4149 break;
4151 if (dtd->keepProcessing) {
4152 enum XML_Error result = storeEntityValue(parser, enc,
4153 s + enc->minBytesPerChar,
4154 next - enc->minBytesPerChar);
4155 if (declEntity) {
4156 declEntity->textPtr = poolStart(&dtd->entityValuePool);
4157 declEntity->textLen = (int)(poolLength(&dtd->entityValuePool));
4159 if (entityDeclHandler) {
4160 *eventEndPP = s;
4162 declEntity->name,
4163 declEntity->is_param,
4164 declEntity->textPtr,
4165 declEntity->textLen,
4166 curBase, 0, 0, 0);
4167 handleDefault = XML_FALSE;
4168 }
4169 }
4170 else
4172 if (result != XML_ERROR_NONE)
4173 return result;
4174 }
4175 break;
4177#ifdef XML_DTD
4178 useForeignDTD = XML_FALSE;
4179#endif /* XML_DTD */
4183 s + enc->minBytesPerChar,
4184 next - enc->minBytesPerChar);
4185 if (doctypeSysid == NULL)
4186 return XML_ERROR_NO_MEMORY;
4188 handleDefault = XML_FALSE;
4189 }
4190#ifdef XML_DTD
4191 else
4192 /* use externalSubsetName to make doctypeSysid non-NULL
4193 for the case where no startDoctypeDeclHandler is set */
4194 doctypeSysid = externalSubsetName;
4195#endif /* XML_DTD */
4196 if (!dtd->standalone
4197#ifdef XML_DTD
4198 && !paramEntityParsing
4199#endif /* XML_DTD */
4203#ifndef XML_DTD
4204 break;
4205#else /* XML_DTD */
4206 if (!declEntity) {
4208 &dtd->paramEntities,
4209 externalSubsetName,
4210 sizeof(ENTITY));
4211 if (!declEntity)
4212 return XML_ERROR_NO_MEMORY;
4213 declEntity->publicId = NULL;
4214 }
4215 /* fall through */
4216#endif /* XML_DTD */
4218 if (dtd->keepProcessing && declEntity) {
4219 declEntity->systemId = poolStoreString(&dtd->pool, enc,
4220 s + enc->minBytesPerChar,
4221 next - enc->minBytesPerChar);
4222 if (!declEntity->systemId)
4223 return XML_ERROR_NO_MEMORY;
4224 declEntity->base = curBase;
4225 poolFinish(&dtd->pool);
4227 handleDefault = XML_FALSE;
4228 }
4229 break;
4232 *eventEndPP = s;
4234 declEntity->name,
4235 declEntity->is_param,
4236 0,0,
4237 declEntity->base,
4238 declEntity->systemId,
4239 declEntity->publicId,
4240 0);
4241 handleDefault = XML_FALSE;
4242 }
4243 break;
4245 if (dtd->keepProcessing && declEntity) {
4246 declEntity->notation = poolStoreString(&dtd->pool, enc, s, next);
4247 if (!declEntity->notation)
4248 return XML_ERROR_NO_MEMORY;
4249 poolFinish(&dtd->pool);
4251 *eventEndPP = s;
4253 declEntity->name,
4254 declEntity->base,
4255 declEntity->systemId,
4256 declEntity->publicId,
4257 declEntity->notation);
4258 handleDefault = XML_FALSE;
4259 }
4260 else if (entityDeclHandler) {
4261 *eventEndPP = s;
4263 declEntity->name,
4264 0,0,0,
4265 declEntity->base,
4266 declEntity->systemId,
4267 declEntity->publicId,
4268 declEntity->notation);
4269 handleDefault = XML_FALSE;
4270 }
4271 }
4272 break;
4274 {
4275 if (XmlPredefinedEntityName(enc, s, next)) {
4276 declEntity = NULL;
4277 break;
4278 }
4279 if (dtd->keepProcessing) {
4280 const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);
4281 if (!name)
4282 return XML_ERROR_NO_MEMORY;
4284 sizeof(ENTITY));
4285 if (!declEntity)
4286 return XML_ERROR_NO_MEMORY;
4287 if (declEntity->name != name) {
4288 poolDiscard(&dtd->pool);
4289 declEntity = NULL;
4290 }
4291 else {
4292 poolFinish(&dtd->pool);
4293 declEntity->publicId = NULL;
4294 declEntity->is_param = XML_FALSE;
4295 /* if we have a parent parser or are reading an internal parameter
4296 entity, then the entity declaration is not considered "internal"
4297 */
4298 declEntity->is_internal = !(parentParser || openInternalEntities);
4300 handleDefault = XML_FALSE;
4301 }
4302 }
4303 else {
4304 poolDiscard(&dtd->pool);
4305 declEntity = NULL;
4306 }
4307 }
4308 break;
4310#ifdef XML_DTD
4311 if (dtd->keepProcessing) {
4312 const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);
4313 if (!name)
4314 return XML_ERROR_NO_MEMORY;
4315 declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities,
4316 name, sizeof(ENTITY));
4317 if (!declEntity)
4318 return XML_ERROR_NO_MEMORY;
4319 if (declEntity->name != name) {
4320 poolDiscard(&dtd->pool);
4321 declEntity = NULL;
4322 }
4323 else {
4324 poolFinish(&dtd->pool);
4325 declEntity->publicId = NULL;
4326 declEntity->is_param = XML_TRUE;
4327 /* if we have a parent parser or are reading an internal parameter
4328 entity, then the entity declaration is not considered "internal"
4329 */
4330 declEntity->is_internal = !(parentParser || openInternalEntities);
4332 handleDefault = XML_FALSE;
4333 }
4334 }
4335 else {
4336 poolDiscard(&dtd->pool);
4337 declEntity = NULL;
4338 }
4339#else /* not XML_DTD */
4340 declEntity = NULL;
4341#endif /* XML_DTD */
4342 break;
4344 declNotationPublicId = NULL;
4345 declNotationName = NULL;
4346 if (notationDeclHandler) {
4348 if (!declNotationName)
4349 return XML_ERROR_NO_MEMORY;
4351 handleDefault = XML_FALSE;
4352 }
4353 break;
4355 if (!XmlIsPublicId(enc, s, next, eventPP))
4356 return XML_ERROR_PUBLICID;
4357 if (declNotationName) { /* means notationDeclHandler != NULL */
4359 enc,
4360 s + enc->minBytesPerChar,
4361 next - enc->minBytesPerChar);
4362 if (!tem)
4363 return XML_ERROR_NO_MEMORY;
4364 normalizePublicId(tem);
4367 handleDefault = XML_FALSE;
4368 }
4369 break;
4372 const XML_Char *systemId
4373 = poolStoreString(&tempPool, enc,
4374 s + enc->minBytesPerChar,
4375 next - enc->minBytesPerChar);
4376 if (!systemId)
4377 return XML_ERROR_NO_MEMORY;
4378 *eventEndPP = s;
4381 curBase,
4382 systemId,
4384 handleDefault = XML_FALSE;
4385 }
4387 break;
4390 *eventEndPP = s;
4393 curBase,
4394 0,
4396 handleDefault = XML_FALSE;
4397 }
4399 break;
4400 case XML_ROLE_ERROR:
4401 switch (tok) {
4403 /* PE references in internal subset are
4404 not allowed within declarations. */
4406 case XML_TOK_XML_DECL:
4408 default:
4409 return XML_ERROR_SYNTAX;
4410 }
4411#ifdef XML_DTD
4412 case XML_ROLE_IGNORE_SECT:
4413 {
4414 enum XML_Error result;
4415 if (defaultHandler)
4416 reportDefault(parser, enc, s, next);
4417 handleDefault = XML_FALSE;
4418 result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore);
4419 if (result != XML_ERROR_NONE)
4420 return result;
4421 else if (!next) {
4422 processor = ignoreSectionProcessor;
4423 return result;
4424 }
4425 }
4426 break;
4427#endif /* XML_DTD */
4429 if (prologState.level >= groupSize) {
4430 if (groupSize) {
4431 char *temp = (char *)REALLOC(groupConnector, groupSize *= 2);
4432 if (temp == NULL)
4433 return XML_ERROR_NO_MEMORY;
4434 groupConnector = temp;
4435 if (dtd->scaffIndex) {
4436 int *temp = (int *)REALLOC(dtd->scaffIndex,
4437 groupSize * sizeof(int));
4438 if (temp == NULL)
4439 return XML_ERROR_NO_MEMORY;
4440 dtd->scaffIndex = temp;
4441 }
4442 }
4443 else {
4444 groupConnector = (char *)MALLOC(groupSize = 32);
4445 if (!groupConnector)
4446 return XML_ERROR_NO_MEMORY;
4447 }
4448 }
4449 groupConnector[prologState.level] = 0;
4450 if (dtd->in_eldecl) {
4451 int myindex = nextScaffoldPart(parser);
4452 if (myindex < 0)
4453 return XML_ERROR_NO_MEMORY;
4454 dtd->scaffIndex[dtd->scaffLevel] = myindex;
4455 dtd->scaffLevel++;
4456 dtd->scaffold[myindex].type = XML_CTYPE_SEQ;
4458 handleDefault = XML_FALSE;
4459 }
4460 break;
4463 return XML_ERROR_SYNTAX;
4465 if (dtd->in_eldecl && elementDeclHandler)
4466 handleDefault = XML_FALSE;
4467 break;
4470 return XML_ERROR_SYNTAX;
4471 if (dtd->in_eldecl
4472 && !groupConnector[prologState.level]
4473 && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
4474 != XML_CTYPE_MIXED)
4475 ) {
4476 dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
4479 handleDefault = XML_FALSE;
4480 }
4482 break;
4484#ifdef XML_DTD
4485 case XML_ROLE_INNER_PARAM_ENTITY_REF:
4487 if (!paramEntityParsing)
4488 dtd->keepProcessing = dtd->standalone;
4489 else {
4490 const XML_Char *name;
4491 ENTITY *entity;
4492 name = poolStoreString(&dtd->pool, enc,
4493 s + enc->minBytesPerChar,
4494 next - enc->minBytesPerChar);
4495 if (!name)
4496 return XML_ERROR_NO_MEMORY;
4497 entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0);
4498 poolDiscard(&dtd->pool);
4499 /* first, determine if a check for an existing declaration is needed;
4500 if yes, check that the entity exists, and that it is internal,
4501 otherwise call the skipped entity handler
4502 */
4503 if (prologState.documentEntity &&
4504 (dtd->standalone
4506 : !dtd->hasParamEntityRefs)) {
4507 if (!entity)
4509 else if (!entity->is_internal)
4511 }
4512 else if (!entity) {
4513 dtd->keepProcessing = dtd->standalone;
4514 /* cannot report skipped entities in declarations */
4517 handleDefault = XML_FALSE;
4518 }
4519 break;
4520 }
4521 if (entity->open)
4523 if (entity->textPtr) {
4524 enum XML_Error result;
4525 XML_Bool betweenDecl =
4527 result = processInternalEntity(parser, entity, betweenDecl);
4528 if (result != XML_ERROR_NONE)
4529 return result;
4530 handleDefault = XML_FALSE;
4531 break;
4532 }
4534 dtd->paramEntityRead = XML_FALSE;
4535 entity->open = XML_TRUE;
4537 0,
4538 entity->base,
4539 entity->systemId,
4540 entity->publicId)) {
4541 entity->open = XML_FALSE;
4543 }
4544 entity->open = XML_FALSE;
4545 handleDefault = XML_FALSE;
4546 if (!dtd->paramEntityRead) {
4547 dtd->keepProcessing = dtd->standalone;
4548 break;
4549 }
4550 }
4551 else {
4552 dtd->keepProcessing = dtd->standalone;
4553 break;
4554 }
4555 }
4556#endif /* XML_DTD */
4557 if (!dtd->standalone &&
4561 break;
4562
4563 /* Element declaration stuff */
4564
4566 if (elementDeclHandler) {
4567 declElementType = getElementType(parser, enc, s, next);
4568 if (!declElementType)
4569 return XML_ERROR_NO_MEMORY;
4570 dtd->scaffLevel = 0;
4571 dtd->scaffCount = 0;
4572 dtd->in_eldecl = XML_TRUE;
4573 handleDefault = XML_FALSE;
4574 }
4575 break;
4576
4579 if (dtd->in_eldecl) {
4580 if (elementDeclHandler) {
4581 XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content));
4582 if (!content)
4583 return XML_ERROR_NO_MEMORY;
4584 content->quant = XML_CQUANT_NONE;
4585 content->name = NULL;
4586 content->numchildren = 0;
4587 content->children = NULL;
4588 content->type = ((role == XML_ROLE_CONTENT_ANY) ?
4591 *eventEndPP = s;
4593 handleDefault = XML_FALSE;
4594 }
4595 dtd->in_eldecl = XML_FALSE;
4596 }
4597 break;
4598
4600 if (dtd->in_eldecl) {
4601 dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
4604 handleDefault = XML_FALSE;
4605 }
4606 break;
4607
4609 quant = XML_CQUANT_NONE;
4610 goto elementContent;
4612 quant = XML_CQUANT_OPT;
4613 goto elementContent;
4615 quant = XML_CQUANT_REP;
4616 goto elementContent;
4618 quant = XML_CQUANT_PLUS;
4619 elementContent:
4620 if (dtd->in_eldecl) {
4621 ELEMENT_TYPE *el;
4622 const XML_Char *name;
4623 int nameLen;
4624 const char *nxt = (quant == XML_CQUANT_NONE
4625 ? next
4626 : next - enc->minBytesPerChar);
4627 int myindex = nextScaffoldPart(parser);
4628 if (myindex < 0)
4629 return XML_ERROR_NO_MEMORY;
4630 dtd->scaffold[myindex].type = XML_CTYPE_NAME;
4631 dtd->scaffold[myindex].quant = quant;
4632 el = getElementType(parser, enc, s, nxt);
4633 if (!el)
4634 return XML_ERROR_NO_MEMORY;
4635 name = el->name;
4636 dtd->scaffold[myindex].name = name;
4637 nameLen = 0;
4638 for (; name[nameLen++]; );
4639 dtd->contentStringLen += nameLen;
4641 handleDefault = XML_FALSE;
4642 }
4643 break;
4644
4646 quant = XML_CQUANT_NONE;
4647 goto closeGroup;
4649 quant = XML_CQUANT_OPT;
4650 goto closeGroup;
4652 quant = XML_CQUANT_REP;
4653 goto closeGroup;
4655 quant = XML_CQUANT_PLUS;
4656 closeGroup:
4657 if (dtd->in_eldecl) {
4659 handleDefault = XML_FALSE;
4660 dtd->scaffLevel--;
4661 dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant;
4662 if (dtd->scaffLevel == 0) {
4663 if (!handleDefault) {
4664 XML_Content *model = build_model(parser);
4665 if (!model)
4666 return XML_ERROR_NO_MEMORY;
4667 *eventEndPP = s;
4669 }
4670 dtd->in_eldecl = XML_FALSE;
4671 dtd->contentStringLen = 0;
4672 }
4673 }
4674 break;
4675 /* End element declaration stuff */
4676
4677 case XML_ROLE_PI:
4678 if (!reportProcessingInstruction(parser, enc, s, next))
4679 return XML_ERROR_NO_MEMORY;
4680 handleDefault = XML_FALSE;
4681 break;
4682 case XML_ROLE_COMMENT:
4683 if (!reportComment(parser, enc, s, next))
4684 return XML_ERROR_NO_MEMORY;
4685 handleDefault = XML_FALSE;
4686 break;
4687 case XML_ROLE_NONE:
4688 switch (tok) {
4689 case XML_TOK_BOM:
4690 handleDefault = XML_FALSE;
4691 break;
4692 }
4693 break;
4696 handleDefault = XML_FALSE;
4697 break;
4700 handleDefault = XML_FALSE;
4701 break;
4704 handleDefault = XML_FALSE;
4705 break;
4708 handleDefault = XML_FALSE;
4709 break;
4712 handleDefault = XML_FALSE;
4713 break;
4714 } /* end of big switch */
4715
4716 if (handleDefault && defaultHandler)
4717 reportDefault(parser, enc, s, next);
4718
4719 switch (ps_parsing) {
4720 case XML_SUSPENDED:
4721 *nextPtr = next;
4722 return XML_ERROR_NONE;
4723 case XML_FINISHED:
4724 return XML_ERROR_ABORTED;
4725 default:
4726 s = next;
4727 tok = XmlPrologTok(enc, s, end, &next);
4728 }
4729 }
4730 /* not reached */
4731}
#define XML_DTD
Definition: amigaconfig.h:27
#define ASCII_PIPE
Definition: ascii.h:91
#define ASCII_F
Definition: ascii.h:10
#define ASCII_E
Definition: ascii.h:9
#define ASCII_C
Definition: ascii.h:7
#define ASCII_O
Definition: ascii.h:19
#define ASCII_LPAREN
Definition: ascii.h:86
#define ASCII_N
Definition: ascii.h:18
#define ASCII_D
Definition: ascii.h:8
#define ASCII_RPAREN
Definition: ascii.h:87
#define ASCII_I
Definition: ascii.h:13
#define ASCII_A
Definition: ascii.h:5
#define ASCII_COMMA
Definition: ascii.h:92
#define ASCII_R
Definition: ascii.h:22
#define ASCII_K
Definition: ascii.h:15
#define ASCII_S
Definition: ascii.h:23
#define ASCII_T
Definition: ascii.h:24
#define ASCII_HASH
Definition: ascii.h:90
#define ASCII_Y
Definition: ascii.h:29
XML_Content_Quant
Definition: expat.h:110
@ XML_CQUANT_PLUS
Definition: expat.h:114
@ XML_CQUANT_OPT
Definition: expat.h:112
@ XML_CQUANT_NONE
Definition: expat.h:111
@ XML_CQUANT_REP
Definition: expat.h:113
@ XML_ERROR_NOT_STANDALONE
Definition: expat.h:77
@ XML_ERROR_INCOMPLETE_PE
Definition: expat.h:86
@ XML_ERROR_PARAM_ENTITY_REF
Definition: expat.h:65
@ XML_ERROR_PUBLICID
Definition: expat.h:89
@ XML_ERROR_SYNTAX
Definition: expat.h:57
@ XML_CTYPE_ANY
Definition: expat.h:103
@ XML_CTYPE_SEQ
Definition: expat.h:107
@ XML_CTYPE_MIXED
Definition: expat.h:104
@ XML_CTYPE_CHOICE
Definition: expat.h:106
@ XML_CTYPE_EMPTY
Definition: expat.h:102
int * scaffIndex
Definition: xmlparse.cc:294
XML_Bool keepProcessing
Definition: xmlparse.cc:276
XML_Bool in_eldecl
Definition: xmlparse.cc:288
int scaffLevel
Definition: xmlparse.cc:293
STRING_POOL entityValuePool
Definition: xmlparse.cc:274
const XML_Char * name
Definition: xmlparse.cc:260
#define declAttributeId
Definition: xmlparse.cc:646
static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser)
Definition: xmlparse.cc:5362
#define declAttributeIsId
Definition: xmlparse.cc:648
#define elementDeclHandler
Definition: xmlparse.cc:601
#define groupConnector
Definition: xmlparse.cc:663
#define doctypeName
Definition: xmlparse.cc:639
#define declElementType
Definition: xmlparse.cc:645
static void FASTCALL normalizePublicId(XML_Char *s)
Definition: xmlparse.cc:5629
#define poolStart(pool)
Definition: xmlparse.cc:453
#define declNotationName
Definition: xmlparse.cc:643
#define notationDeclHandler
Definition: xmlparse.cc:588
#define declNotationPublicId
Definition: xmlparse.cc:644
#define endDoctypeDeclHandler
Definition: xmlparse.cc:585
static const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool, const XML_Char *s)
Definition: xmlparse.cc:6193
#define encoding
Definition: xmlparse.cc:605
#define doctypeSysid
Definition: xmlparse.cc:640
#define groupSize
Definition: xmlparse.cc:664
static int FASTCALL nextScaffoldPart(XML_Parser parser)
Definition: xmlparse.cc:6280
#define doctypePubid
Definition: xmlparse.cc:641
#define declAttributeIsCdata
Definition: xmlparse.cc:647
static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *)
Definition: xmlparse.cc:4928
static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
Definition: xmlparse.cc:5094
static ATTRIBUTE_ID * getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
Definition: xmlparse.cc:5436
#define startDoctypeDeclHandler
Definition: xmlparse.cc:584
#define entityDeclHandler
Definition: xmlparse.cc:603
#define notStandaloneHandler
Definition: xmlparse.cc:592
#define declAttributeType
Definition: xmlparse.cc:642
#define attlistDeclHandler
Definition: xmlparse.cc:602
#define curBase
Definition: xmlparse.cc:637
static XML_Content * build_model(XML_Parser parser)
Definition: xmlparse.cc:6366
#define unparsedEntityDeclHandler
Definition: xmlparse.cc:586
static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end)
Definition: xmlparse.cc:6387
static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s, const char *next)
Definition: xmlparse.cc:3425
#define declEntity
Definition: xmlparse.cc:638
@ XML_ROLE_GROUP_CHOICE
Definition: xmlrole.h:71
@ XML_ROLE_NOTATION_PUBLIC_ID
Definition: xmlrole.h:43
@ XML_ROLE_ERROR
Definition: xmlrole.h:21
@ XML_ROLE_GROUP_CLOSE_REP
Definition: xmlrole.h:68
@ XML_ROLE_CONTENT_PCDATA
Definition: xmlrole.h:65
@ XML_ROLE_CONTENT_ELEMENT_REP
Definition: xmlrole.h:74
@ XML_ROLE_ENTITY_COMPLETE
Definition: xmlrole.h:37
@ XML_ROLE_DOCTYPE_INTERNAL_SUBSET
Definition: xmlrole.h:29
@ XML_ROLE_ATTRIBUTE_TYPE_ENTITY
Definition: xmlrole.h:49
@ XML_ROLE_NOTATION_NO_SYSTEM_ID
Definition: xmlrole.h:42
@ XML_ROLE_DOCTYPE_NONE
Definition: xmlrole.h:25
@ XML_ROLE_PARAM_ENTITY_REF
Definition: xmlrole.h:84
@ XML_ROLE_ATTRIBUTE_TYPE_ENTITIES
Definition: xmlrole.h:50
@ XML_ROLE_GROUP_CLOSE
Definition: xmlrole.h:67
@ XML_ROLE_DOCTYPE_CLOSE
Definition: xmlrole.h:30
@ XML_ROLE_ENTITY_NOTATION_NAME
Definition: xmlrole.h:38
@ XML_ROLE_GROUP_SEQUENCE
Definition: xmlrole.h:72
@ XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS
Definition: xmlrole.h:52
@ XML_ROLE_ATTLIST_ELEMENT_NAME
Definition: xmlrole.h:56
@ XML_ROLE_GROUP_CLOSE_OPT
Definition: xmlrole.h:69
@ XML_ROLE_IMPLIED_ATTRIBUTE_VALUE
Definition: xmlrole.h:57
@ XML_ROLE_ATTRIBUTE_TYPE_CDATA
Definition: xmlrole.h:45
@ XML_ROLE_COMMENT
Definition: xmlrole.h:78
@ XML_ROLE_ATTRIBUTE_ENUM_VALUE
Definition: xmlrole.h:53
@ XML_ROLE_ENTITY_SYSTEM_ID
Definition: xmlrole.h:35
@ XML_ROLE_CONTENT_ELEMENT
Definition: xmlrole.h:73
@ XML_ROLE_ATTLIST_NONE
Definition: xmlrole.h:55
@ XML_ROLE_ATTRIBUTE_NOTATION_VALUE
Definition: xmlrole.h:54
@ XML_ROLE_DOCTYPE_SYSTEM_ID
Definition: xmlrole.h:27
@ XML_ROLE_NOTATION_SYSTEM_ID
Definition: xmlrole.h:41
@ XML_ROLE_PI
Definition: xmlrole.h:77
@ XML_ROLE_ATTRIBUTE_NAME
Definition: xmlrole.h:44
@ XML_ROLE_CONTENT_ANY
Definition: xmlrole.h:63
@ XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN
Definition: xmlrole.h:51
@ XML_ROLE_ATTRIBUTE_TYPE_ID
Definition: xmlrole.h:46
@ XML_ROLE_ENTITY_NONE
Definition: xmlrole.h:33
@ XML_ROLE_NONE
Definition: xmlrole.h:22
@ XML_ROLE_ELEMENT_NONE
Definition: xmlrole.h:61
@ XML_ROLE_ENTITY_PUBLIC_ID
Definition: xmlrole.h:36
@ XML_ROLE_INSTANCE_START
Definition: xmlrole.h:24
@ XML_ROLE_DOCTYPE_NAME
Definition: xmlrole.h:26
@ XML_ROLE_NOTATION_NAME
Definition: xmlrole.h:40
@ XML_ROLE_CONTENT_ELEMENT_PLUS
Definition: xmlrole.h:76
@ XML_ROLE_GENERAL_ENTITY_NAME
Definition: xmlrole.h:31
@ XML_ROLE_PARAM_ENTITY_NAME
Definition: xmlrole.h:32
@ XML_ROLE_DEFAULT_ATTRIBUTE_VALUE
Definition: xmlrole.h:59
@ XML_ROLE_NOTATION_NONE
Definition: xmlrole.h:39
@ XML_ROLE_XML_DECL
Definition: xmlrole.h:23
@ XML_ROLE_GROUP_CLOSE_PLUS
Definition: xmlrole.h:70
@ XML_ROLE_REQUIRED_ATTRIBUTE_VALUE
Definition: xmlrole.h:58
@ XML_ROLE_GROUP_OPEN
Definition: xmlrole.h:66
@ XML_ROLE_CONTENT_EMPTY
Definition: xmlrole.h:64
@ XML_ROLE_FIXED_ATTRIBUTE_VALUE
Definition: xmlrole.h:60
@ XML_ROLE_CONTENT_ELEMENT_OPT
Definition: xmlrole.h:75
@ XML_ROLE_ATTRIBUTE_TYPE_IDREFS
Definition: xmlrole.h:48
@ XML_ROLE_DOCTYPE_PUBLIC_ID
Definition: xmlrole.h:28
@ XML_ROLE_ATTRIBUTE_TYPE_IDREF
Definition: xmlrole.h:47
@ XML_ROLE_ELEMENT_NAME
Definition: xmlrole.h:62
@ XML_ROLE_ENTITY_VALUE
Definition: xmlrole.h:34
#define XmlTokenRole(state, tok, ptr, end, enc)
Definition: xmlrole.h:107
#define XML_TOK_PROLOG_S
Definition: xmltok.h:46
#define XmlPrologTok(enc, ptr, end, nextTokPtr)
Definition: xmltok.h:199
#define XmlIsPublicId(enc, ptr, end, badPtr)
Definition: xmltok.h:250
#define XML_TOK_PARAM_ENTITY_REF
Definition: xmltok.h:59
#define XML_TOK_BOM
Definition: xmltok.h:43

References _dtd, ASCII_A, ASCII_C, ASCII_COMMA, ASCII_D, ASCII_E, ASCII_F, ASCII_HASH, ASCII_I, ASCII_K, ASCII_LPAREN, ASCII_M, ASCII_N, ASCII_O, ASCII_PIPE, ASCII_R, ASCII_RPAREN, ASCII_S, ASCII_T, ASCII_Y, attlistDeclHandler, ENTITY::base, build_model(), XML_cp::children, contentProcessor, DTD::contentStringLen, curBase, declAttributeId, declAttributeIsCdata, declAttributeIsId, declAttributeType, declElementType, declEntity, declNotationName, declNotationPublicId, defaultHandler, defineAttribute(), doctypeName, doctypePubid, doctypeSysid, elementDeclHandler, encoding, endDoctypeDeclHandler, entityDeclHandler, DTD::entityValuePool, eventEndPtr, eventPtr, externalEntityRefHandler, externalEntityRefHandlerArg, DTD::generalEntities, getAttributeId(), getElementType(), groupConnector, groupSize, handlerArg, DTD::hasParamEntityRefs, DTD::in_eldecl, ENTITY::is_internal, DTD::keepProcessing, lookup(), MALLOC, encoding::minBytesPerChar, XML_cp::name, CONTENT_SCAFFOLD::name, ELEMENT_TYPE::name, G4InuclParticleNames::name(), nextScaffoldPart(), normalizePublicId(), notationDeclHandler, notStandaloneHandler, XML_cp::numchildren, ENTITY::open, openInternalEntities, parentParser, geant4_check_module_cycles::parser, DTD::pool, poolAppend(), poolAppendChar, poolAppendString(), poolClear(), poolDiscard, poolFinish, poolLength, poolStart, poolStoreString(), processInternalEntity(), processor, processXmlDecl(), prologState, ps_parsing, ENTITY::publicId, XML_cp::quant, CONTENT_SCAFFOLD::quant, REALLOC, reportComment(), reportDefault(), reportProcessingInstruction(), s, DTD::scaffCount, DTD::scaffIndex, DTD::scaffLevel, DTD::scaffold, skippedEntityHandler, DTD::standalone, startDoctypeDeclHandler, storeAttributeValue(), storeEntityValue(), ENTITY::systemId, tempPool, ENTITY::textPtr, XML_cp::type, CONTENT_SCAFFOLD::type, unparsedEntityDeclHandler, XML_CQUANT_NONE, XML_CQUANT_OPT, XML_CQUANT_PLUS, XML_CQUANT_REP, XML_CTYPE_ANY, XML_CTYPE_CHOICE, XML_CTYPE_EMPTY, XML_CTYPE_MIXED, XML_CTYPE_NAME, XML_CTYPE_SEQ, XML_DTD, XML_ERROR_ABORTED, XML_ERROR_ENTITY_DECLARED_IN_PE, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_INCOMPLETE_PE, XML_ERROR_INVALID_TOKEN, XML_ERROR_MISPLACED_XML_PI, XML_ERROR_NO_ELEMENTS, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_NOT_STANDALONE, XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_PARTIAL_CHAR, XML_ERROR_PUBLICID, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_SYNTAX, XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_UNDEFINED_ENTITY, XML_FALSE, XML_FINISHED, XML_ROLE_ATTLIST_ELEMENT_NAME, XML_ROLE_ATTLIST_NONE, XML_ROLE_ATTRIBUTE_ENUM_VALUE, XML_ROLE_ATTRIBUTE_NAME, XML_ROLE_ATTRIBUTE_NOTATION_VALUE, XML_ROLE_ATTRIBUTE_TYPE_CDATA, XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, XML_ROLE_ATTRIBUTE_TYPE_ENTITY, XML_ROLE_ATTRIBUTE_TYPE_ID, XML_ROLE_ATTRIBUTE_TYPE_IDREF, XML_ROLE_ATTRIBUTE_TYPE_IDREFS, XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, XML_ROLE_COMMENT, XML_ROLE_CONTENT_ANY, XML_ROLE_CONTENT_ELEMENT, XML_ROLE_CONTENT_ELEMENT_OPT, XML_ROLE_CONTENT_ELEMENT_PLUS, XML_ROLE_CONTENT_ELEMENT_REP, XML_ROLE_CONTENT_EMPTY, XML_ROLE_CONTENT_PCDATA, XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, XML_ROLE_DOCTYPE_CLOSE, XML_ROLE_DOCTYPE_INTERNAL_SUBSET, XML_ROLE_DOCTYPE_NAME, XML_ROLE_DOCTYPE_NONE, XML_ROLE_DOCTYPE_PUBLIC_ID, XML_ROLE_DOCTYPE_SYSTEM_ID, XML_ROLE_ELEMENT_NAME, XML_ROLE_ELEMENT_NONE, XML_ROLE_ENTITY_COMPLETE, XML_ROLE_ENTITY_NONE, XML_ROLE_ENTITY_NOTATION_NAME, XML_ROLE_ENTITY_PUBLIC_ID, XML_ROLE_ENTITY_SYSTEM_ID, XML_ROLE_ENTITY_VALUE, XML_ROLE_ERROR, XML_ROLE_FIXED_ATTRIBUTE_VALUE, XML_ROLE_GENERAL_ENTITY_NAME, XML_ROLE_GROUP_CHOICE, XML_ROLE_GROUP_CLOSE, XML_ROLE_GROUP_CLOSE_OPT, XML_ROLE_GROUP_CLOSE_PLUS, XML_ROLE_GROUP_CLOSE_REP, XML_ROLE_GROUP_OPEN, XML_ROLE_GROUP_SEQUENCE, XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, XML_ROLE_INSTANCE_START, XML_ROLE_NONE, XML_ROLE_NOTATION_NAME, XML_ROLE_NOTATION_NO_SYSTEM_ID, XML_ROLE_NOTATION_NONE, XML_ROLE_NOTATION_PUBLIC_ID, XML_ROLE_NOTATION_SYSTEM_ID, XML_ROLE_PARAM_ENTITY_NAME, XML_ROLE_PARAM_ENTITY_REF, XML_ROLE_PI, XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, XML_ROLE_XML_DECL, XML_SUSPENDED, XML_T, XML_TOK_BOM, XML_TOK_INVALID, XML_TOK_NONE, XML_TOK_PARAM_ENTITY_REF, XML_TOK_PARTIAL, XML_TOK_PARTIAL_CHAR, XML_TOK_PROLOG_S, XML_TOK_XML_DECL, XML_TRUE, XmlIsPublicId, XmlPredefinedEntityName, XmlPrologTok, and XmlTokenRole.

Referenced by internalEntityProcessor(), processInternalEntity(), and prologProcessor().

◆ dtdCopy()

static int dtdCopy ( XML_Parser  oldParser,
DTD newDtd,
const DTD oldDtd,
const XML_Memory_Handling_Suite ms 
)
static

Definition at line 5757 of file xmlparse.cc.

5758{
5759 HASH_TABLE_ITER iter;
5760
5761 /* Copy the prefix table. */
5762
5763 hashTableIterInit(&iter, &(oldDtd->prefixes));
5764 for (;;) {
5765 const XML_Char *name;
5766 const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
5767 if (!oldP)
5768 break;
5769 name = poolCopyString(&(newDtd->pool), oldP->name);
5770 if (!name)
5771 return 0;
5772 if (!lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX)))
5773 return 0;
5774 }
5775
5776 hashTableIterInit(&iter, &(oldDtd->attributeIds));
5777
5778 /* Copy the attribute id table. */
5779
5780 for (;;) {
5781 ATTRIBUTE_ID *newA;
5782 const XML_Char *name;
5783 const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
5784
5785 if (!oldA)
5786 break;
5787 /* Remember to allocate the scratch byte before the name. */
5788 if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
5789 return 0;
5790 name = poolCopyString(&(newDtd->pool), oldA->name);
5791 if (!name)
5792 return 0;
5793 ++name;
5794 newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name,
5795 sizeof(ATTRIBUTE_ID));
5796 if (!newA)
5797 return 0;
5798 newA->maybeTokenized = oldA->maybeTokenized;
5799 if (oldA->prefix) {
5800 newA->xmlns = oldA->xmlns;
5801 if (oldA->prefix == &oldDtd->defaultPrefix)
5802 newA->prefix = &newDtd->defaultPrefix;
5803 else
5804 newA->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes),
5805 oldA->prefix->name, 0);
5806 }
5807 }
5808
5809 /* Copy the element type table. */
5810
5811 hashTableIterInit(&iter, &(oldDtd->elementTypes));
5812
5813 for (;;) {
5814 int i;
5815 ELEMENT_TYPE *newE;
5816 const XML_Char *name;
5817 const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
5818 if (!oldE)
5819 break;
5820 name = poolCopyString(&(newDtd->pool), oldE->name);
5821 if (!name)
5822 return 0;
5823 newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name,
5824 sizeof(ELEMENT_TYPE));
5825 if (!newE)
5826 return 0;
5827 if (oldE->nDefaultAtts) {
5828 newE->defaultAtts = (DEFAULT_ATTRIBUTE *)
5829 ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
5830 if (!newE->defaultAtts) {
5831 ms->free_fcn(newE);
5832 return 0;
5833 }
5834 }
5835 if (oldE->idAtt)
5836 newE->idAtt = (ATTRIBUTE_ID *)
5837 lookup(oldParser, &(newDtd->attributeIds), oldE->idAtt->name, 0);
5838 newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
5839 if (oldE->prefix)
5840 newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes),
5841 oldE->prefix->name, 0);
5842 for (i = 0; i < newE->nDefaultAtts; i++) {
5843 newE->defaultAtts[i].id = (ATTRIBUTE_ID *)
5844 lookup(oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
5845 newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
5846 if (oldE->defaultAtts[i].value) {
5847 newE->defaultAtts[i].value
5848 = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
5849 if (!newE->defaultAtts[i].value)
5850 return 0;
5851 }
5852 else
5853 newE->defaultAtts[i].value = NULL;
5854 }
5855 }
5856
5857 /* Copy the entity tables. */
5858 if (!copyEntityTable(oldParser,
5859 &(newDtd->generalEntities),
5860 &(newDtd->pool),
5861 &(oldDtd->generalEntities)))
5862 return 0;
5863
5864#ifdef XML_DTD
5865 if (!copyEntityTable(oldParser,
5866 &(newDtd->paramEntities),
5867 &(newDtd->pool),
5868 &(oldDtd->paramEntities)))
5869 return 0;
5870 newDtd->paramEntityRead = oldDtd->paramEntityRead;
5871#endif /* XML_DTD */
5872
5873 newDtd->keepProcessing = oldDtd->keepProcessing;
5874 newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs;
5875 newDtd->standalone = oldDtd->standalone;
5876
5877 /* Don't want deep copying for scaffolding */
5878 newDtd->in_eldecl = oldDtd->in_eldecl;
5879 newDtd->scaffold = oldDtd->scaffold;
5880 newDtd->contentStringLen = oldDtd->contentStringLen;
5881 newDtd->scaffSize = oldDtd->scaffSize;
5882 newDtd->scaffLevel = oldDtd->scaffLevel;
5883 newDtd->scaffIndex = oldDtd->scaffIndex;
5884
5885 return 1;
5886} /* End dtdCopy */
static constexpr double ms
Definition: G4SIunits.hh:155
unsigned scaffSize
Definition: xmlparse.cc:291
HASH_TABLE attributeIds
Definition: xmlparse.cc:271
HASH_TABLE elementTypes
Definition: xmlparse.cc:270
HASH_TABLE prefixes
Definition: xmlparse.cc:272
PREFIX defaultPrefix
Definition: xmlparse.cc:286
PREFIX * prefix
Definition: xmlparse.cc:261
XML_Char * name
Definition: xmlparse.cc:241
PREFIX * prefix
Definition: xmlparse.cc:242
struct attribute_id ATTRIBUTE_ID
static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *, STRING_POOL *, const HASH_TABLE *)
Definition: xmlparse.cc:5889

References ELEMENT_TYPE::allocDefaultAtts, DTD::attributeIds, DTD::contentStringLen, copyEntityTable(), ELEMENT_TYPE::defaultAtts, DTD::defaultPrefix, DTD::elementTypes, DTD::generalEntities, hashTableIterInit(), hashTableIterNext(), DTD::hasParamEntityRefs, DEFAULT_ATTRIBUTE::id, ELEMENT_TYPE::idAtt, DTD::in_eldecl, DEFAULT_ATTRIBUTE::isCdata, DTD::keepProcessing, lookup(), attribute_id::maybeTokenized, ms, prefix::name, attribute_id::name, ELEMENT_TYPE::name, G4InuclParticleNames::name(), ELEMENT_TYPE::nDefaultAtts, DTD::pool, poolAppendChar, poolCopyString(), attribute_id::prefix, ELEMENT_TYPE::prefix, DTD::prefixes, DTD::scaffIndex, DTD::scaffLevel, DTD::scaffold, DTD::scaffSize, DTD::standalone, DEFAULT_ATTRIBUTE::value, XML_T, and attribute_id::xmlns.

Referenced by XML_ExternalEntityParserCreate().

◆ dtdCreate()

static DTD * dtdCreate ( const XML_Memory_Handling_Suite ms)
static

Definition at line 5651 of file xmlparse.cc.

5652{
5653 DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD));
5654 if (p == NULL)
5655 return p;
5656 poolInit(&(p->pool), ms);
5657 poolInit(&(p->entityValuePool), ms);
5661 hashTableInit(&(p->prefixes), ms);
5662#ifdef XML_DTD
5663 p->paramEntityRead = XML_FALSE;
5664 hashTableInit(&(p->paramEntities), ms);
5665#endif /* XML_DTD */
5666 p->defaultPrefix.name = NULL;
5667 p->defaultPrefix.binding = NULL;
5668
5669 p->in_eldecl = XML_FALSE;
5670 p->scaffIndex = NULL;
5671 p->scaffold = NULL;
5672 p->scaffLevel = 0;
5673 p->scaffSize = 0;
5674 p->scaffCount = 0;
5675 p->contentStringLen = 0;
5676
5679 p->standalone = XML_FALSE;
5680 return p;
5681}
static void FASTCALL hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms)
Definition: xmlparse.cc:6075
static void FASTCALL poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms)
Definition: xmlparse.cc:6103

References DTD::attributeIds, prefix::binding, DTD::contentStringLen, DTD::defaultPrefix, DTD::elementTypes, DTD::entityValuePool, DTD::generalEntities, hashTableInit(), DTD::hasParamEntityRefs, DTD::in_eldecl, DTD::keepProcessing, ms, prefix::name, DTD::pool, poolInit(), DTD::prefixes, DTD::scaffCount, DTD::scaffIndex, DTD::scaffLevel, DTD::scaffold, DTD::scaffSize, DTD::standalone, XML_FALSE, and XML_TRUE.

Referenced by parserCreate().

◆ dtdDestroy()

static void dtdDestroy ( DTD p,
XML_Bool  isDocEntity,
const XML_Memory_Handling_Suite ms 
)
static

Definition at line 5726 of file xmlparse.cc.

5727{
5728 HASH_TABLE_ITER iter;
5729 hashTableIterInit(&iter, &(p->elementTypes));
5730 for (;;) {
5732 if (!e)
5733 break;
5734 if (e->allocDefaultAtts != 0)
5735 ms->free_fcn(e->defaultAtts);
5736 }
5738#ifdef XML_DTD
5739 hashTableDestroy(&(p->paramEntities));
5740#endif /* XML_DTD */
5744 poolDestroy(&(p->pool));
5746 if (isDocEntity) {
5747 ms->free_fcn(p->scaffIndex);
5748 ms->free_fcn(p->scaffold);
5749 }
5750 ms->free_fcn(p);
5751}
static void FASTCALL poolDestroy(STRING_POOL *)
Definition: xmlparse.cc:6134
static void FASTCALL hashTableDestroy(HASH_TABLE *)
Definition: xmlparse.cc:6066

References ELEMENT_TYPE::allocDefaultAtts, DTD::attributeIds, ELEMENT_TYPE::defaultAtts, DTD::elementTypes, DTD::entityValuePool, DTD::generalEntities, hashTableDestroy(), hashTableIterInit(), hashTableIterNext(), ms, DTD::pool, poolDestroy(), DTD::prefixes, DTD::scaffIndex, and DTD::scaffold.

Referenced by XML_ParserFree().

◆ dtdReset()

static void dtdReset ( DTD p,
const XML_Memory_Handling_Suite ms 
)
static

Definition at line 5684 of file xmlparse.cc.

5685{
5686 HASH_TABLE_ITER iter;
5687 hashTableIterInit(&iter, &(p->elementTypes));
5688 for (;;) {
5690 if (!e)
5691 break;
5692 if (e->allocDefaultAtts != 0)
5693 ms->free_fcn(e->defaultAtts);
5694 }
5696#ifdef XML_DTD
5697 p->paramEntityRead = XML_FALSE;
5698 hashTableClear(&(p->paramEntities));
5699#endif /* XML_DTD */
5702 hashTableClear(&(p->prefixes));
5703 poolClear(&(p->pool));
5705 p->defaultPrefix.name = NULL;
5706 p->defaultPrefix.binding = NULL;
5707
5708 p->in_eldecl = XML_FALSE;
5709
5710 ms->free_fcn(p->scaffIndex);
5711 p->scaffIndex = NULL;
5712 ms->free_fcn(p->scaffold);
5713 p->scaffold = NULL;
5714
5715 p->scaffLevel = 0;
5716 p->scaffSize = 0;
5717 p->scaffCount = 0;
5718 p->contentStringLen = 0;
5719
5722 p->standalone = XML_FALSE;
5723}
static void FASTCALL hashTableClear(HASH_TABLE *)
Definition: xmlparse.cc:6055

References ELEMENT_TYPE::allocDefaultAtts, DTD::attributeIds, prefix::binding, DTD::contentStringLen, ELEMENT_TYPE::defaultAtts, DTD::defaultPrefix, DTD::elementTypes, DTD::entityValuePool, DTD::generalEntities, hashTableClear(), hashTableIterInit(), hashTableIterNext(), DTD::hasParamEntityRefs, DTD::in_eldecl, DTD::keepProcessing, ms, prefix::name, DTD::pool, poolClear(), DTD::prefixes, DTD::scaffCount, DTD::scaffIndex, DTD::scaffLevel, DTD::scaffold, DTD::scaffSize, DTD::standalone, XML_FALSE, and XML_TRUE.

Referenced by XML_ParserReset().

◆ epilogProcessor()

static enum XML_Error PTRCALL epilogProcessor ( XML_Parser  parser,
const char *  s,
const char *  end,
const char **  nextPtr 
)
static

Definition at line 4734 of file xmlparse.cc.

4738{
4740 eventPtr = s;
4741 for (;;) {
4742 const char *next = NULL;
4743 int tok = XmlPrologTok(encoding, s, end, &next);
4744 eventEndPtr = next;
4745 switch (tok) {
4746 /* report partial linebreak - it might be the last token */
4747 case -XML_TOK_PROLOG_S:
4748 if (defaultHandler) {
4749 reportDefault(parser, encoding, s, next);
4750 if (ps_parsing == XML_FINISHED)
4751 return XML_ERROR_ABORTED;
4752 }
4753 *nextPtr = next;
4754 return XML_ERROR_NONE;
4755 case XML_TOK_NONE:
4756 *nextPtr = s;
4757 return XML_ERROR_NONE;
4758 case XML_TOK_PROLOG_S:
4759 if (defaultHandler)
4760 reportDefault(parser, encoding, s, next);
4761 break;
4762 case XML_TOK_PI:
4764 return XML_ERROR_NO_MEMORY;
4765 break;
4766 case XML_TOK_COMMENT:
4767 if (!reportComment(parser, encoding, s, next))
4768 return XML_ERROR_NO_MEMORY;
4769 break;
4770 case XML_TOK_INVALID:
4771 eventPtr = next;
4773 case XML_TOK_PARTIAL:
4774 if (!ps_finalBuffer) {
4775 *nextPtr = s;
4776 return XML_ERROR_NONE;
4777 }
4780 if (!ps_finalBuffer) {
4781 *nextPtr = s;
4782 return XML_ERROR_NONE;
4783 }
4785 default:
4787 }
4788 eventPtr = s = next;
4789 switch (ps_parsing) {
4790 case XML_SUSPENDED:
4791 *nextPtr = next;
4792 return XML_ERROR_NONE;
4793 case XML_FINISHED:
4794 return XML_ERROR_ABORTED;
4795 default: ;
4796 }
4797 }
4798}
@ XML_ERROR_JUNK_AFTER_DOC_ELEMENT
Definition: expat.h:64

References defaultHandler, epilogProcessor, eventEndPtr, eventPtr, geant4_check_module_cycles::parser, processor, ps_finalBuffer, ps_parsing, reportComment(), reportDefault(), reportProcessingInstruction(), s, XML_ERROR_ABORTED, XML_ERROR_INVALID_TOKEN, XML_ERROR_JUNK_AFTER_DOC_ELEMENT, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_PARTIAL_CHAR, XML_ERROR_UNCLOSED_TOKEN, XML_FINISHED, XML_SUSPENDED, XML_TOK_COMMENT, XML_TOK_INVALID, XML_TOK_NONE, XML_TOK_PARTIAL, XML_TOK_PARTIAL_CHAR, XML_TOK_PI, XML_TOK_PROLOG_S, and XmlPrologTok.

◆ errorProcessor()

static enum XML_Error PTRCALL errorProcessor ( XML_Parser  parser,
const char *  s,
const char *  end,
const char **  nextPtr 
)
static

Definition at line 4919 of file xmlparse.cc.

4923{
4924 return errorCode;
4925}
#define errorCode
Definition: xmlparse.cc:618

References errorCode.

◆ externalEntityContentProcessor()

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

Definition at line 2222 of file xmlparse.cc.

2226{
2227 enum XML_Error result = doContent(parser, 1, encoding, start, end,
2228 endPtr, (XML_Bool)!ps_finalBuffer);
2229 if (result == XML_ERROR_NONE) {
2230 if (!storeRawNames(parser))
2231 return XML_ERROR_NO_MEMORY;
2232 }
2233 return result;
2234}

References doContent(), geant4_check_module_cycles::parser, ps_finalBuffer, storeRawNames(), XML_ERROR_NO_MEMORY, and XML_ERROR_NONE.

◆ externalEntityInitProcessor()

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

Definition at line 2121 of file xmlparse.cc.

2125{
2126 enum XML_Error result = initializeEncoding(parser);
2127 if (result != XML_ERROR_NONE)
2128 return result;
2130 return externalEntityInitProcessor2(parser, start, end, endPtr);
2131}
static Processor externalEntityInitProcessor2
Definition: xmlparse.cc:325
static enum XML_Error initializeEncoding(XML_Parser parser)
Definition: xmlparse.cc:3396

References externalEntityInitProcessor2, initializeEncoding(), geant4_check_module_cycles::parser, processor, and XML_ERROR_NONE.

◆ externalEntityInitProcessor2()

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

Definition at line 2134 of file xmlparse.cc.

2138{
2139 const char *next = start; /* XmlContentTok doesn't always set the last arg */
2140 int tok = XmlContentTok(encoding, start, end, &next);
2141 switch (tok) {
2142 case XML_TOK_BOM:
2143 /* If we are at the end of the buffer, this would cause the next stage,
2144 i.e. externalEntityInitProcessor3, to pass control directly to
2145 doContent (by detecting XML_TOK_NONE) without processing any xml text
2146 declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
2147 */
2148 if (next == end && !ps_finalBuffer) {
2149 *endPtr = next;
2150 return XML_ERROR_NONE;
2151 }
2152 start = next;
2153 break;
2154 case XML_TOK_PARTIAL:
2155 if (!ps_finalBuffer) {
2156 *endPtr = start;
2157 return XML_ERROR_NONE;
2158 }
2159 eventPtr = start;
2162 if (!ps_finalBuffer) {
2163 *endPtr = start;
2164 return XML_ERROR_NONE;
2165 }
2166 eventPtr = start;
2168 }
2170 return externalEntityInitProcessor3(parser, start, end, endPtr);
2171}
static Processor externalEntityInitProcessor3
Definition: xmlparse.cc:326

References eventPtr, externalEntityInitProcessor3, geant4_check_module_cycles::parser, processor, ps_finalBuffer, XML_ERROR_NONE, XML_ERROR_PARTIAL_CHAR, XML_ERROR_UNCLOSED_TOKEN, XML_TOK_BOM, XML_TOK_PARTIAL, XML_TOK_PARTIAL_CHAR, and XmlContentTok.

◆ externalEntityInitProcessor3()

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

Definition at line 2174 of file xmlparse.cc.

2178{
2179 int tok;
2180 const char *next = start; /* XmlContentTok doesn't always set the last arg */
2181 eventPtr = start;
2182 tok = XmlContentTok(encoding, start, end, &next);
2183 eventEndPtr = next;
2184
2185 switch (tok) {
2186 case XML_TOK_XML_DECL:
2187 {
2188 enum XML_Error result;
2189 result = processXmlDecl(parser, 1, start, next);
2190 if (result != XML_ERROR_NONE)
2191 return result;
2192 switch (ps_parsing) {
2193 case XML_SUSPENDED:
2194 *endPtr = next;
2195 return XML_ERROR_NONE;
2196 case XML_FINISHED:
2197 return XML_ERROR_ABORTED;
2198 default:
2199 start = next;
2200 }
2201 }
2202 break;
2203 case XML_TOK_PARTIAL:
2204 if (!ps_finalBuffer) {
2205 *endPtr = start;
2206 return XML_ERROR_NONE;
2207 }
2210 if (!ps_finalBuffer) {
2211 *endPtr = start;
2212 return XML_ERROR_NONE;
2213 }
2215 }
2217 tagLevel = 1;
2218 return externalEntityContentProcessor(parser, start, end, endPtr);
2219}

References eventEndPtr, eventPtr, externalEntityContentProcessor, geant4_check_module_cycles::parser, processor, processXmlDecl(), ps_finalBuffer, ps_parsing, tagLevel, XML_ERROR_ABORTED, XML_ERROR_NONE, XML_ERROR_PARTIAL_CHAR, XML_ERROR_UNCLOSED_TOKEN, XML_FINISHED, XML_SUSPENDED, XML_TOK_PARTIAL, XML_TOK_PARTIAL_CHAR, XML_TOK_XML_DECL, and XmlContentTok.

◆ generate_hash_secret_salt()

static unsigned long generate_hash_secret_salt ( void  )
static

Definition at line 700 of file xmlparse.cc.

701{
702 unsigned int seed = time(NULL) % UINT_MAX;
703 srand(seed);
704 return rand();
705}

Referenced by startParsing().

◆ getAttributeId()

static ATTRIBUTE_ID * getAttributeId ( XML_Parser  parser,
const ENCODING enc,
const char *  start,
const char *  end 
)
static

Definition at line 5436 of file xmlparse.cc.

5438{
5439 DTD * const dtd = _dtd; /* save one level of indirection */
5440 ATTRIBUTE_ID *id;
5441 const XML_Char *name;
5442 if (!poolAppendChar(&dtd->pool, XML_T('\0')))
5443 return NULL;
5444 name = poolStoreString(&dtd->pool, enc, start, end);
5445 if (!name)
5446 return NULL;
5447 /* skip quotation mark - its storage will be re-used (like in name[-1]) */
5448 ++name;
5449 id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, sizeof(ATTRIBUTE_ID));
5450 if (!id)
5451 return NULL;
5452 if (id->name != name)
5453 poolDiscard(&dtd->pool);
5454 else {
5455 poolFinish(&dtd->pool);
5456 if (!ns)
5457 ;
5458 else if (name[0] == XML_T(ASCII_x)
5459 && name[1] == XML_T(ASCII_m)
5460 && name[2] == XML_T(ASCII_l)
5461 && name[3] == XML_T(ASCII_n)
5462 && name[4] == XML_T(ASCII_s)
5463 && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) {
5464 if (name[5] == XML_T('\0'))
5465 id->prefix = &dtd->defaultPrefix;
5466 else
5467 id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, sizeof(PREFIX));
5468 id->xmlns = XML_TRUE;
5469 }
5470 else {
5471 int i;
5472 for (i = 0; name[i]; i++) {
5473 /* attributes without prefix are *not* in the default namespace */
5474 if (name[i] == XML_T(ASCII_COLON)) {
5475 int j;
5476 for (j = 0; j < i; j++) {
5477 if (!poolAppendChar(&dtd->pool, name[j]))
5478 return NULL;
5479 }
5480 if (!poolAppendChar(&dtd->pool, XML_T('\0')))
5481 return NULL;
5482 id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool),
5483 sizeof(PREFIX));
5484 if (id->prefix->name == poolStart(&dtd->pool))
5485 poolFinish(&dtd->pool);
5486 else
5487 poolDiscard(&dtd->pool);
5488 break;
5489 }
5490 }
5491 }
5492 }
5493 return id;
5494}
struct prefix PREFIX

References _dtd, ASCII_COLON, ASCII_l, ASCII_m, ASCII_n, ASCII_s, ASCII_x, DTD::attributeIds, DTD::defaultPrefix, lookup(), prefix::name, attribute_id::name, G4InuclParticleNames::name(), ns, geant4_check_module_cycles::parser, DTD::pool, poolAppendChar, poolDiscard, poolFinish, poolStart, poolStoreString(), attribute_id::prefix, DTD::prefixes, XML_T, and XML_TRUE.

Referenced by doProlog(), and storeAtts().

◆ getContext()

static const XML_Char * getContext ( XML_Parser  parser)
static

Definition at line 5499 of file xmlparse.cc.

5500{
5501 DTD * const dtd = _dtd; /* save one level of indirection */
5502 HASH_TABLE_ITER iter;
5503 XML_Bool needSep = XML_FALSE;
5504
5505 if (dtd->defaultPrefix.binding) {
5506 int i;
5507 int len;
5509 return NULL;
5510 len = dtd->defaultPrefix.binding->uriLen;
5512 len--;
5513 for (i = 0; i < len; i++)
5515 return NULL;
5516 needSep = XML_TRUE;
5517 }
5518
5519 hashTableIterInit(&iter, &(dtd->prefixes));
5520 for (;;) {
5521 int i;
5522 int len;
5523 const XML_Char *s;
5525 if (!prefix)
5526 break;
5527 if (!prefix->binding)
5528 continue;
5529 if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
5530 return NULL;
5531 for (s = prefix->name; *s; s++)
5532 if (!poolAppendChar(&tempPool, *s))
5533 return NULL;
5535 return NULL;
5536 len = prefix->binding->uriLen;
5538 len--;
5539 for (i = 0; i < len; i++)
5541 return NULL;
5542 needSep = XML_TRUE;
5543 }
5544
5545
5546 hashTableIterInit(&iter, &(dtd->generalEntities));
5547 for (;;) {
5548 const XML_Char *s;
5549 ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
5550 if (!e)
5551 break;
5552 if (!e->open)
5553 continue;
5554 if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
5555 return NULL;
5556 for (s = e->name; *s; s++)
5557 if (!poolAppendChar(&tempPool, *s))
5558 return 0;
5559 needSep = XML_TRUE;
5560 }
5561
5562 if (!poolAppendChar(&tempPool, XML_T('\0')))
5563 return NULL;
5564 return tempPool.start;
5565}
#define ASCII_EQUALS
Definition: ascii.h:81
#define CONTEXT_SEP
Definition: xmlparse.cc:5496

References _dtd, ASCII_EQUALS, prefix::binding, CONTEXT_SEP, DTD::defaultPrefix, DTD::generalEntities, hashTableIterInit(), hashTableIterNext(), prefix::name, ENTITY::name, namespaceSeparator, ENTITY::open, poolAppendChar, DTD::prefixes, s, tempPool, binding::uri, binding::uriLen, XML_FALSE, XML_T, and XML_TRUE.

Referenced by doContent().

◆ getElementType()

static ELEMENT_TYPE * getElementType ( XML_Parser  parser,
const ENCODING enc,
const char *  ptr,
const char *  end 
)
static

Definition at line 6387 of file xmlparse.cc.

6391{
6392 DTD * const dtd = _dtd; /* save one level of indirection */
6393 const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end);
6394 ELEMENT_TYPE *ret;
6395
6396 if (!name)
6397 return NULL;
6398 ret = (ELEMENT_TYPE *) lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE));
6399 if (!ret)
6400 return NULL;
6401 if (ret->name != name)
6402 poolDiscard(&dtd->pool);
6403 else {
6404 poolFinish(&dtd->pool);
6405 if (!setElementTypePrefix(parser, ret))
6406 return NULL;
6407 }
6408 return ret;
6409}
static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *)
Definition: xmlparse.cc:5406

References _dtd, DTD::elementTypes, lookup(), ELEMENT_TYPE::name, G4InuclParticleNames::name(), geant4_check_module_cycles::parser, DTD::pool, poolDiscard, poolFinish, poolStoreString(), and setElementTypePrefix().

Referenced by doProlog().

◆ handleUnknownEncoding()

static enum XML_Error handleUnknownEncoding ( XML_Parser  parser,
const XML_Char encodingName 
)
static

Definition at line 3514 of file xmlparse.cc.

3515{
3517 XML_Encoding info;
3518 int i;
3519 for (i = 0; i < 256; i++)
3520 info.map[i] = -1;
3521 info.convert = NULL;
3522 info.data = NULL;
3523 info.release = NULL;
3525 &info)) {
3526 ENCODING *enc;
3528 if (!unknownEncodingMem) {
3529 if (info.release)
3530 info.release(info.data);
3531 return XML_ERROR_NO_MEMORY;
3532 }
3533 enc = (ns
3536 info.map,
3537 info.convert,
3538 info.data);
3539 if (enc) {
3541 unknownEncodingRelease = info.release;
3542 encoding = enc;
3543 return XML_ERROR_NONE;
3544 }
3545 }
3546 if (info.release != NULL)
3547 info.release(info.data);
3548 }
3550}
@ XML_ERROR_UNKNOWN_ENCODING
Definition: expat.h:73
void * data
Definition: expat.h:508
int map[256]
Definition: expat.h:507
#define unknownEncodingRelease
Definition: xmlparse.cc:612
#define unknownEncodingHandler
Definition: xmlparse.cc:600
#define XmlInitUnknownEncodingNS
Definition: xmlparse.cc:57
#define unknownEncodingMem
Definition: xmlparse.cc:608
#define unknownEncodingHandlerData
Definition: xmlparse.cc:610
#define unknownEncodingData
Definition: xmlparse.cc:609
ENCODING * XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, void *userData)
Definition: xmltok.cc:1351
int XmlSizeOfUnknownEncoding(void)
Definition: xmltok.cc:1263

References XML_Encoding::data, MALLOC, XML_Encoding::map, ns, unknownEncodingData, unknownEncodingHandler, unknownEncodingHandlerData, unknownEncodingMem, unknownEncodingRelease, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_UNKNOWN_ENCODING, XmlInitUnknownEncoding(), XmlInitUnknownEncodingNS, and XmlSizeOfUnknownEncoding().

Referenced by initializeEncoding(), and processXmlDecl().

◆ hash()

static unsigned long FASTCALL hash ( XML_Parser  parser,
KEY  s 
)
static

Definition at line 5967 of file xmlparse.cc.

5968{
5969 unsigned long h = hash_secret_salt;
5970 while (*s)
5971 h = CHAR_HASH(h, *s++);
5972 return h;
5973}
#define hash_secret_salt
Definition: xmlparse.cc:674
#define CHAR_HASH(h, c)
Definition: xmlparse.cc:119

References CHAR_HASH, hash_secret_salt, and s.

Referenced by G4VtkSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitiveTensorGlyph(), G4ITReaction::GetHash(), lookup(), std::hash< G4Polyhedron >::operator()(), std::hash< G4VisAttributes >::operator()(), and storeAtts().

◆ hashTableClear()

static void FASTCALL hashTableClear ( HASH_TABLE table)
static

Definition at line 6055 of file xmlparse.cc.

6056{
6057 size_t i;
6058 for (i = 0; i < table->size; i++) {
6059 table->mem->free_fcn(table->v[i]);
6060 table->v[i] = NULL;
6061 }
6062 table->used = 0;
6063}
NAMED ** v
Definition: xmlparse.cc:104
size_t used
Definition: xmlparse.cc:107
const XML_Memory_Handling_Suite * mem
Definition: xmlparse.cc:108
size_t size
Definition: xmlparse.cc:106
void(* free_fcn)(void *ptr)
Definition: expat.h:199

References XML_Memory_Handling_Suite::free_fcn, HASH_TABLE::mem, HASH_TABLE::size, HASH_TABLE::used, and HASH_TABLE::v.

Referenced by dtdReset().

◆ hashTableDestroy()

static void FASTCALL hashTableDestroy ( HASH_TABLE table)
static

Definition at line 6066 of file xmlparse.cc.

6067{
6068 size_t i;
6069 for (i = 0; i < table->size; i++)
6070 table->mem->free_fcn(table->v[i]);
6071 table->mem->free_fcn(table->v);
6072}

References XML_Memory_Handling_Suite::free_fcn, HASH_TABLE::mem, HASH_TABLE::size, and HASH_TABLE::v.

Referenced by dtdDestroy().

◆ hashTableInit()

static void FASTCALL hashTableInit ( HASH_TABLE p,
const XML_Memory_Handling_Suite ms 
)
static

Definition at line 6075 of file xmlparse.cc.

6076{
6077 p->power = 0;
6078 p->size = 0;
6079 p->used = 0;
6080 p->v = NULL;
6081 p->mem = ms;
6082}
unsigned char power
Definition: xmlparse.cc:105

References HASH_TABLE::mem, ms, HASH_TABLE::power, HASH_TABLE::size, HASH_TABLE::used, and HASH_TABLE::v.

Referenced by dtdCreate().

◆ hashTableIterInit()

static void FASTCALL hashTableIterInit ( HASH_TABLE_ITER iter,
const HASH_TABLE table 
)
static

Definition at line 6085 of file xmlparse.cc.

6086{
6087 iter->p = table->v;
6088 iter->end = iter->p + table->size;
6089}
NAMED ** p
Definition: xmlparse.cc:137
NAMED ** end
Definition: xmlparse.cc:138

References HASH_TABLE_ITER::end, HASH_TABLE_ITER::p, HASH_TABLE::size, and HASH_TABLE::v.

Referenced by copyEntityTable(), dtdCopy(), dtdDestroy(), dtdReset(), and getContext().

◆ hashTableIterNext()

static NAMED *FASTCALL hashTableIterNext ( HASH_TABLE_ITER iter)
static

Definition at line 6092 of file xmlparse.cc.

6093{
6094 while (iter->p != iter->end) {
6095 NAMED *tem = *(iter->p)++;
6096 if (tem)
6097 return tem;
6098 }
6099 return NULL;
6100}

References HASH_TABLE_ITER::end, and HASH_TABLE_ITER::p.

Referenced by copyEntityTable(), dtdCopy(), dtdDestroy(), dtdReset(), and getContext().

◆ initializeEncoding()

static enum XML_Error initializeEncoding ( XML_Parser  parser)
static

Definition at line 3396 of file xmlparse.cc.

3397{
3398 const char *s;
3399#ifdef XML_UNICODE
3400 char encodingBuf[128];
3402 s = NULL;
3403 else {
3404 int i;
3405 for (i = 0; protocolEncodingName[i]; i++) {
3406 if (i == sizeof(encodingBuf) - 1
3407 || (protocolEncodingName[i] & ~0x7f) != 0) {
3408 encodingBuf[0] = '\0';
3409 break;
3410 }
3411 encodingBuf[i] = (char)protocolEncodingName[i];
3412 }
3413 encodingBuf[i] = '\0';
3414 s = encodingBuf;
3415 }
3416#else
3418#endif
3420 return XML_ERROR_NONE;
3422}
#define initEncoding
Definition: xmlparse.cc:606
static enum XML_Error handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
Definition: xmlparse.cc:3514
#define protocolEncodingName
Definition: xmlparse.cc:613
#define XmlInitEncodingNS
Definition: xmlparse.cc:56
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name)

References encoding, handleUnknownEncoding(), initEncoding, ns, geant4_check_module_cycles::parser, protocolEncodingName, s, XML_ERROR_NONE, XmlInitEncoding(), and XmlInitEncodingNS.

Referenced by externalEntityInitProcessor(), and prologInitProcessor().

◆ internalEntityProcessor()

static enum XML_Error PTRCALL internalEntityProcessor ( XML_Parser  parser,
const char *  s,
const char *  end,
const char **  nextPtr 
)
static

Definition at line 4858 of file xmlparse.cc.

4862{
4863 ENTITY *entity;
4864 const char *textStart, *textEnd;
4865 const char *next;
4866 enum XML_Error result;
4868 if (!openEntity)
4870
4871 entity = openEntity->entity;
4872 textStart = ((char *)entity->textPtr) + entity->processed;
4873 textEnd = (char *)(entity->textPtr + entity->textLen);
4874
4875#ifdef XML_DTD
4876 if (entity->is_param) {
4877 int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
4878 result = doProlog(parser, internalEncoding, textStart, textEnd, tok,
4879 next, &next, XML_FALSE);
4880 }
4881 else
4882#endif /* XML_DTD */
4883 result = doContent(parser, openEntity->startTagLevel, internalEncoding,
4884 textStart, textEnd, &next, XML_FALSE);
4885
4886 if (result != XML_ERROR_NONE)
4887 return result;
4888 else if (textEnd != next && ps_parsing == XML_SUSPENDED) {
4889 entity->processed = (int)(next - (char *)entity->textPtr);
4890 return result;
4891 }
4892 else {
4893 entity->open = XML_FALSE;
4894 openInternalEntities = openEntity->next;
4895 /* put openEntity back in list of free instances */
4896 openEntity->next = freeInternalEntities;
4897 freeInternalEntities = openEntity;
4898 }
4899
4900#ifdef XML_DTD
4901 if (entity->is_param) {
4902 int tok;
4904 tok = XmlPrologTok(encoding, s, end, &next);
4905 return doProlog(parser, encoding, s, end, tok, next, nextPtr,
4907 }
4908 else
4909#endif /* XML_DTD */
4910 {
4912 /* see externalEntityContentProcessor vs contentProcessor */
4913 return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
4914 nextPtr, (XML_Bool)!ps_finalBuffer);
4915 }
4916}
int processed
Definition: xmlparse.cc:201
struct open_internal_entity * next
Definition: xmlparse.cc:300
static Processor prologProcessor
Definition: xmlparse.cc:311
static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, int tok, const char *next, const char **nextPtr, XML_Bool haveMore)
Definition: xmlparse.cc:3750
#define freeInternalEntities
Definition: xmlparse.cc:624

References contentProcessor, doContent(), doProlog(), open_internal_entity::entity, freeInternalEntities, internalEncoding, ENTITY::is_param, open_internal_entity::next, ENTITY::open, openInternalEntities, parentParser, geant4_check_module_cycles::parser, ENTITY::processed, processor, prologProcessor, ps_finalBuffer, ps_parsing, s, open_internal_entity::startTagLevel, ENTITY::textLen, ENTITY::textPtr, XML_ERROR_NONE, XML_ERROR_UNEXPECTED_STATE, XML_FALSE, XML_SUSPENDED, and XmlPrologTok.

◆ keyeq()

static XML_Bool FASTCALL keyeq ( KEY  s1,
KEY  s2 
)
static

Definition at line 5958 of file xmlparse.cc.

5959{
5960 for (; *s1 == *s2; s1++, s2++)
5961 if (*s1 == 0)
5962 return XML_TRUE;
5963 return XML_FALSE;
5964}

References XML_FALSE, and XML_TRUE.

Referenced by lookup().

◆ lookup()

static NAMED * lookup ( XML_Parser  parser,
HASH_TABLE table,
KEY  name,
size_t  createSize 
)
static

Definition at line 5976 of file xmlparse.cc.

5977{
5978 size_t i;
5979 if (table->size == 0) {
5980 size_t tsize;
5981 if (!createSize)
5982 return NULL;
5983 table->power = INIT_POWER;
5984 /* table->size is a power of 2 */
5985 table->size = (size_t)1 << INIT_POWER;
5986 tsize = table->size * sizeof(NAMED *);
5987 table->v = (NAMED **)table->mem->malloc_fcn(tsize);
5988 if (!table->v) {
5989 table->size = 0;
5990 return NULL;
5991 }
5992 memset(table->v, 0, tsize);
5993 i = hash(parser, name) & ((unsigned long)table->size - 1);
5994 }
5995 else {
5996 unsigned long h = hash(parser, name);
5997 unsigned long mask = (unsigned long)table->size - 1;
5998 unsigned char step = 0;
5999 i = h & mask;
6000 while (table->v[i]) {
6001 if (keyeq(name, table->v[i]->name))
6002 return table->v[i];
6003 if (!step)
6004 step = PROBE_STEP(h, mask, table->power);
6005 i < step ? (i += table->size - step) : (i -= step);
6006 }
6007 if (!createSize)
6008 return NULL;
6009
6010 /* check for overflow (table is half full) */
6011 if (table->used >> (table->power - 1)) {
6012 unsigned char newPower = table->power + 1;
6013 size_t newSize = (size_t)1 << newPower;
6014 unsigned long newMask = (unsigned long)newSize - 1;
6015 size_t tsize = newSize * sizeof(NAMED *);
6016 NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize);
6017 if (!newV)
6018 return NULL;
6019 memset(newV, 0, tsize);
6020 for (i = 0; i < table->size; i++)
6021 if (table->v[i]) {
6022 unsigned long newHash = hash(parser, table->v[i]->name);
6023 size_t j = newHash & newMask;
6024 step = 0;
6025 while (newV[j]) {
6026 if (!step)
6027 step = PROBE_STEP(newHash, newMask, newPower);
6028 j < step ? (j += newSize - step) : (j -= step);
6029 }
6030 newV[j] = table->v[i];
6031 }
6032 table->mem->free_fcn(table->v);
6033 table->v = newV;
6034 table->power = newPower;
6035 table->size = newSize;
6036 i = h & newMask;
6037 step = 0;
6038 while (table->v[i]) {
6039 if (!step)
6040 step = PROBE_STEP(h, newMask, newPower);
6041 i < step ? (i += newSize - step) : (i -= step);
6042 }
6043 }
6044 }
6045 table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize);
6046 if (!table->v[i])
6047 return NULL;
6048 memset(table->v[i], 0, createSize);
6049 table->v[i]->name = name;
6050 (table->used)++;
6051 return table->v[i];
6052}
KEY name
Definition: xmlparse.cc:100
void *(* malloc_fcn)(size_t size)
Definition: expat.h:197
#define INIT_POWER
Definition: xmlparse.cc:5955
#define PROBE_STEP(hash, mask, power)
Definition: xmlparse.cc:133
static XML_Bool FASTCALL keyeq(KEY s1, KEY s2)
Definition: xmlparse.cc:5958
static unsigned long FASTCALL hash(XML_Parser parser, KEY s)
Definition: xmlparse.cc:5967

References XML_Memory_Handling_Suite::free_fcn, hash(), INIT_POWER, keyeq(), XML_Memory_Handling_Suite::malloc_fcn, HASH_TABLE::mem, NAMED::name, G4InuclParticleNames::name(), geant4_check_module_cycles::parser, HASH_TABLE::power, PROBE_STEP, HASH_TABLE::size, HASH_TABLE::used, and HASH_TABLE::v.

Referenced by appendAttributeValue(), copyEntityTable(), doContent(), doProlog(), dtdCopy(), getAttributeId(), getElementType(), setContext(), setElementTypePrefix(), storeAtts(), and storeEntityValue().

◆ moveToFreeBindingList()

static void FASTCALL moveToFreeBindingList ( XML_Parser  parser,
BINDING bindings 
)
static

Definition at line 920 of file xmlparse.cc.

921{
922 while (bindings) {
923 BINDING *b = bindings;
924 bindings = bindings->nextTagBinding;
926 freeBindingList = b;
927 }
928}

References freeBindingList, and binding::nextTagBinding.

Referenced by XML_ParserReset().

◆ nextScaffoldPart()

static int FASTCALL nextScaffoldPart ( XML_Parser  parser)
static

Definition at line 6280 of file xmlparse.cc.

6281{
6282 DTD * const dtd = _dtd; /* save one level of indirection */
6283 CONTENT_SCAFFOLD * me;
6284 int next;
6285
6286 if (!dtd->scaffIndex) {
6287 dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int));
6288 if (!dtd->scaffIndex)
6289 return -1;
6290 dtd->scaffIndex[0] = 0;
6291 }
6292
6293 if (dtd->scaffCount >= dtd->scaffSize) {
6294 CONTENT_SCAFFOLD *temp;
6295 if (dtd->scaffold) {
6296 temp = (CONTENT_SCAFFOLD *)
6297 REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));
6298 if (temp == NULL)
6299 return -1;
6300 dtd->scaffSize *= 2;
6301 }
6302 else {
6304 * sizeof(CONTENT_SCAFFOLD));
6305 if (temp == NULL)
6306 return -1;
6308 }
6309 dtd->scaffold = temp;
6310 }
6311 next = dtd->scaffCount++;
6312 me = &dtd->scaffold[next];
6313 if (dtd->scaffLevel) {
6314 CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]];
6315 if (parent->lastchild) {
6316 dtd->scaffold[parent->lastchild].nextsib = next;
6317 }
6318 if (!parent->childcnt)
6319 parent->firstchild = next;
6320 parent->lastchild = next;
6321 parent->childcnt++;
6322 }
6323 me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0;
6324 return next;
6325}
#define INIT_SCAFFOLD_ELEMENTS
Definition: xmlparse.cc:221

References _dtd, CONTENT_SCAFFOLD::childcnt, CONTENT_SCAFFOLD::firstchild, groupSize, INIT_SCAFFOLD_ELEMENTS, CONTENT_SCAFFOLD::lastchild, MALLOC, CONTENT_SCAFFOLD::nextsib, REALLOC, DTD::scaffCount, DTD::scaffIndex, DTD::scaffLevel, DTD::scaffold, and DTD::scaffSize.

Referenced by doProlog().

◆ normalizeLines()

static void FASTCALL normalizeLines ( XML_Char s)
static

Definition at line 5260 of file xmlparse.cc.

5261{
5262 XML_Char *p;
5263 for (;; s++) {
5264 if (*s == XML_T('\0'))
5265 return;
5266 if (*s == 0xD)
5267 break;
5268 }
5269 p = s;
5270 do {
5271 if (*s == 0xD) {
5272 *p++ = 0xA;
5273 if (*++s == 0xA)
5274 s++;
5275 }
5276 else
5277 *p++ = *s++;
5278 } while (*s);
5279 *p = XML_T('\0');
5280}

References s, and XML_T.

Referenced by reportComment(), and reportProcessingInstruction().

◆ normalizePublicId()

static void FASTCALL normalizePublicId ( XML_Char s)
static

Definition at line 5629 of file xmlparse.cc.

5630{
5631 XML_Char *p = publicId;
5632 XML_Char *s;
5633 for (s = publicId; *s; s++) {
5634 switch (*s) {
5635 case 0x20:
5636 case 0xD:
5637 case 0xA:
5638 if (p != publicId && p[-1] != 0x20)
5639 *p++ = 0x20;
5640 break;
5641 default:
5642 *p++ = *s;
5643 }
5644 }
5645 if (p != publicId && p[-1] == 0x20)
5646 --p;
5647 *p = XML_T('\0');
5648}

References s, and XML_T.

Referenced by doProlog().

◆ parserCreate()

static XML_Parser parserCreate ( const XML_Char encodingName,
const XML_Memory_Handling_Suite memsuite,
const XML_Char nameSep,
DTD dtd 
)
static

Definition at line 731 of file xmlparse.cc.

735{
737
738 if (memsuite) {
741 memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));
742 if (parser != NULL) {
743 mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
744 mtemp->malloc_fcn = memsuite->malloc_fcn;
745 mtemp->realloc_fcn = memsuite->realloc_fcn;
746 mtemp->free_fcn = memsuite->free_fcn;
747 }
748 }
749 else {
751 parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct));
752 if (parser != NULL) {
753 mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
754 mtemp->malloc_fcn = malloc;
755 mtemp->realloc_fcn = realloc;
756 mtemp->free_fcn = free;
757 }
758 }
759
760 if (!parser)
761 return parser;
762
763 buffer = NULL;
764 bufferLim = NULL;
765
767 atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE));
768 if (atts == NULL) {
769 FREE(parser);
770 return NULL;
771 }
772#ifdef XML_ATTR_INFO
773 attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo));
774 if (attInfo == NULL) {
775 FREE(atts);
776 FREE(parser);
777 return NULL;
778 }
779#endif
781 if (dataBuf == NULL) {
782 FREE(atts);
783#ifdef XML_ATTR_INFO
784 FREE(attInfo);
785#endif
786 FREE(parser);
787 return NULL;
788 }
790
791 if (dtd)
792 _dtd = dtd;
793 else {
794 _dtd = dtdCreate(&parser->m_mem);
795 if (_dtd == NULL) {
796 FREE(dataBuf);
797 FREE(atts);
798#ifdef XML_ATTR_INFO
799 FREE(attInfo);
800#endif
801 FREE(parser);
802 return NULL;
803 }
804 }
805
806 freeBindingList = NULL;
807 freeTagList = NULL;
809
810 groupSize = 0;
811 groupConnector = NULL;
812
815
817 ns = XML_FALSE;
819
820 nsAtts = NULL;
821 nsAttsVersion = 0;
822 nsAttsPower = 0;
823
824 poolInit(&tempPool, &(parser->m_mem));
825 poolInit(&temp2Pool, &(parser->m_mem));
826 parserInit(parser, encodingName);
827
828 if (encodingName && !protocolEncodingName) {
830 return NULL;
831 }
832
833 if (nameSep) {
834 ns = XML_TRUE;
836 namespaceSeparator = *nameSep;
837 }
838 else {
840 }
841
842 return parser;
843}
#define ASCII_EXCL
Definition: ascii.h:72
struct XML_ParserStruct * XML_Parser
Definition: expat.h:25
void *(* realloc_fcn)(void *ptr, size_t size)
Definition: expat.h:198
#define INIT_DATA_BUF_SIZE
Definition: xmlparse.cc:142
#define nsAtts
Definition: xmlparse.cc:657
#define nsAttsVersion
Definition: xmlparse.cc:658
#define nsAttsPower
Definition: xmlparse.cc:659
#define INIT_ATTS_SIZE
Definition: xmlparse.cc:143
#define XmlGetInternalEncodingNS
Definition: xmlparse.cc:59
#define XmlGetInternalEncoding
Definition: xmlparse.cc:46
#define bufferLim
Definition: xmlparse.cc:633
#define buffer
Definition: xmlparse.cc:628
static void parserInit(XML_Parser parser, const XML_Char *encodingName)
Definition: xmlparse.cc:846
#define attsSize
Definition: xmlparse.cc:654
#define attInfo
Definition: xmlparse.cc:660
static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms)
Definition: xmlparse.cc:5651
void XMLCALL XML_ParserFree(XML_Parser parser)
Definition: xmlparse.cc:1136

References _dtd, ASCII_EXCL, attInfo, atts, attsSize, buffer, bufferLim, dataBuf, dataBufEnd, dtdCreate(), FREE, free, XML_Memory_Handling_Suite::free_fcn, freeBindingList, freeInternalEntities, freeTagList, groupConnector, groupSize, INIT_ATTS_SIZE, INIT_DATA_BUF_SIZE, internalEncoding, MALLOC, XML_Memory_Handling_Suite::malloc_fcn, namespaceSeparator, ns, ns_triplets, nsAtts, nsAttsPower, nsAttsVersion, geant4_check_module_cycles::parser, parserInit(), poolInit(), protocolEncodingName, XML_Memory_Handling_Suite::realloc_fcn, temp2Pool, tempPool, unknownEncodingHandler, unknownEncodingHandlerData, XML_FALSE, XML_ParserFree(), XML_TRUE, XmlGetInternalEncoding, and XmlGetInternalEncodingNS.

Referenced by XML_ExternalEntityParserCreate(), and XML_ParserCreate_MM().

◆ parserInit()

static void parserInit ( XML_Parser  parser,
const XML_Char encodingName 
)
static

Definition at line 846 of file xmlparse.cc.

847{
850 protocolEncodingName = (encodingName != NULL
851 ? poolCopyString(&tempPool, encodingName)
852 : NULL);
853 curBase = NULL;
855 userData = NULL;
856 handlerArg = NULL;
857 startElementHandler = NULL;
858 endElementHandler = NULL;
861 commentHandler = NULL;
864 defaultHandler = NULL;
868 notationDeclHandler = NULL;
875 elementDeclHandler = NULL;
876 attlistDeclHandler = NULL;
877 entityDeclHandler = NULL;
878 xmlDeclHandler = NULL;
882 parseEndPtr = NULL;
883 declElementType = NULL;
884 declAttributeId = NULL;
885 declEntity = NULL;
886 doctypeName = NULL;
887 doctypeSysid = NULL;
888 doctypePubid = NULL;
889 declAttributeType = NULL;
890 declNotationName = NULL;
894 memset(&position, 0, sizeof(POSITION));
896 eventPtr = NULL;
897 eventEndPtr = NULL;
898 positionPtr = NULL;
901 tagLevel = 0;
902 tagStack = NULL;
903 inheritedBindings = NULL;
904 nSpecifiedAtts = 0;
905 unknownEncodingMem = NULL;
907 unknownEncodingData = NULL;
908 parentParser = NULL;
910#ifdef XML_DTD
911 isParamEntity = XML_FALSE;
912 useForeignDTD = XML_FALSE;
913 paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
914#endif
916}
@ XML_INITIALIZED
Definition: expat.h:836
@ XML_PARAM_ENTITY_PARSING_NEVER
Definition: expat.h:877
#define nSpecifiedAtts
Definition: xmlparse.cc:655
#define processingInstructionHandler
Definition: xmlparse.cc:577
#define inheritedBindings
Definition: xmlparse.cc:651
#define commentHandler
Definition: xmlparse.cc:579
#define userData
Definition: xmlparse.cc:572
static Processor prologInitProcessor
Definition: xmlparse.cc:312
#define bufferEnd
Definition: xmlparse.cc:630
#define xmlDeclHandler
Definition: xmlparse.cc:604
#define parseEndPtr
Definition: xmlparse.cc:632
#define parseEndByteIndex
Definition: xmlparse.cc:631
#define positionPtr
Definition: xmlparse.cc:621
#define bufferPtr
Definition: xmlparse.cc:629
void XmlPrologStateInit(PROLOG_STATE *state)
Definition: xmlrole.cc:1320

References attlistDeclHandler, buffer, bufferEnd, bufferPtr, characterDataHandler, commentHandler, curBase, declAttributeId, declAttributeIsCdata, declAttributeIsId, declAttributeType, declElementType, declEntity, declNotationName, declNotationPublicId, defaultExpandInternalEntities, defaultHandler, doctypeName, doctypePubid, doctypeSysid, elementDeclHandler, endCdataSectionHandler, endDoctypeDeclHandler, endElementHandler, endNamespaceDeclHandler, entityDeclHandler, errorCode, eventEndPtr, eventPtr, externalEntityRefHandler, externalEntityRefHandlerArg, handlerArg, hash_secret_salt, inheritedBindings, initEncoding, notationDeclHandler, notStandaloneHandler, nSpecifiedAtts, openInternalEntities, parentParser, parseEndByteIndex, parseEndPtr, geant4_check_module_cycles::parser, poolCopyString(), positionPtr, processingInstructionHandler, processor, prologInitProcessor, prologState, protocolEncodingName, ps_parsing, skippedEntityHandler, startCdataSectionHandler, startDoctypeDeclHandler, startElementHandler, startNamespaceDeclHandler, tagLevel, tagStack, tempPool, unknownEncodingData, unknownEncodingMem, unknownEncodingRelease, unparsedEntityDeclHandler, userData, XML_ERROR_NONE, XML_FALSE, XML_INITIALIZED, XML_PARAM_ENTITY_PARSING_NEVER, XML_TRUE, xmlDeclHandler, XmlInitEncoding(), and XmlPrologStateInit().

Referenced by parserCreate(), and XML_ParserReset().

◆ poolAppend()

static XML_Char * poolAppend ( STRING_POOL pool,
const ENCODING enc,
const char *  ptr,
const char *  end 
)
static

Definition at line 6151 of file xmlparse.cc.

6153{
6154 if (!pool->ptr && !poolGrow(pool))
6155 return NULL;
6156 for (;;) {
6157 XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
6158 if (ptr == end)
6159 break;
6160 if (!poolGrow(pool))
6161 return NULL;
6162 }
6163 return pool->start;
6164}
const XML_Char * end
Definition: xmlparse.cc:232
XML_Char * ptr
Definition: xmlparse.cc:233
XML_Char * start
Definition: xmlparse.cc:234

References STRING_POOL::end, poolGrow(), STRING_POOL::ptr, STRING_POOL::start, and XmlConvert.

Referenced by appendAttributeValue(), doProlog(), poolStoreString(), and storeEntityValue().

◆ poolAppendString()

static const XML_Char *FASTCALL poolAppendString ( STRING_POOL pool,
const XML_Char s 
)
static

Definition at line 6193 of file xmlparse.cc.

6194{
6195 while (*s) {
6196 if (!poolAppendChar(pool, *s))
6197 return NULL;
6198 s++;
6199 }
6200 return pool->start;
6201}

References poolAppendChar, s, and STRING_POOL::start.

Referenced by doProlog().

◆ poolClear()

static void FASTCALL poolClear ( STRING_POOL pool)
static

Definition at line 6114 of file xmlparse.cc.

6115{
6116 if (!pool->freeBlocks)
6117 pool->freeBlocks = pool->blocks;
6118 else {
6119 BLOCK *p = pool->blocks;
6120 while (p) {
6121 BLOCK *tem = p->next;
6122 p->next = pool->freeBlocks;
6123 pool->freeBlocks = p;
6124 p = tem;
6125 }
6126 }
6127 pool->blocks = NULL;
6128 pool->start = NULL;
6129 pool->ptr = NULL;
6130 pool->end = NULL;
6131}
BLOCK * blocks
Definition: xmlparse.cc:230
BLOCK * freeBlocks
Definition: xmlparse.cc:231
struct block * next
Definition: xmlparse.cc:224

References STRING_POOL::blocks, STRING_POOL::end, STRING_POOL::freeBlocks, block::next, STRING_POOL::ptr, and STRING_POOL::start.

Referenced by doContent(), doProlog(), dtdReset(), processXmlDecl(), reportComment(), reportProcessingInstruction(), and XML_ParserReset().

◆ poolCopyString()

static const XML_Char *FASTCALL poolCopyString ( STRING_POOL pool,
const XML_Char s 
)
static

Definition at line 6167 of file xmlparse.cc.

6168{
6169 do {
6170 if (!poolAppendChar(pool, *s))
6171 return NULL;
6172 } while (*s++);
6173 s = pool->start;
6174 poolFinish(pool);
6175 return s;
6176}

References poolAppendChar, poolFinish, s, and STRING_POOL::start.

Referenced by copyEntityTable(), dtdCopy(), parserInit(), setContext(), storeAtts(), XML_SetBase(), and XML_SetEncoding().

◆ poolCopyStringN()

static const XML_Char * poolCopyStringN ( STRING_POOL pool,
const XML_Char s,
int  n 
)
static

Definition at line 6179 of file xmlparse.cc.

6180{
6181 if (!pool->ptr && !poolGrow(pool))
6182 return NULL;
6183 for (; n > 0; --n, s++) {
6184 if (!poolAppendChar(pool, *s))
6185 return NULL;
6186 }
6187 s = pool->start;
6188 poolFinish(pool);
6189 return s;
6190}

References CLHEP::detail::n, poolAppendChar, poolFinish, poolGrow(), STRING_POOL::ptr, s, and STRING_POOL::start.

Referenced by copyEntityTable().

◆ poolDestroy()

static void FASTCALL poolDestroy ( STRING_POOL pool)
static

Definition at line 6134 of file xmlparse.cc.

6135{
6136 BLOCK *p = pool->blocks;
6137 while (p) {
6138 BLOCK *tem = p->next;
6139 pool->mem->free_fcn(p);
6140 p = tem;
6141 }
6142 p = pool->freeBlocks;
6143 while (p) {
6144 BLOCK *tem = p->next;
6145 pool->mem->free_fcn(p);
6146 p = tem;
6147 }
6148}
const XML_Memory_Handling_Suite * mem
Definition: xmlparse.cc:235

References STRING_POOL::blocks, XML_Memory_Handling_Suite::free_fcn, STRING_POOL::freeBlocks, STRING_POOL::mem, and block::next.

Referenced by dtdDestroy(), and XML_ParserFree().

◆ poolGrow()

static XML_Bool FASTCALL poolGrow ( STRING_POOL pool)
static

Definition at line 6216 of file xmlparse.cc.

6217{
6218 if (pool->freeBlocks) {
6219 if (pool->start == 0) {
6220 pool->blocks = pool->freeBlocks;
6221 pool->freeBlocks = pool->freeBlocks->next;
6222 pool->blocks->next = NULL;
6223 pool->start = pool->blocks->s;
6224 pool->end = pool->start + pool->blocks->size;
6225 pool->ptr = pool->start;
6226 return XML_TRUE;
6227 }
6228 if (pool->end - pool->start < pool->freeBlocks->size) {
6229 BLOCK *tem = pool->freeBlocks->next;
6230 pool->freeBlocks->next = pool->blocks;
6231 pool->blocks = pool->freeBlocks;
6232 pool->freeBlocks = tem;
6233 memcpy(pool->blocks->s, pool->start,
6234 (pool->end - pool->start) * sizeof(XML_Char));
6235 pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
6236 pool->start = pool->blocks->s;
6237 pool->end = pool->start + pool->blocks->size;
6238 return XML_TRUE;
6239 }
6240 }
6241 if (pool->blocks && pool->start == pool->blocks->s) {
6242 int blockSize = (int)(pool->end - pool->start)*2;
6243 BLOCK *temp = (BLOCK *)
6244 pool->mem->realloc_fcn(pool->blocks,
6245 (offsetof(BLOCK, s)
6246 + blockSize * sizeof(XML_Char)));
6247 if (temp == NULL)
6248 return XML_FALSE;
6249 pool->blocks = temp;
6250 pool->blocks->size = blockSize;
6251 pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
6252 pool->start = pool->blocks->s;
6253 pool->end = pool->start + blockSize;
6254 }
6255 else {
6256 BLOCK *tem;
6257 int blockSize = (int)(pool->end - pool->start);
6258 if (blockSize < INIT_BLOCK_SIZE)
6259 blockSize = INIT_BLOCK_SIZE;
6260 else
6261 blockSize *= 2;
6262 tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s)
6263 + blockSize * sizeof(XML_Char));
6264 if (!tem)
6265 return XML_FALSE;
6266 tem->size = blockSize;
6267 tem->next = pool->blocks;
6268 pool->blocks = tem;
6269 if (pool->ptr != pool->start)
6270 memcpy(tem->s, pool->start,
6271 (pool->ptr - pool->start) * sizeof(XML_Char));
6272 pool->ptr = tem->s + (pool->ptr - pool->start);
6273 pool->start = tem->s;
6274 pool->end = tem->s + blockSize;
6275 }
6276 return XML_TRUE;
6277}
int size
Definition: xmlparse.cc:225
XML_Char s[1]
Definition: xmlparse.cc:226
#define INIT_BLOCK_SIZE
Definition: xmlparse.cc:145

References STRING_POOL::blocks, STRING_POOL::end, STRING_POOL::freeBlocks, INIT_BLOCK_SIZE, XML_Memory_Handling_Suite::malloc_fcn, STRING_POOL::mem, block::next, STRING_POOL::ptr, XML_Memory_Handling_Suite::realloc_fcn, block::s, s, block::size, STRING_POOL::start, XML_FALSE, and XML_TRUE.

Referenced by poolAppend(), poolCopyStringN(), poolStoreString(), and storeEntityValue().

◆ poolInit()

static void FASTCALL poolInit ( STRING_POOL pool,
const XML_Memory_Handling_Suite ms 
)
static

Definition at line 6103 of file xmlparse.cc.

6104{
6105 pool->blocks = NULL;
6106 pool->freeBlocks = NULL;
6107 pool->start = NULL;
6108 pool->ptr = NULL;
6109 pool->end = NULL;
6110 pool->mem = ms;
6111}

References STRING_POOL::blocks, STRING_POOL::end, STRING_POOL::freeBlocks, STRING_POOL::mem, ms, STRING_POOL::ptr, and STRING_POOL::start.

Referenced by dtdCreate(), and parserCreate().

◆ poolStoreString()

static XML_Char * poolStoreString ( STRING_POOL pool,
const ENCODING enc,
const char *  ptr,
const char *  end 
)
static

Definition at line 6204 of file xmlparse.cc.

6206{
6207 if (!poolAppend(pool, enc, ptr, end))
6208 return NULL;
6209 if (pool->ptr == pool->end && !poolGrow(pool))
6210 return NULL;
6211 *(pool->ptr)++ = 0;
6212 return pool->start;
6213}

References STRING_POOL::end, poolAppend(), poolGrow(), STRING_POOL::ptr, and STRING_POOL::start.

Referenced by appendAttributeValue(), doContent(), doProlog(), getAttributeId(), getElementType(), processXmlDecl(), reportComment(), reportProcessingInstruction(), storeAtts(), and storeEntityValue().

◆ processInternalEntity()

static enum XML_Error processInternalEntity ( XML_Parser  parser,
ENTITY entity,
XML_Bool  betweenDecl 
)
static

Definition at line 4801 of file xmlparse.cc.

4803{
4804 const char *textStart, *textEnd;
4805 const char *next;
4806 enum XML_Error result;
4807 OPEN_INTERNAL_ENTITY *openEntity;
4808
4810 openEntity = freeInternalEntities;
4811 freeInternalEntities = openEntity->next;
4812 }
4813 else {
4814 openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY));
4815 if (!openEntity)
4816 return XML_ERROR_NO_MEMORY;
4817 }
4818 entity->open = XML_TRUE;
4819 entity->processed = 0;
4820 openEntity->next = openInternalEntities;
4821 openInternalEntities = openEntity;
4822 openEntity->entity = entity;
4823 openEntity->startTagLevel = tagLevel;
4824 openEntity->betweenDecl = betweenDecl;
4825 openEntity->internalEventPtr = NULL;
4826 openEntity->internalEventEndPtr = NULL;
4827 textStart = (char *)entity->textPtr;
4828 textEnd = (char *)(entity->textPtr + entity->textLen);
4829
4830#ifdef XML_DTD
4831 if (entity->is_param) {
4832 int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
4833 result = doProlog(parser, internalEncoding, textStart, textEnd, tok,
4834 next, &next, XML_FALSE);
4835 }
4836 else
4837#endif /* XML_DTD */
4838 result = doContent(parser, tagLevel, internalEncoding, textStart,
4839 textEnd, &next, XML_FALSE);
4840
4841 if (result == XML_ERROR_NONE) {
4842 if (textEnd != next && ps_parsing == XML_SUSPENDED) {
4843 entity->processed = (int)(next - textStart);
4845 }
4846 else {
4847 entity->open = XML_FALSE;
4848 openInternalEntities = openEntity->next;
4849 /* put openEntity back in list of free instances */
4850 openEntity->next = freeInternalEntities;
4851 freeInternalEntities = openEntity;
4852 }
4853 }
4854 return result;
4855}
XML_Bool betweenDecl
Definition: xmlparse.cc:303
const char * internalEventEndPtr
Definition: xmlparse.cc:299
const char * internalEventPtr
Definition: xmlparse.cc:298
static Processor internalEntityProcessor
Definition: xmlparse.cc:328

References open_internal_entity::betweenDecl, doContent(), doProlog(), open_internal_entity::entity, freeInternalEntities, internalEncoding, internalEntityProcessor, open_internal_entity::internalEventEndPtr, open_internal_entity::internalEventPtr, ENTITY::is_param, MALLOC, open_internal_entity::next, ENTITY::open, openInternalEntities, geant4_check_module_cycles::parser, ENTITY::processed, processor, ps_parsing, open_internal_entity::startTagLevel, tagLevel, ENTITY::textLen, ENTITY::textPtr, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_FALSE, XML_SUSPENDED, XML_TRUE, and XmlPrologTok.

Referenced by doContent(), and doProlog().

◆ Processor()

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

◆ processXmlDecl()

static enum XML_Error processXmlDecl ( XML_Parser  parser,
int  isGeneralTextEntity,
const char *  s,
const char *  next 
)
static

Definition at line 3425 of file xmlparse.cc.

3427{
3428 const char *encodingName = NULL;
3429 const XML_Char *storedEncName = NULL;
3430 const ENCODING *newEncoding = NULL;
3431 const char *version = NULL;
3432 const char *versionend;
3433 const XML_Char *storedversion = NULL;
3434 int standalone = -1;
3435 if (!(ns
3437 : XmlParseXmlDecl)(isGeneralTextEntity,
3438 encoding,
3439 s,
3440 next,
3441 &eventPtr,
3442 &version,
3443 &versionend,
3444 &encodingName,
3445 &newEncoding,
3446 &standalone)) {
3447 if (isGeneralTextEntity)
3448 return XML_ERROR_TEXT_DECL;
3449 else
3450 return XML_ERROR_XML_DECL;
3451 }
3452 if (!isGeneralTextEntity && standalone == 1) {
3453 _dtd->standalone = XML_TRUE;
3454#ifdef XML_DTD
3455 if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
3456 paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
3457#endif /* XML_DTD */
3458 }
3459 if (xmlDeclHandler) {
3460 if (encodingName != NULL) {
3461 storedEncName = poolStoreString(&temp2Pool,
3462 encoding,
3463 encodingName,
3464 encodingName
3465 + XmlNameLength(encoding, encodingName));
3466 if (!storedEncName)
3467 return XML_ERROR_NO_MEMORY;
3469 }
3470 if (version) {
3471 storedversion = poolStoreString(&temp2Pool,
3472 encoding,
3473 version,
3474 versionend - encoding->minBytesPerChar);
3475 if (!storedversion)
3476 return XML_ERROR_NO_MEMORY;
3477 }
3478 xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone);
3479 }
3480 else if (defaultHandler)
3481 reportDefault(parser, encoding, s, next);
3482 if (protocolEncodingName == NULL) {
3483 if (newEncoding) {
3484 if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {
3485 eventPtr = encodingName;
3487 }
3488 encoding = newEncoding;
3489 }
3490 else if (encodingName) {
3491 enum XML_Error result;
3492 if (!storedEncName) {
3493 storedEncName = poolStoreString(
3494 &temp2Pool, encoding, encodingName,
3495 encodingName + XmlNameLength(encoding, encodingName));
3496 if (!storedEncName)
3497 return XML_ERROR_NO_MEMORY;
3498 }
3499 result = handleUnknownEncoding(parser, storedEncName);
3501 if (result == XML_ERROR_UNKNOWN_ENCODING)
3502 eventPtr = encodingName;
3503 return result;
3504 }
3505 }
3506
3507 if (storedEncName || storedversion)
3509
3510 return XML_ERROR_NONE;
3511}
@ XML_ERROR_XML_DECL
Definition: expat.h:87
@ XML_ERROR_TEXT_DECL
Definition: expat.h:88
@ XML_ERROR_INCORRECT_ENCODING
Definition: expat.h:74
@ XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
Definition: expat.h:878
#define XmlParseXmlDeclNS
Definition: xmlparse.cc:60
int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr)

References _dtd, defaultHandler, eventPtr, handlerArg, handleUnknownEncoding(), encoding::minBytesPerChar, ns, geant4_check_module_cycles::parser, poolClear(), poolFinish, poolStoreString(), protocolEncodingName, reportDefault(), s, temp2Pool, XML_ERROR_INCORRECT_ENCODING, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_TEXT_DECL, XML_ERROR_UNKNOWN_ENCODING, XML_ERROR_XML_DECL, XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, XML_TRUE, xmlDeclHandler, XmlNameLength, XmlParseXmlDecl(), and XmlParseXmlDeclNS.

Referenced by doProlog(), and externalEntityInitProcessor3().

◆ prologInitProcessor()

static enum XML_Error PTRCALL prologInitProcessor ( XML_Parser  parser,
const char *  s,
const char *  end,
const char **  nextPtr 
)
static

Definition at line 3553 of file xmlparse.cc.

3557{
3558 enum XML_Error result = initializeEncoding(parser);
3559 if (result != XML_ERROR_NONE)
3560 return result;
3562 return prologProcessor(parser, s, end, nextPtr);
3563}

References initializeEncoding(), geant4_check_module_cycles::parser, processor, prologProcessor, s, and XML_ERROR_NONE.

◆ prologProcessor()

static enum XML_Error PTRCALL prologProcessor ( XML_Parser  parser,
const char *  s,
const char *  end,
const char **  nextPtr 
)
static

Definition at line 3738 of file xmlparse.cc.

3742{
3743 const char *next = s;
3744 int tok = XmlPrologTok(encoding, s, end, &next);
3745 return doProlog(parser, encoding, s, end, tok, next,
3746 nextPtr, (XML_Bool)!ps_finalBuffer);
3747}

References doProlog(), geant4_check_module_cycles::parser, ps_finalBuffer, s, and XmlPrologTok.

◆ reportComment()

static int reportComment ( XML_Parser  parser,
const ENCODING enc,
const char *  start,
const char *  end 
)
static

Definition at line 5312 of file xmlparse.cc.

5314{
5315 XML_Char *data;
5316 if (!commentHandler) {
5317 if (defaultHandler)
5318 reportDefault(parser, enc, start, end);
5319 return 1;
5320 }
5321 data = poolStoreString(&tempPool,
5322 enc,
5323 start + enc->minBytesPerChar * 4,
5324 end - enc->minBytesPerChar * 3);
5325 if (!data)
5326 return 0;
5327 normalizeLines(data);
5330 return 1;
5331}
static void FASTCALL normalizeLines(XML_Char *s)
Definition: xmlparse.cc:5260

References commentHandler, defaultHandler, handlerArg, encoding::minBytesPerChar, normalizeLines(), geant4_check_module_cycles::parser, poolClear(), poolStoreString(), reportDefault(), and tempPool.

Referenced by doContent(), doProlog(), and epilogProcessor().

◆ reportDefault()

static void reportDefault ( XML_Parser  parser,
const ENCODING enc,
const char *  start,
const char *  end 
)
static

Definition at line 5334 of file xmlparse.cc.

5336{
5337 if (MUST_CONVERT(enc, s)) {
5338 const char **eventPP;
5339 const char **eventEndPP;
5340 if (enc == encoding) {
5341 eventPP = &eventPtr;
5342 eventEndPP = &eventEndPtr;
5343 }
5344 else {
5345 eventPP = &(openInternalEntities->internalEventPtr);
5346 eventEndPP = &(openInternalEntities->internalEventEndPtr);
5347 }
5348 do {
5349 ICHAR *dataPtr = (ICHAR *)dataBuf;
5350 XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
5351 *eventEndPP = s;
5352 defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));
5353 *eventPP = s;
5354 } while (s != end);
5355 }
5356 else
5357 defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));
5358}

References dataBuf, dataBufEnd, defaultHandler, eventEndPtr, eventPtr, handlerArg, MUST_CONVERT, openInternalEntities, s, and XmlConvert.

Referenced by doCdataSection(), doContent(), doProlog(), epilogProcessor(), processXmlDecl(), reportComment(), reportProcessingInstruction(), and XML_DefaultCurrent().

◆ reportProcessingInstruction()

static int reportProcessingInstruction ( XML_Parser  parser,
const ENCODING enc,
const char *  start,
const char *  end 
)
static

Definition at line 5283 of file xmlparse.cc.

5285{
5286 const XML_Char *target;
5287 XML_Char *data;
5288 const char *tem;
5290 if (defaultHandler)
5291 reportDefault(parser, enc, start, end);
5292 return 1;
5293 }
5294 start += enc->minBytesPerChar * 2;
5295 tem = start + XmlNameLength(enc, start);
5296 target = poolStoreString(&tempPool, enc, start, tem);
5297 if (!target)
5298 return 0;
5300 data = poolStoreString(&tempPool, enc,
5301 XmlSkipS(enc, tem),
5302 end - enc->minBytesPerChar*2);
5303 if (!data)
5304 return 0;
5305 normalizeLines(data);
5308 return 1;
5309}
#define XmlSkipS(enc, ptr)
Definition: xmltok.h:235

References defaultHandler, handlerArg, encoding::minBytesPerChar, normalizeLines(), geant4_check_module_cycles::parser, poolClear(), poolFinish, poolStoreString(), processingInstructionHandler, reportDefault(), tempPool, XmlNameLength, and XmlSkipS.

Referenced by doContent(), doProlog(), and epilogProcessor().

◆ setContext()

static XML_Bool setContext ( XML_Parser  parser,
const XML_Char context 
)
static

Definition at line 5568 of file xmlparse.cc.

5569{
5570 DTD * const dtd = _dtd; /* save one level of indirection */
5571 const XML_Char *s = context;
5572
5573 while (*context != XML_T('\0')) {
5574 if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
5575 ENTITY *e;
5576 if (!poolAppendChar(&tempPool, XML_T('\0')))
5577 return XML_FALSE;
5579 if (e)
5580 e->open = XML_TRUE;
5581 if (*s != XML_T('\0'))
5582 s++;
5583 context = s;
5585 }
5586 else if (*s == XML_T(ASCII_EQUALS)) {
5587 PREFIX *prefix;
5588 if (poolLength(&tempPool) == 0)
5589 prefix = &dtd->defaultPrefix;
5590 else {
5591 if (!poolAppendChar(&tempPool, XML_T('\0')))
5592 return XML_FALSE;
5594 sizeof(PREFIX));
5595 if (!prefix)
5596 return XML_FALSE;
5597 if (prefix->name == poolStart(&tempPool)) {
5599 if (!prefix->name)
5600 return XML_FALSE;
5601 }
5603 }
5604 for (context = s + 1;
5605 *context != CONTEXT_SEP && *context != XML_T('\0');
5606 context++)
5608 return XML_FALSE;
5609 if (!poolAppendChar(&tempPool, XML_T('\0')))
5610 return XML_FALSE;
5613 return XML_FALSE;
5615 if (*context != XML_T('\0'))
5616 ++context;
5617 s = context;
5618 }
5619 else {
5620 if (!poolAppendChar(&tempPool, *s))
5621 return XML_FALSE;
5622 s++;
5623 }
5624 }
5625 return XML_TRUE;
5626}
static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr)
Definition: xmlparse.cc:3056

References _dtd, addBinding(), ASCII_EQUALS, g4zmq::context, CONTEXT_SEP, DTD::defaultPrefix, DTD::generalEntities, inheritedBindings, lookup(), prefix::name, ENTITY::open, geant4_check_module_cycles::parser, DTD::pool, poolAppendChar, poolCopyString(), poolDiscard, poolLength, poolStart, DTD::prefixes, s, tempPool, XML_ERROR_NONE, XML_FALSE, XML_T, and XML_TRUE.

Referenced by startParsing(), and XML_ExternalEntityParserCreate().

◆ setElementTypePrefix()

static int setElementTypePrefix ( XML_Parser  parser,
ELEMENT_TYPE elementType 
)
static

Definition at line 5406 of file xmlparse.cc.

5407{
5408 DTD * const dtd = _dtd; /* save one level of indirection */
5409 const XML_Char *name;
5410 for (name = elementType->name; *name; name++) {
5411 if (*name == XML_T(ASCII_COLON)) {
5412 PREFIX *prefix;
5413 const XML_Char *s;
5414 for (s = elementType->name; s != name; s++) {
5415 if (!poolAppendChar(&dtd->pool, *s))
5416 return 0;
5417 }
5418 if (!poolAppendChar(&dtd->pool, XML_T('\0')))
5419 return 0;
5420 prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool),
5421 sizeof(PREFIX));
5422 if (!prefix)
5423 return 0;
5424 if (prefix->name == poolStart(&dtd->pool))
5425 poolFinish(&dtd->pool);
5426 else
5427 poolDiscard(&dtd->pool);
5428 elementType->prefix = prefix;
5429
5430 }
5431 }
5432 return 1;
5433}

References _dtd, ASCII_COLON, lookup(), prefix::name, ELEMENT_TYPE::name, G4InuclParticleNames::name(), geant4_check_module_cycles::parser, DTD::pool, poolAppendChar, poolDiscard, poolFinish, poolStart, ELEMENT_TYPE::prefix, DTD::prefixes, s, and XML_T.

Referenced by getElementType(), and storeAtts().

◆ startParsing()

static XML_Bool startParsing ( XML_Parser  parser)
static

Definition at line 708 of file xmlparse.cc.

709{
710 /* hash functions must be initialized before setContext() is called */
711 if (hash_secret_salt == 0)
713 if (ns) {
714 /* implicit context only set for root parser, since child
715 parsers (i.e. external entity parsers) will inherit it
716 */
718 }
719 return XML_TRUE;
720}
static const XML_Char implicitContext[]
Definition: xmlparse.cc:690
static XML_Bool setContext(XML_Parser parser, const XML_Char *context)
Definition: xmlparse.cc:5568
static unsigned long generate_hash_secret_salt(void)
Definition: xmlparse.cc:700

References generate_hash_secret_salt(), hash_secret_salt, implicitContext, ns, geant4_check_module_cycles::parser, setContext(), and XML_TRUE.

Referenced by XML_Parse(), and XML_ParseBuffer().

◆ storeAttributeValue()

static enum XML_Error storeAttributeValue ( XML_Parser  parser,
const ENCODING enc,
XML_Bool  isCdata,
const char *  ptr,
const char *  end,
STRING_POOL pool 
)
static

Definition at line 4928 of file xmlparse.cc.

4931{
4932 enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr,
4933 end, pool);
4934 if (result)
4935 return result;
4936 if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
4937 poolChop(pool);
4938 if (!poolAppendChar(pool, XML_T('\0')))
4939 return XML_ERROR_NO_MEMORY;
4940 return XML_ERROR_NONE;
4941}
#define poolChop(pool)
Definition: xmlparse.cc:456

References appendAttributeValue(), geant4_check_module_cycles::parser, poolAppendChar, poolChop, poolLastChar, poolLength, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, and XML_T.

Referenced by doProlog(), and storeAtts().

◆ storeAtts()

static enum XML_Error storeAtts ( XML_Parser  parser,
const ENCODING enc,
const char *  s,
TAG_NAME tagNamePtr,
BINDING **  bindingsPtr 
)
static

Definition at line 2704 of file xmlparse.cc.

2707{
2708 DTD * const dtd = _dtd; /* save one level of indirection */
2709 ELEMENT_TYPE *elementType;
2710 int nDefaultAtts;
2711 const XML_Char **appAtts; /* the attribute list for the application */
2712 int attIndex = 0;
2713 int prefixLen;
2714 int i;
2715 int n;
2716 XML_Char *uri;
2717 int nPrefixes = 0;
2719 const XML_Char *localPart;
2720
2721 /* lookup the element type name */
2722 elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str,0);
2723 if (!elementType) {
2724 const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str);
2725 if (!name)
2726 return XML_ERROR_NO_MEMORY;
2727 elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name,
2728 sizeof(ELEMENT_TYPE));
2729 if (!elementType)
2730 return XML_ERROR_NO_MEMORY;
2731 if (ns && !setElementTypePrefix(parser, elementType))
2732 return XML_ERROR_NO_MEMORY;
2733 }
2734 nDefaultAtts = elementType->nDefaultAtts;
2735
2736 /* get the attributes from the tokenizer */
2737 n = XmlGetAttributes(enc, attStr, attsSize, atts);
2738 if (n + nDefaultAtts > attsSize) {
2739 int oldAttsSize = attsSize;
2740 ATTRIBUTE *temp;
2741#ifdef XML_ATTR_INFO
2742 XML_AttrInfo *temp2;
2743#endif
2744 attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
2745 temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));
2746 if (temp == NULL)
2747 return XML_ERROR_NO_MEMORY;
2748 atts = temp;
2749#ifdef XML_ATTR_INFO
2750 temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo));
2751 if (temp2 == NULL)
2752 return XML_ERROR_NO_MEMORY;
2753 attInfo = temp2;
2754#endif
2755 if (n > oldAttsSize)
2756 XmlGetAttributes(enc, attStr, n, atts);
2757 }
2758
2759 appAtts = (const XML_Char **)atts;
2760 for (i = 0; i < n; i++) {
2761 ATTRIBUTE *currAtt = &atts[i];
2762#ifdef XML_ATTR_INFO
2763 XML_AttrInfo *currAttInfo = &attInfo[i];
2764#endif
2765 /* add the name and value to the attribute list */
2766 ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name,
2767 currAtt->name
2768 + XmlNameLength(enc, currAtt->name));
2769 if (!attId)
2770 return XML_ERROR_NO_MEMORY;
2771#ifdef XML_ATTR_INFO
2772 currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name);
2773 currAttInfo->nameEnd = currAttInfo->nameStart +
2774 XmlNameLength(enc, currAtt->name);
2775 currAttInfo->valueStart = parseEndByteIndex -
2776 (parseEndPtr - currAtt->valuePtr);
2777 currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd);
2778#endif
2779 /* Detect duplicate attributes by their QNames. This does not work when
2780 namespace processing is turned on and different prefixes for the same
2781 namespace are used. For this case we have a check further down.
2782 */
2783 if ((attId->name)[-1]) {
2784 if (enc == encoding)
2785 eventPtr = atts[i].name;
2787 }
2788 (attId->name)[-1] = 1;
2789 appAtts[attIndex++] = attId->name;
2790 if (!atts[i].normalized) {
2791 enum XML_Error result;
2792 XML_Bool isCdata = XML_TRUE;
2793
2794 /* figure out whether declared as other than CDATA */
2795 if (attId->maybeTokenized) {
2796 int j;
2797 for (j = 0; j < nDefaultAtts; j++) {
2798 if (attId == elementType->defaultAtts[j].id) {
2799 isCdata = elementType->defaultAtts[j].isCdata;
2800 break;
2801 }
2802 }
2803 }
2804
2805 /* normalize the attribute value */
2806 result = storeAttributeValue(parser, enc, isCdata,
2807 atts[i].valuePtr, atts[i].valueEnd,
2808 &tempPool);
2809 if (result)
2810 return result;
2811 appAtts[attIndex] = poolStart(&tempPool);
2813 }
2814 else {
2815 /* the value did not need normalizing */
2816 appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr,
2817 atts[i].valueEnd);
2818 if (appAtts[attIndex] == 0)
2819 return XML_ERROR_NO_MEMORY;
2821 }
2822 /* handle prefixed attribute names */
2823 if (attId->prefix) {
2824 if (attId->xmlns) {
2825 /* deal with namespace declarations here */
2826 enum XML_Error result = addBinding(parser, attId->prefix, attId,
2827 appAtts[attIndex], bindingsPtr);
2828 if (result)
2829 return result;
2830 --attIndex;
2831 }
2832 else {
2833 /* deal with other prefixed names later */
2834 attIndex++;
2835 nPrefixes++;
2836 (attId->name)[-1] = 2;
2837 }
2838 }
2839 else
2840 attIndex++;
2841 }
2842
2843 /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
2844 nSpecifiedAtts = attIndex;
2845 if (elementType->idAtt && (elementType->idAtt->name)[-1]) {
2846 for (i = 0; i < attIndex; i += 2)
2847 if (appAtts[i] == elementType->idAtt->name) {
2848 idAttIndex = i;
2849 break;
2850 }
2851 }
2852 else
2853 idAttIndex = -1;
2854
2855 /* do attribute defaulting */
2856 for (i = 0; i < nDefaultAtts; i++) {
2857 const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i;
2858 if (!(da->id->name)[-1] && da->value) {
2859 if (da->id->prefix) {
2860 if (da->id->xmlns) {
2861 enum XML_Error result = addBinding(parser, da->id->prefix, da->id,
2862 da->value, bindingsPtr);
2863 if (result)
2864 return result;
2865 }
2866 else {
2867 (da->id->name)[-1] = 2;
2868 nPrefixes++;
2869 appAtts[attIndex++] = da->id->name;
2870 appAtts[attIndex++] = da->value;
2871 }
2872 }
2873 else {
2874 (da->id->name)[-1] = 1;
2875 appAtts[attIndex++] = da->id->name;
2876 appAtts[attIndex++] = da->value;
2877 }
2878 }
2879 }
2880 appAtts[attIndex] = 0;
2881
2882 /* expand prefixed attribute names, check for duplicates,
2883 and clear flags that say whether attributes were specified */
2884 i = 0;
2885 if (nPrefixes) {
2886 int j; /* hash table index */
2887 unsigned long version = nsAttsVersion;
2888 int nsAttsSize = (int)1 << nsAttsPower;
2889 /* size of hash table must be at least 2 * (# of prefixed attributes) */
2890 if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */
2891 NS_ATT *temp;
2892 /* hash table size must also be a power of 2 and >= 8 */
2893 while (nPrefixes >> nsAttsPower++);
2894 if (nsAttsPower < 3)
2895 nsAttsPower = 3;
2896 nsAttsSize = (int)1 << nsAttsPower;
2897 temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT));
2898 if (!temp)
2899 return XML_ERROR_NO_MEMORY;
2900 nsAtts = temp;
2901 version = 0; /* force re-initialization of nsAtts hash table */
2902 }
2903 /* using a version flag saves us from initializing nsAtts every time */
2904 if (!version) { /* initialize version flags when version wraps around */
2905 version = INIT_ATTS_VERSION;
2906 for (j = nsAttsSize; j != 0; )
2907 nsAtts[--j].version = version;
2908 }
2909 nsAttsVersion = --version;
2910
2911 /* expand prefixed names and check for duplicates */
2912 for (; i < attIndex; i += 2) {
2913 const XML_Char *s = appAtts[i];
2914 if (s[-1] == 2) { /* prefixed */
2915 ATTRIBUTE_ID *id;
2916 const BINDING *b;
2917 unsigned long uriHash = hash_secret_salt;
2918 ((XML_Char *)s)[-1] = 0; /* clear flag */
2919 id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0);
2920 b = id->prefix->binding;
2921 if (!b)
2923
2924 /* as we expand the name we also calculate its hash value */
2925 for (j = 0; j < b->uriLen; j++) {
2926 const XML_Char c = b->uri[j];
2927 if (!poolAppendChar(&tempPool, c))
2928 return XML_ERROR_NO_MEMORY;
2929 uriHash = CHAR_HASH(uriHash, c);
2930 }
2931 while (*s++ != XML_T(ASCII_COLON))
2932 ;
2933 do { /* copies null terminator */
2934 const XML_Char c = *s;
2935 if (!poolAppendChar(&tempPool, *s))
2936 return XML_ERROR_NO_MEMORY;
2937 uriHash = CHAR_HASH(uriHash, c);
2938 } while (*s++);
2939
2940 { /* Check hash table for duplicate of expanded name (uriName).
2941 Derived from code in lookup(parser, HASH_TABLE *table, ...).
2942 */
2943 unsigned char step = 0;
2944 unsigned long mask = nsAttsSize - 1;
2945 j = uriHash & mask; /* index into hash table */
2946 while (nsAtts[j].version == version) {
2947 /* for speed we compare stored hash values first */
2948 if (uriHash == nsAtts[j].hash) {
2949 const XML_Char *s1 = poolStart(&tempPool);
2950 const XML_Char *s2 = nsAtts[j].uriName;
2951 /* s1 is null terminated, but not s2 */
2952 for (; *s1 == *s2 && *s1 != 0; s1++, s2++);
2953 if (*s1 == 0)
2955 }
2956 if (!step)
2957 step = PROBE_STEP(uriHash, mask, nsAttsPower);
2958 j < step ? (j += nsAttsSize - step) : (j -= step);
2959 }
2960 }
2961
2962 if (ns_triplets) { /* append namespace separator and prefix */
2963 tempPool.ptr[-1] = namespaceSeparator;
2964 s = b->prefix->name;
2965 do {
2966 if (!poolAppendChar(&tempPool, *s))
2967 return XML_ERROR_NO_MEMORY;
2968 } while (*s++);
2969 }
2970
2971 /* store expanded name in attribute list */
2972 s = poolStart(&tempPool);
2974 appAtts[i] = s;
2975
2976 /* fill empty slot with new version, uriName and hash value */
2977 nsAtts[j].version = version;
2978 nsAtts[j].hash = uriHash;
2979 nsAtts[j].uriName = s;
2980
2981 if (!--nPrefixes) {
2982 i += 2;
2983 break;
2984 }
2985 }
2986 else /* not prefixed */
2987 ((XML_Char *)s)[-1] = 0; /* clear flag */
2988 }
2989 }
2990 /* clear flags for the remaining attributes */
2991 for (; i < attIndex; i += 2)
2992 ((XML_Char *)(appAtts[i]))[-1] = 0;
2993 for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding)
2994 binding->attId->name[-1] = 0;
2995
2996 if (!ns)
2997 return XML_ERROR_NONE;
2998
2999 /* expand the element type name */
3000 if (elementType->prefix) {
3001 binding = elementType->prefix->binding;
3002 if (!binding)
3004 localPart = tagNamePtr->str;
3005 while (*localPart++ != XML_T(ASCII_COLON))
3006 ;
3007 }
3008 else if (dtd->defaultPrefix.binding) {
3010 localPart = tagNamePtr->str;
3011 }
3012 else
3013 return XML_ERROR_NONE;
3014 prefixLen = 0;
3015 if (ns_triplets && binding->prefix->name) {
3016 for (; binding->prefix->name[prefixLen++];)
3017 ; /* prefixLen includes null terminator */
3018 }
3019 tagNamePtr->localPart = localPart;
3020 tagNamePtr->uriLen = binding->uriLen;
3021 tagNamePtr->prefix = binding->prefix->name;
3022 tagNamePtr->prefixLen = prefixLen;
3023 for (i = 0; localPart[i++];)
3024 ; /* i includes null terminator */
3025 n = i + binding->uriLen + prefixLen;
3026 if (n > binding->uriAlloc) {
3027 TAG *p;
3028 uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
3029 if (!uri)
3030 return XML_ERROR_NO_MEMORY;
3032 memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
3033 for (p = tagStack; p; p = p->parent)
3034 if (p->name.str == binding->uri)
3035 p->name.str = uri;
3036 FREE(binding->uri);
3037 binding->uri = uri;
3038 }
3039 /* if namespaceSeparator != '\0' then uri includes it already */
3040 uri = binding->uri + binding->uriLen;
3041 memcpy(uri, localPart, i * sizeof(XML_Char));
3042 /* we always have a namespace separator between localPart and prefix */
3043 if (prefixLen) {
3044 uri += i - 1;
3045 *uri = namespaceSeparator; /* replace null terminator */
3046 memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char));
3047 }
3048 tagNamePtr->str = binding->uri;
3049 return XML_ERROR_NONE;
3050}
@ XML_ERROR_DUPLICATE_ATTRIBUTE
Definition: expat.h:63
@ XML_ERROR_UNBOUND_PREFIX
Definition: expat.h:83
const char * name
Definition: xmltok.h:117
const char * valuePtr
Definition: xmltok.h:118
const char * valueEnd
Definition: xmltok.h:119
int prefixLen
Definition: xmlparse.cc:171
#define idAttIndex
Definition: xmlparse.cc:656
#define INIT_ATTS_VERSION
Definition: xmlparse.cc:144
#define XmlGetAttributes(enc, ptr, attsMax, atts)
Definition: xmltok.h:238

References _dtd, addBinding(), ASCII_COLON, binding::attId, attInfo, DTD::attributeIds, atts, attsSize, prefix::binding, CHAR_HASH, ELEMENT_TYPE::defaultAtts, DTD::defaultPrefix, DTD::elementTypes, eventPtr, EXPAND_SPARE, FREE, getAttributeId(), hash(), hash_secret_salt, DEFAULT_ATTRIBUTE::id, ELEMENT_TYPE::idAtt, idAttIndex, INIT_ATTS_SIZE, INIT_ATTS_VERSION, DEFAULT_ATTRIBUTE::isCdata, TAG_NAME::localPart, lookup(), MALLOC, attribute_id::maybeTokenized, CLHEP::detail::n, prefix::name, tag::name, attribute_id::name, ATTRIBUTE::name, G4InuclParticleNames::name(), namespaceSeparator, ELEMENT_TYPE::nDefaultAtts, binding::nextTagBinding, ns, ns_triplets, nsAtts, nsAttsPower, nsAttsVersion, nSpecifiedAtts, tag::parent, parseEndByteIndex, parseEndPtr, geant4_check_module_cycles::parser, DTD::pool, poolAppendChar, poolCopyString(), poolFinish, poolStart, poolStoreString(), binding::prefix, TAG_NAME::prefix, attribute_id::prefix, ELEMENT_TYPE::prefix, TAG_NAME::prefixLen, PROBE_STEP, REALLOC, s, setElementTypePrefix(), storeAttributeValue(), TAG_NAME::str, tagStack, tempPool, binding::uri, binding::uriAlloc, binding::uriLen, TAG_NAME::uriLen, DEFAULT_ATTRIBUTE::value, ATTRIBUTE::valueEnd, ATTRIBUTE::valuePtr, XML_ERROR_DUPLICATE_ATTRIBUTE, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_UNBOUND_PREFIX, XML_T, XML_TRUE, XmlGetAttributes, XmlNameLength, and attribute_id::xmlns.

Referenced by doContent().

◆ storeEntityValue()

static enum XML_Error storeEntityValue ( XML_Parser  parser,
const ENCODING enc,
const char *  start,
const char *  end 
)
static

Definition at line 5094 of file xmlparse.cc.

5098{
5099 DTD * const dtd = _dtd; /* save one level of indirection */
5100 STRING_POOL *pool = &(dtd->entityValuePool);
5101 enum XML_Error result = XML_ERROR_NONE;
5102#ifdef XML_DTD
5103 int oldInEntityValue = prologState.inEntityValue;
5104 prologState.inEntityValue = 1;
5105#endif /* XML_DTD */
5106 /* never return Null for the value argument in EntityDeclHandler,
5107 since this would indicate an external entity; therefore we
5108 have to make sure that entityValuePool.start is not null */
5109 if (!pool->blocks) {
5110 if (!poolGrow(pool))
5111 return XML_ERROR_NO_MEMORY;
5112 }
5113
5114 for (;;) {
5115 const char *next;
5116 int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
5117 switch (tok) {
5119#ifdef XML_DTD
5120 if (isParamEntity || enc != encoding) {
5121 const XML_Char *name;
5122 ENTITY *entity;
5124 entityTextPtr + enc->minBytesPerChar,
5125 next - enc->minBytesPerChar);
5126 if (!name) {
5127 result = XML_ERROR_NO_MEMORY;
5128 goto endEntityValue;
5129 }
5130 entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0);
5132 if (!entity) {
5133 /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
5134 /* cannot report skipped entity here - see comments on
5135 skippedEntityHandler
5136 if (skippedEntityHandler)
5137 skippedEntityHandler(handlerArg, name, 0);
5138 */
5139 dtd->keepProcessing = dtd->standalone;
5140 goto endEntityValue;
5141 }
5142 if (entity->open) {
5143 if (enc == encoding)
5144 eventPtr = entityTextPtr;
5146 goto endEntityValue;
5147 }
5148 if (entity->systemId) {
5150 dtd->paramEntityRead = XML_FALSE;
5151 entity->open = XML_TRUE;
5153 0,
5154 entity->base,
5155 entity->systemId,
5156 entity->publicId)) {
5157 entity->open = XML_FALSE;
5159 goto endEntityValue;
5160 }
5161 entity->open = XML_FALSE;
5162 if (!dtd->paramEntityRead)
5163 dtd->keepProcessing = dtd->standalone;
5164 }
5165 else
5166 dtd->keepProcessing = dtd->standalone;
5167 }
5168 else {
5169 entity->open = XML_TRUE;
5170 result = storeEntityValue(parser,
5172 (char *)entity->textPtr,
5173 (char *)(entity->textPtr
5174 + entity->textLen));
5175 entity->open = XML_FALSE;
5176 if (result)
5177 goto endEntityValue;
5178 }
5179 break;
5180 }
5181#endif /* XML_DTD */
5182 /* In the internal subset, PE references are not legal
5183 within markup declarations, e.g entity values in this case. */
5184 eventPtr = entityTextPtr;
5186 goto endEntityValue;
5187 case XML_TOK_NONE:
5188 result = XML_ERROR_NONE;
5189 goto endEntityValue;
5190 case XML_TOK_ENTITY_REF:
5191 case XML_TOK_DATA_CHARS:
5192 if (!poolAppend(pool, enc, entityTextPtr, next)) {
5193 result = XML_ERROR_NO_MEMORY;
5194 goto endEntityValue;
5195 }
5196 break;
5198 next = entityTextPtr + enc->minBytesPerChar;
5199 /* fall through */
5201 if (pool->end == pool->ptr && !poolGrow(pool)) {
5202 result = XML_ERROR_NO_MEMORY;
5203 goto endEntityValue;
5204 }
5205 *(pool->ptr)++ = 0xA;
5206 break;
5207 case XML_TOK_CHAR_REF:
5208 {
5210 int i;
5211 int n = XmlCharRefNumber(enc, entityTextPtr);
5212 if (n < 0) {
5213 if (enc == encoding)
5214 eventPtr = entityTextPtr;
5215 result = XML_ERROR_BAD_CHAR_REF;
5216 goto endEntityValue;
5217 }
5218 n = XmlEncode(n, (ICHAR *)buf);
5219 if (!n) {
5220 if (enc == encoding)
5221 eventPtr = entityTextPtr;
5222 result = XML_ERROR_BAD_CHAR_REF;
5223 goto endEntityValue;
5224 }
5225 for (i = 0; i < n; i++) {
5226 if (pool->end == pool->ptr && !poolGrow(pool)) {
5227 result = XML_ERROR_NO_MEMORY;
5228 goto endEntityValue;
5229 }
5230 *(pool->ptr)++ = buf[i];
5231 }
5232 }
5233 break;
5234 case XML_TOK_PARTIAL:
5235 if (enc == encoding)
5236 eventPtr = entityTextPtr;
5237 result = XML_ERROR_INVALID_TOKEN;
5238 goto endEntityValue;
5239 case XML_TOK_INVALID:
5240 if (enc == encoding)
5241 eventPtr = next;
5242 result = XML_ERROR_INVALID_TOKEN;
5243 goto endEntityValue;
5244 default:
5245 if (enc == encoding)
5246 eventPtr = entityTextPtr;
5248 goto endEntityValue;
5249 }
5250 entityTextPtr = next;
5251 }
5252endEntityValue:
5253#ifdef XML_DTD
5254 prologState.inEntityValue = oldInEntityValue;
5255#endif /* XML_DTD */
5256 return result;
5257}
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr)
Definition: xmltok.h:224

References _dtd, ENTITY::base, STRING_POOL::blocks, STRING_POOL::end, DTD::entityValuePool, eventPtr, externalEntityRefHandler, externalEntityRefHandlerArg, internalEncoding, DTD::keepProcessing, lookup(), encoding::minBytesPerChar, CLHEP::detail::n, G4InuclParticleNames::name(), ENTITY::open, geant4_check_module_cycles::parser, poolAppend(), poolDiscard, poolGrow(), poolStoreString(), prologState, STRING_POOL::ptr, ENTITY::publicId, DTD::standalone, storeEntityValue(), ENTITY::systemId, tempPool, ENTITY::textLen, ENTITY::textPtr, XML_ENCODE_MAX, XML_ERROR_BAD_CHAR_REF, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_INVALID_TOKEN, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_UNEXPECTED_STATE, XML_FALSE, XML_TOK_CHAR_REF, XML_TOK_DATA_CHARS, XML_TOK_DATA_NEWLINE, XML_TOK_ENTITY_REF, XML_TOK_INVALID, XML_TOK_NONE, XML_TOK_PARAM_ENTITY_REF, XML_TOK_PARTIAL, XML_TOK_TRAILING_CR, XML_TRUE, XmlCharRefNumber, XmlEncode, and XmlEntityValueTok.

Referenced by doProlog(), and storeEntityValue().

◆ storeRawNames()

static XML_Bool storeRawNames ( XML_Parser  parser)
static

Definition at line 2061 of file xmlparse.cc.

2062{
2063 TAG *tag = tagStack;
2064 while (tag) {
2065 int bufSize;
2066 int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1);
2067 char *rawNameBuf = tag->buf + nameLen;
2068 /* Stop if already stored. Since tagStack is a stack, we can stop
2069 at the first entry that has already been copied; everything
2070 below it in the stack is already been accounted for in a
2071 previous call to this function.
2072 */
2073 if (tag->rawName == rawNameBuf)
2074 break;
2075 /* For re-use purposes we need to ensure that the
2076 size of tag->buf is a multiple of sizeof(XML_Char).
2077 */
2078 bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char));
2079 if (bufSize > tag->bufEnd - tag->buf) {
2080 char *temp = (char *)REALLOC(tag->buf, bufSize);
2081 if (temp == NULL)
2082 return XML_FALSE;
2083 /* if tag->name.str points to tag->buf (only when namespace
2084 processing is off) then we have to update it
2085 */
2086 if (tag->name.str == (XML_Char *)tag->buf)
2087 tag->name.str = (XML_Char *)temp;
2088 /* if tag->name.localPart is set (when namespace processing is on)
2089 then update it as well, since it will always point into tag->buf
2090 */
2091 if (tag->name.localPart)
2092 tag->name.localPart = (XML_Char *)temp + (tag->name.localPart -
2093 (XML_Char *)tag->buf);
2094 tag->buf = temp;
2095 tag->bufEnd = temp + bufSize;
2096 rawNameBuf = temp + nameLen;
2097 }
2098 memcpy(rawNameBuf, tag->rawName, tag->rawNameLength);
2099 tag->rawName = rawNameBuf;
2100 tag = tag->parent;
2101 }
2102 return XML_TRUE;
2103}
#define ROUND_UP(n, sz)
Definition: xmlparse.cc:82

References tag::buf, tag::bufEnd, TAG_NAME::localPart, tag::name, tag::parent, tag::rawName, tag::rawNameLength, REALLOC, ROUND_UP, TAG_NAME::str, TAG_NAME::strLen, tagStack, XML_FALSE, and XML_TRUE.

Referenced by contentProcessor(), and externalEntityContentProcessor().

◆ XML_DefaultCurrent()

void XMLCALL XML_DefaultCurrent ( XML_Parser  parser)

Definition at line 1920 of file xmlparse.cc.

1921{
1922 if (defaultHandler) {
1926 openInternalEntities->internalEventPtr,
1927 openInternalEntities->internalEventEndPtr);
1928 else
1930 }
1931}

References defaultHandler, eventEndPtr, eventPtr, internalEncoding, openInternalEntities, geant4_check_module_cycles::parser, and reportDefault().

◆ XML_ErrorString()

const XML_LChar *XMLCALL XML_ErrorString ( enum XML_Error  code)

Definition at line 1934 of file xmlparse.cc.

1935{
1936 static const XML_LChar* const message[] = {
1937 0,
1938 XML_L("out of memory"),
1939 XML_L("syntax error"),
1940 XML_L("no element found"),
1941 XML_L("not well-formed (invalid token)"),
1942 XML_L("unclosed token"),
1943 XML_L("partial character"),
1944 XML_L("mismatched tag"),
1945 XML_L("duplicate attribute"),
1946 XML_L("junk after document element"),
1947 XML_L("illegal parameter entity reference"),
1948 XML_L("undefined entity"),
1949 XML_L("recursive entity reference"),
1950 XML_L("asynchronous entity"),
1951 XML_L("reference to invalid character number"),
1952 XML_L("reference to binary entity"),
1953 XML_L("reference to external entity in attribute"),
1954 XML_L("XML or text declaration not at start of entity"),
1955 XML_L("unknown encoding"),
1956 XML_L("encoding specified in XML declaration is incorrect"),
1957 XML_L("unclosed CDATA section"),
1958 XML_L("error in processing external entity reference"),
1959 XML_L("document is not standalone"),
1960 XML_L("unexpected parser state - please send a bug report"),
1961 XML_L("entity declared in parameter entity"),
1962 XML_L("requested feature requires XML_DTD support in Expat"),
1963 XML_L("cannot change setting once parsing has begun"),
1964 XML_L("unbound prefix"),
1965 XML_L("must not undeclare prefix"),
1966 XML_L("incomplete markup in parameter entity"),
1967 XML_L("XML declaration not well-formed"),
1968 XML_L("text declaration not well-formed"),
1969 XML_L("illegal character(s) in public id"),
1970 XML_L("parser suspended"),
1971 XML_L("parser not suspended"),
1972 XML_L("parsing aborted"),
1973 XML_L("parsing finished"),
1974 XML_L("cannot suspend in external parameter entity"),
1975 XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"),
1976 XML_L("reserved prefix (xmlns) must not be declared or undeclared"),
1977 XML_L("prefix must not be bound to one of the reserved namespace names")
1978 };
1979 if (code > 0 && code < sizeof(message)/sizeof(message[0]))
1980 return message[code];
1981 return NULL;
1982}
char XML_LChar
Definition: inftrees.h:24
#define XML_L(x)
Definition: xmlparse.cc:77

References XML_L.

Referenced by xDataXML_endXMLParsing().

◆ XML_ExpatVersion()

const XML_LChar *XMLCALL XML_ExpatVersion ( void  )

Definition at line 1985 of file xmlparse.cc.

1985 {
1986
1987 /* V1 is used to string-ize the version number. However, it would
1988 string-ize the actual version macro *names* unless we get them
1989 substituted before being passed to V1. CPP is defined to expand
1990 a macro, then rescan for more expansions. Thus, we use V2 to expand
1991 the version macros, then CPP will expand the resulting V1() macro
1992 with the correct numerals. */
1993 /* ### I'm assuming cpp is portable in this respect... */
1994
1995#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c)
1996#define V2(a,b,c) XML_L("expat_")V1(a,b,c)
1997
1999
2000#undef V1
2001#undef V2
2002}
#define XML_MAJOR_VERSION
Definition: expat.h:1039
#define XML_MINOR_VERSION
Definition: expat.h:1040
#define XML_MICRO_VERSION
Definition: expat.h:1041
#define V2(a, b, c)

References V2, XML_MAJOR_VERSION, XML_MICRO_VERSION, and XML_MINOR_VERSION.

◆ XML_ExpatVersionInfo()

XML_Expat_Version XMLCALL XML_ExpatVersionInfo ( void  )

Definition at line 2005 of file xmlparse.cc.

2006{
2007 XML_Expat_Version version;
2008
2009 version.major = XML_MAJOR_VERSION;
2010 version.minor = XML_MINOR_VERSION;
2011 version.micro = XML_MICRO_VERSION;
2012
2013 return version;
2014}

References XML_Expat_Version::major, XML_Expat_Version::micro, XML_Expat_Version::minor, XML_MAJOR_VERSION, XML_MICRO_VERSION, and XML_MINOR_VERSION.

◆ XML_ExternalEntityParserCreate()

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

Definition at line 986 of file xmlparse.cc.

989{
990 XML_Parser parser = oldParser;
991 DTD *newDtd = NULL;
992 DTD *oldDtd = _dtd;
993 XML_StartElementHandler oldStartElementHandler = startElementHandler;
994 XML_EndElementHandler oldEndElementHandler = endElementHandler;
995 XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
996 XML_ProcessingInstructionHandler oldProcessingInstructionHandler
998 XML_CommentHandler oldCommentHandler = commentHandler;
999 XML_StartCdataSectionHandler oldStartCdataSectionHandler
1001 XML_EndCdataSectionHandler oldEndCdataSectionHandler
1003 XML_DefaultHandler oldDefaultHandler = defaultHandler;
1004 XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler
1006 XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;
1007 XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler
1009 XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler
1011 XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
1012 XML_ExternalEntityRefHandler oldExternalEntityRefHandler
1014 XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler;
1015 XML_UnknownEncodingHandler oldUnknownEncodingHandler
1017 XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler;
1018 XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler;
1019 XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler;
1020 XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler;
1021 ELEMENT_TYPE * oldDeclElementType = declElementType;
1022
1023 void *oldUserData = userData;
1024 void *oldHandlerArg = handlerArg;
1025 XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
1026 XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
1027#ifdef XML_DTD
1028 enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;
1029 int oldInEntityValue = prologState.inEntityValue;
1030#endif
1031 XML_Bool oldns_triplets = ns_triplets;
1032 /* Note that the new parser shares the same hash secret as the old
1033 parser, so that dtdCopy and copyEntityTable can lookup values
1034 from hash tables associated with either parser without us having
1035 to worry which hash secrets each table has.
1036 */
1037 unsigned long oldhash_secret_salt = hash_secret_salt;
1038
1039#ifdef XML_DTD
1040 if (!context)
1041 newDtd = oldDtd;
1042#endif /* XML_DTD */
1043
1044 /* Note that the magical uses of the pre-processor to make field
1045 access look more like C++ require that `parser' be overwritten
1046 here. This makes this function more painful to follow than it
1047 would be otherwise.
1048 */
1049 if (ns) {
1050 XML_Char tmp[2];
1051 *tmp = namespaceSeparator;
1052 parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
1053 }
1054 else {
1055 parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd);
1056 }
1057
1058 if (!parser)
1059 return NULL;
1060
1061 startElementHandler = oldStartElementHandler;
1062 endElementHandler = oldEndElementHandler;
1063 characterDataHandler = oldCharacterDataHandler;
1064 processingInstructionHandler = oldProcessingInstructionHandler;
1065 commentHandler = oldCommentHandler;
1066 startCdataSectionHandler = oldStartCdataSectionHandler;
1067 endCdataSectionHandler = oldEndCdataSectionHandler;
1068 defaultHandler = oldDefaultHandler;
1069 unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
1070 notationDeclHandler = oldNotationDeclHandler;
1071 startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
1072 endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
1073 notStandaloneHandler = oldNotStandaloneHandler;
1074 externalEntityRefHandler = oldExternalEntityRefHandler;
1075 skippedEntityHandler = oldSkippedEntityHandler;
1076 unknownEncodingHandler = oldUnknownEncodingHandler;
1077 elementDeclHandler = oldElementDeclHandler;
1078 attlistDeclHandler = oldAttlistDeclHandler;
1079 entityDeclHandler = oldEntityDeclHandler;
1080 xmlDeclHandler = oldXmlDeclHandler;
1081 declElementType = oldDeclElementType;
1082 userData = oldUserData;
1083 if (oldUserData == oldHandlerArg)
1085 else
1087 if (oldExternalEntityRefHandlerArg != oldParser)
1088 externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
1089 defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
1090 ns_triplets = oldns_triplets;
1091 hash_secret_salt = oldhash_secret_salt;
1092 parentParser = oldParser;
1093#ifdef XML_DTD
1094 paramEntityParsing = oldParamEntityParsing;
1095 prologState.inEntityValue = oldInEntityValue;
1096 if (context) {
1097#endif /* XML_DTD */
1098 if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem)
1099 || !setContext(parser, context)) {
1101 return NULL;
1102 }
1104#ifdef XML_DTD
1105 }
1106 else {
1107 /* The DTD instance referenced by _dtd is shared between the document's
1108 root parser and external PE parsers, therefore one does not need to
1109 call setContext. In addition, one also *must* not call setContext,
1110 because this would overwrite existing prefix->binding pointers in
1111 _dtd with ones that get destroyed with the external PE parser.
1112 This would leave those prefixes with dangling pointers.
1113 */
1114 isParamEntity = XML_TRUE;
1115 XmlPrologStateInitExternalEntity(&prologState);
1116 processor = externalParEntInitProcessor;
1117 }
1118#endif /* XML_DTD */
1119 return parser;
1120}
void(XMLCALL * XML_CommentHandler)(void *userData, const XML_Char *data)
Definition: expat.h:272
void(XMLCALL * XML_EndElementHandler)(void *userData, const XML_Char *name)
Definition: expat.h:256
void(XMLCALL * XML_EndNamespaceDeclHandler)(void *userData, const XML_Char *prefix)
Definition: expat.h:383
void(XMLCALL * XML_SkippedEntityHandler)(void *userData, const XML_Char *entityName, int is_parameter_entity)
Definition: expat.h:449
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:432
void(XMLCALL * XML_EndCdataSectionHandler)(void *userData)
Definition: expat.h:276
int(XMLCALL * XML_UnknownEncodingHandler)(void *encodingHandlerData, const XML_Char *name, XML_Encoding *info)
Definition: expat.h:528
void(XMLCALL * XML_StartElementHandler)(void *userData, const XML_Char *name, const XML_Char **atts)
Definition: expat.h:252
void(XMLCALL * XML_ProcessingInstructionHandler)(void *userData, const XML_Char *target, const XML_Char *data)
Definition: expat.h:266
void(XMLCALL * XML_StartNamespaceDeclHandler)(void *userData, const XML_Char *prefix, const XML_Char *uri)
Definition: expat.h:378
void(XMLCALL * XML_XmlDeclHandler)(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
Definition: expat.h:186
void(XMLCALL * XML_StartCdataSectionHandler)(void *userData)
Definition: expat.h:275
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:353
XML_ParamEntityParsing
Definition: expat.h:876
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:166
int(XMLCALL * XML_NotStandaloneHandler)(void *userData)
Definition: expat.h:396
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:329
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:365
void(XMLCALL * XML_DefaultHandler)(void *userData, const XML_Char *s, int len)
Definition: expat.h:291
void(XMLCALL * XML_ElementDeclHandler)(void *userData, const XML_Char *name, XML_Content *model)
Definition: expat.h:150
static XML_Parser parserCreate(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, DTD *dtd)
Definition: xmlparse.cc:731
static Processor externalEntityInitProcessor
Definition: xmlparse.cc:324
static int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
Definition: xmlparse.cc:5757

References _dtd, attlistDeclHandler, characterDataHandler, commentHandler, g4zmq::context, declElementType, defaultExpandInternalEntities, defaultHandler, dtdCopy(), elementDeclHandler, endCdataSectionHandler, endElementHandler, endNamespaceDeclHandler, entityDeclHandler, externalEntityInitProcessor, externalEntityRefHandler, externalEntityRefHandlerArg, handlerArg, hash_secret_salt, namespaceSeparator, notationDeclHandler, notStandaloneHandler, ns, ns_triplets, parentParser, geant4_check_module_cycles::parser, parserCreate(), processingInstructionHandler, processor, prologState, setContext(), skippedEntityHandler, startCdataSectionHandler, startElementHandler, startNamespaceDeclHandler, unknownEncodingHandler, unparsedEntityDeclHandler, userData, XML_ParserFree(), XML_TRUE, and xmlDeclHandler.

◆ XML_FreeContentModel()

void XMLCALL XML_FreeContentModel ( XML_Parser  parser,
XML_Content model 
)

Definition at line 1896 of file xmlparse.cc.

1897{
1898 FREE(model);
1899}

References FREE.

◆ XML_GetBase()

const XML_Char *XMLCALL XML_GetBase ( XML_Parser  parser)

Definition at line 1253 of file xmlparse.cc.

1254{
1255 return curBase;
1256}

References curBase.

◆ XML_GetBuffer()

void *XMLCALL XML_GetBuffer ( XML_Parser  parser,
int  len 
)

Definition at line 1685 of file xmlparse.cc.

1686{
1687 switch (ps_parsing) {
1688 case XML_SUSPENDED:
1690 return NULL;
1691 case XML_FINISHED:
1693 return NULL;
1694 default: ;
1695 }
1696
1697 if (len > bufferLim - bufferEnd) {
1698 /* FIXME avoid integer overflow */
1699 int neededSize = len + (int)(bufferEnd - bufferPtr);
1700#ifdef XML_CONTEXT_BYTES
1701 int keep = (int)(bufferPtr - buffer);
1702
1703 if (keep > XML_CONTEXT_BYTES)
1704 keep = XML_CONTEXT_BYTES;
1705 neededSize += keep;
1706#endif /* defined XML_CONTEXT_BYTES */
1707 if (neededSize <= bufferLim - buffer) {
1708#ifdef XML_CONTEXT_BYTES
1709 if (keep < bufferPtr - buffer) {
1710 int offset = (int)(bufferPtr - buffer) - keep;
1711 memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
1712 bufferEnd -= offset;
1713 bufferPtr -= offset;
1714 }
1715#else
1716 memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
1718 bufferPtr = buffer;
1719#endif /* not defined XML_CONTEXT_BYTES */
1720 }
1721 else {
1722 char *newBuf;
1723 int bufferSize = (int)(bufferLim - bufferPtr);
1724 if (bufferSize == 0)
1725 bufferSize = INIT_BUFFER_SIZE;
1726 do {
1727 bufferSize *= 2;
1728 } while (bufferSize < neededSize);
1729 newBuf = (char *)MALLOC(bufferSize);
1730 if (newBuf == 0) {
1732 return NULL;
1733 }
1734 bufferLim = newBuf + bufferSize;
1735#ifdef XML_CONTEXT_BYTES
1736 if (bufferPtr) {
1737 int keep = (int)(bufferPtr - buffer);
1738 if (keep > XML_CONTEXT_BYTES)
1739 keep = XML_CONTEXT_BYTES;
1740 memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
1741 FREE(buffer);
1742 buffer = newBuf;
1743 bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;
1744 bufferPtr = buffer + keep;
1745 }
1746 else {
1747 bufferEnd = newBuf + (bufferEnd - bufferPtr);
1748 bufferPtr = buffer = newBuf;
1749 }
1750#else
1751 if (bufferPtr) {
1752 memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
1753 FREE(buffer);
1754 }
1755 bufferEnd = newBuf + (bufferEnd - bufferPtr);
1756 bufferPtr = buffer = newBuf;
1757#endif /* not defined XML_CONTEXT_BYTES */
1758 }
1759 eventPtr = eventEndPtr = NULL;
1760 positionPtr = NULL;
1761 }
1762 return bufferEnd;
1763}
#define XML_CONTEXT_BYTES
Definition: amigaconfig.h:24
@ XML_ERROR_SUSPENDED
Definition: expat.h:90
@ XML_ERROR_FINISHED
Definition: expat.h:93
#define INIT_BUFFER_SIZE
Definition: xmlparse.cc:146

References buffer, bufferEnd, bufferLim, bufferPtr, errorCode, eventEndPtr, eventPtr, FREE, INIT_BUFFER_SIZE, MALLOC, positionPtr, ps_parsing, XML_CONTEXT_BYTES, XML_ERROR_FINISHED, XML_ERROR_NO_MEMORY, XML_ERROR_SUSPENDED, XML_FINISHED, and XML_SUSPENDED.

Referenced by XML_Parse().

◆ XML_GetCurrentByteCount()

int XMLCALL XML_GetCurrentByteCount ( XML_Parser  parser)

Definition at line 1855 of file xmlparse.cc.

1856{
1857 if (eventEndPtr && eventPtr)
1858 return (int)(eventEndPtr - eventPtr);
1859 return 0;
1860}

References eventEndPtr, and eventPtr.

◆ XML_GetCurrentByteIndex()

XML_Index XMLCALL XML_GetCurrentByteIndex ( XML_Parser  parser)

Definition at line 1847 of file xmlparse.cc.

1848{
1849 if (eventPtr)
1851 return -1;
1852}

References eventPtr, parseEndByteIndex, and parseEndPtr.

◆ XML_GetCurrentColumnNumber()

XML_Size XMLCALL XML_GetCurrentColumnNumber ( XML_Parser  parser)

Definition at line 1886 of file xmlparse.cc.

1887{
1888 if (eventPtr && eventPtr >= positionPtr) {
1891 }
1892 return position.columnNumber;
1893}
XML_Size columnNumber
Definition: xmltok.h:113
#define XmlUpdatePosition(enc, ptr, end, pos)
Definition: xmltok.h:247

References position::columnNumber, eventPtr, positionPtr, and XmlUpdatePosition.

Referenced by xDataXML_endXMLParsing(), and xDataXML_parseGetCurrentPosition().

◆ XML_GetCurrentLineNumber()

XML_Size XMLCALL XML_GetCurrentLineNumber ( XML_Parser  parser)

Definition at line 1876 of file xmlparse.cc.

1877{
1878 if (eventPtr && eventPtr >= positionPtr) {
1881 }
1882 return position.lineNumber + 1;
1883}
XML_Size lineNumber
Definition: xmltok.h:112

References eventPtr, position::lineNumber, positionPtr, and XmlUpdatePosition.

Referenced by xDataXML_endXMLParsing(), and xDataXML_parseGetCurrentPosition().

◆ XML_GetErrorCode()

enum XML_Error XMLCALL XML_GetErrorCode ( XML_Parser  parser)

Definition at line 1841 of file xmlparse.cc.

1842{
1843 return errorCode;
1844}

References errorCode.

Referenced by xDataXML_endXMLParsing().

◆ XML_GetFeatureList()

const XML_Feature *XMLCALL XML_GetFeatureList ( void  )

Definition at line 2017 of file xmlparse.cc.

2018{
2019 static const XML_Feature features[] = {
2020 {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
2021 sizeof(XML_Char)},
2022 {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"),
2023 sizeof(XML_LChar)},
2024#ifdef XML_UNICODE
2025 {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0},
2026#endif
2027#ifdef XML_UNICODE_WCHAR_T
2028 {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0},
2029#endif
2030#ifdef XML_DTD
2031 {XML_FEATURE_DTD, XML_L("XML_DTD"), 0},
2032#endif
2033#ifdef XML_CONTEXT_BYTES
2034 {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
2036#endif
2037#ifdef XML_MIN_SIZE
2038 {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0},
2039#endif
2040#ifdef XML_NS
2041 {XML_FEATURE_NS, XML_L("XML_NS"), 0},
2042#endif
2043#ifdef XML_LARGE_SIZE
2044 {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0},
2045#endif
2046#ifdef XML_ATTR_INFO
2047 {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0},
2048#endif
2049 {XML_FEATURE_END, NULL, 0}
2050 };
2051
2052 return features;
2053}
@ XML_FEATURE_DTD
Definition: expat.h:1013
@ XML_FEATURE_SIZEOF_XML_LCHAR
Definition: expat.h:1017
@ XML_FEATURE_NS
Definition: expat.h:1018
@ XML_FEATURE_UNICODE
Definition: expat.h:1011
@ XML_FEATURE_SIZEOF_XML_CHAR
Definition: expat.h:1016
@ XML_FEATURE_MIN_SIZE
Definition: expat.h:1015
@ XML_FEATURE_END
Definition: expat.h:1010
@ XML_FEATURE_UNICODE_WCHAR_T
Definition: expat.h:1012
@ XML_FEATURE_CONTEXT_BYTES
Definition: expat.h:1014
@ XML_FEATURE_LARGE_SIZE
Definition: expat.h:1019
@ XML_FEATURE_ATTR_INFO
Definition: expat.h:1020

References XML_CONTEXT_BYTES, XML_FEATURE_ATTR_INFO, XML_FEATURE_CONTEXT_BYTES, XML_FEATURE_DTD, XML_FEATURE_END, XML_FEATURE_LARGE_SIZE, XML_FEATURE_MIN_SIZE, XML_FEATURE_NS, XML_FEATURE_SIZEOF_XML_CHAR, XML_FEATURE_SIZEOF_XML_LCHAR, XML_FEATURE_UNICODE, XML_FEATURE_UNICODE_WCHAR_T, and XML_L.

◆ XML_GetIdAttributeIndex()

int XMLCALL XML_GetIdAttributeIndex ( XML_Parser  parser)

Definition at line 1265 of file xmlparse.cc.

1266{
1267 return idAttIndex;
1268}

References idAttIndex.

◆ XML_GetInputContext()

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

Definition at line 1863 of file xmlparse.cc.

1864{
1865#ifdef XML_CONTEXT_BYTES
1866 if (eventPtr && buffer) {
1867 *offset = (int)(eventPtr - buffer);
1868 *size = (int)(bufferEnd - buffer);
1869 return buffer;
1870 }
1871#endif /* defined XML_CONTEXT_BYTES */
1872 return (char *) 0;
1873}

References buffer, bufferEnd, and eventPtr.

◆ XML_GetParsingStatus()

void XMLCALL XML_GetParsingStatus ( XML_Parser  parser,
XML_ParsingStatus status 
)

Definition at line 1834 of file xmlparse.cc.

1835{
1836 assert(status != NULL);
1837 *status = parser->m_parsingStatus;
1838}

References geant4_check_module_cycles::parser.

◆ XML_GetSpecifiedAttributeCount()

int XMLCALL XML_GetSpecifiedAttributeCount ( XML_Parser  parser)

Definition at line 1259 of file xmlparse.cc.

1260{
1261 return nSpecifiedAtts;
1262}

References nSpecifiedAtts.

◆ XML_MemFree()

void XMLCALL XML_MemFree ( XML_Parser  parser,
void *  ptr 
)

Definition at line 1914 of file xmlparse.cc.

1915{
1916 FREE(ptr);
1917}

References FREE.

◆ XML_MemMalloc()

void *XMLCALL XML_MemMalloc ( XML_Parser  parser,
size_t  size 
)

Definition at line 1902 of file xmlparse.cc.

1903{
1904 return MALLOC(size);
1905}

References MALLOC.

◆ XML_MemRealloc()

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

Definition at line 1908 of file xmlparse.cc.

1909{
1910 return REALLOC(ptr, size);
1911}

References REALLOC.

◆ XML_Parse()

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

Definition at line 1506 of file xmlparse.cc.

1507{
1508 switch (ps_parsing) {
1509 case XML_SUSPENDED:
1511 return XML_STATUS_ERROR;
1512 case XML_FINISHED:
1514 return XML_STATUS_ERROR;
1515 case XML_INITIALIZED:
1516 if (parentParser == NULL && !startParsing(parser)) {
1518 return XML_STATUS_ERROR;
1519 }
1520 default:
1522 }
1523
1524 if (len == 0) {
1525 ps_finalBuffer = (XML_Bool)isFinal;
1526 if (!isFinal)
1527 return XML_STATUS_OK;
1530
1531 /* If data are left over from last buffer, and we now know that these
1532 data are the final chunk of input, then we have to check them again
1533 to detect errors based on that fact.
1534 */
1536
1537 if (errorCode == XML_ERROR_NONE) {
1538 switch (ps_parsing) {
1539 case XML_SUSPENDED:
1542 return XML_STATUS_SUSPENDED;
1543 case XML_INITIALIZED:
1544 case XML_PARSING:
1546 /* fall through */
1547 default:
1548 return XML_STATUS_OK;
1549 }
1550 }
1553 return XML_STATUS_ERROR;
1554 }
1555#ifndef XML_CONTEXT_BYTES
1556 else if (bufferPtr == bufferEnd) {
1557 const char *end;
1558 int nLeftOver;
1559 enum XML_Error result;
1560 parseEndByteIndex += len;
1561 positionPtr = s;
1562 ps_finalBuffer = (XML_Bool)isFinal;
1563
1564 errorCode = processor(parser, s, parseEndPtr = s + len, &end);
1565
1566 if (errorCode != XML_ERROR_NONE) {
1569 return XML_STATUS_ERROR;
1570 }
1571 else {
1572 switch (ps_parsing) {
1573 case XML_SUSPENDED:
1574 result = XML_STATUS_SUSPENDED;
1575 break;
1576 case XML_INITIALIZED:
1577 case XML_PARSING:
1578 if (isFinal) {
1580 return XML_STATUS_OK;
1581 }
1582 /* fall through */
1583 default:
1584 result = XML_STATUS_OK;
1585 }
1586 }
1587
1589 nLeftOver = s + len - end;
1590 if (nLeftOver) {
1591 if (buffer == NULL || nLeftOver > bufferLim - buffer) {
1592 /* FIXME avoid integer overflow */
1593 char *temp;
1594 temp = (buffer == NULL
1595 ? (char *)MALLOC(len * 2)
1596 : (char *)REALLOC(buffer, len * 2));
1597 if (temp == NULL) {
1599 eventPtr = eventEndPtr = NULL;
1601 return XML_STATUS_ERROR;
1602 }
1603 buffer = temp;
1604 bufferLim = buffer + len * 2;
1605 }
1606 memcpy(buffer, end, nLeftOver);
1607 }
1608 bufferPtr = buffer;
1609 bufferEnd = buffer + nLeftOver;
1614 return result;
1615 }
1616#endif /* not defined XML_CONTEXT_BYTES */
1617 else {
1618 void *buff = XML_GetBuffer(parser, len);
1619 if (buff == NULL)
1620 return XML_STATUS_ERROR;
1621 else {
1622 memcpy(buff, s, len);
1623 return XML_ParseBuffer(parser, len, isFinal);
1624 }
1625 }
1626}
@ XML_PARSING
Definition: expat.h:837
@ XML_STATUS_OK
Definition: expat.h:48
@ XML_STATUS_SUSPENDED
Definition: expat.h:50
@ XML_STATUS_ERROR
Definition: expat.h:46
static XML_Bool startParsing(XML_Parser parser)
Definition: xmlparse.cc:708
void *XMLCALL XML_GetBuffer(XML_Parser parser, int len)
Definition: xmlparse.cc:1685
static Processor errorProcessor
Definition: xmlparse.cc:323
enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
Definition: xmlparse.cc:1629

References buffer, bufferEnd, bufferLim, bufferPtr, errorCode, errorProcessor, eventEndPtr, eventPtr, MALLOC, parentParser, parseEndByteIndex, parseEndPtr, geant4_check_module_cycles::parser, positionPtr, processor, ps_finalBuffer, ps_parsing, REALLOC, s, startParsing(), XML_ERROR_FINISHED, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_SUSPENDED, XML_FINISHED, XML_GetBuffer(), XML_INITIALIZED, XML_ParseBuffer(), XML_PARSING, XML_STATUS_ERROR, XML_STATUS_OK, XML_STATUS_SUSPENDED, XML_SUSPENDED, and XmlUpdatePosition.

Referenced by xDataXML_endXMLParsing(), and xDataXML_parse().

◆ XML_ParseBuffer()

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

Definition at line 1629 of file xmlparse.cc.

1630{
1631 const char *start;
1632 enum XML_Status result = XML_STATUS_OK;
1633
1634 switch (ps_parsing) {
1635 case XML_SUSPENDED:
1637 return XML_STATUS_ERROR;
1638 case XML_FINISHED:
1640 return XML_STATUS_ERROR;
1641 case XML_INITIALIZED:
1642 if (parentParser == NULL && !startParsing(parser)) {
1644 return XML_STATUS_ERROR;
1645 }
1646 default:
1648 }
1649
1650 start = bufferPtr;
1651 positionPtr = start;
1652 bufferEnd += len;
1654 parseEndByteIndex += len;
1655 ps_finalBuffer = (XML_Bool)isFinal;
1656
1658
1659 if (errorCode != XML_ERROR_NONE) {
1662 return XML_STATUS_ERROR;
1663 }
1664 else {
1665 switch (ps_parsing) {
1666 case XML_SUSPENDED:
1667 result = XML_STATUS_SUSPENDED;
1668 break;
1669 case XML_INITIALIZED:
1670 case XML_PARSING:
1671 if (isFinal) {
1673 return result;
1674 }
1675 default: ; /* should not happen */
1676 }
1677 }
1678
1681 return result;
1682}
XML_Status
Definition: expat.h:45

References bufferEnd, bufferPtr, errorCode, errorProcessor, eventEndPtr, eventPtr, parentParser, parseEndByteIndex, parseEndPtr, geant4_check_module_cycles::parser, positionPtr, processor, ps_finalBuffer, ps_parsing, startParsing(), XML_ERROR_FINISHED, XML_ERROR_NO_MEMORY, XML_ERROR_NONE, XML_ERROR_SUSPENDED, XML_FINISHED, XML_INITIALIZED, XML_PARSING, XML_STATUS_ERROR, XML_STATUS_OK, XML_STATUS_SUSPENDED, XML_SUSPENDED, and XmlUpdatePosition.

Referenced by XML_Parse().

◆ XML_ParserCreate()

XML_Parser XMLCALL XML_ParserCreate ( const XML_Char encodingName)

Definition at line 677 of file xmlparse.cc.

678{
679 return XML_ParserCreate_MM(encodingName, NULL, NULL);
680}
XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep)
Definition: xmlparse.cc:723

References XML_ParserCreate_MM().

Referenced by xDataXML_initializeDoc().

◆ 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 723 of file xmlparse.cc.

726{
727 return parserCreate(encodingName, memsuite, nameSep, NULL);
728}

References parserCreate().

Referenced by XML_ParserCreate(), and XML_ParserCreateNS().

◆ XML_ParserCreateNS()

XML_Parser XMLCALL XML_ParserCreateNS ( const XML_Char encodingName,
XML_Char  nsSep 
)

Definition at line 683 of file xmlparse.cc.

684{
685 XML_Char tmp[2];
686 *tmp = nsSep;
687 return XML_ParserCreate_MM(encodingName, NULL, tmp);
688}

References XML_ParserCreate_MM().

◆ XML_ParserFree()

void XMLCALL XML_ParserFree ( XML_Parser  parser)

Definition at line 1136 of file xmlparse.cc.

1137{
1138 TAG *tagList;
1139 OPEN_INTERNAL_ENTITY *entityList;
1140 if (parser == NULL)
1141 return;
1142 /* free tagStack and freeTagList */
1143 tagList = tagStack;
1144 for (;;) {
1145 TAG *p;
1146 if (tagList == NULL) {
1147 if (freeTagList == NULL)
1148 break;
1149 tagList = freeTagList;
1150 freeTagList = NULL;
1151 }
1152 p = tagList;
1153 tagList = tagList->parent;
1154 FREE(p->buf);
1156 FREE(p);
1157 }
1158 /* free openInternalEntities and freeInternalEntities */
1159 entityList = openInternalEntities;
1160 for (;;) {
1161 OPEN_INTERNAL_ENTITY *openEntity;
1162 if (entityList == NULL) {
1163 if (freeInternalEntities == NULL)
1164 break;
1165 entityList = freeInternalEntities;
1166 freeInternalEntities = NULL;
1167 }
1168 openEntity = entityList;
1169 entityList = entityList->next;
1170 FREE(openEntity);
1171 }
1172
1177#ifdef XML_DTD
1178 /* external parameter entity parsers share the DTD structure
1179 parser->m_dtd with the root parser, so we must not destroy it
1180 */
1181 if (!isParamEntity && _dtd)
1182#else
1183 if (_dtd)
1184#endif /* XML_DTD */
1186 FREE((void *)atts);
1187#ifdef XML_ATTR_INFO
1188 FREE((void *)attInfo);
1189#endif
1191 FREE(buffer);
1192 FREE(dataBuf);
1193 FREE(nsAtts);
1197 FREE(parser);
1198}
static void dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms)
Definition: xmlparse.cc:5726
static void FASTCALL destroyBindings(BINDING *bindings, XML_Parser parser)
Definition: xmlparse.cc:1123

References _dtd, attInfo, atts, tag::bindings, tag::buf, buffer, dataBuf, destroyBindings(), dtdDestroy(), FREE, freeBindingList, freeInternalEntities, freeTagList, groupConnector, inheritedBindings, open_internal_entity::next, nsAtts, openInternalEntities, tag::parent, parentParser, geant4_check_module_cycles::parser, poolDestroy(), tagStack, temp2Pool, tempPool, unknownEncodingData, unknownEncodingMem, and unknownEncodingRelease.

Referenced by parserCreate(), xDataXML_endXMLParsing(), and XML_ExternalEntityParserCreate().

◆ XML_ParserReset()

XML_Bool XMLCALL XML_ParserReset ( XML_Parser  parser,
const XML_Char encodingName 
)

Definition at line 931 of file xmlparse.cc.

932{
933 TAG *tStk;
934 OPEN_INTERNAL_ENTITY *openEntityList;
935 if (parentParser)
936 return XML_FALSE;
937 /* move tagStack to freeTagList */
938 tStk = tagStack;
939 while (tStk) {
940 TAG *tag = tStk;
941 tStk = tStk->parent;
944 tag->bindings = NULL;
946 }
947 /* move openInternalEntities to freeInternalEntities */
948 openEntityList = openInternalEntities;
949 while (openEntityList) {
950 OPEN_INTERNAL_ENTITY *openEntity = openEntityList;
951 openEntityList = openEntity->next;
952 openEntity->next = freeInternalEntities;
953 freeInternalEntities = openEntity;
954 }
961 parserInit(parser, encodingName);
962 dtdReset(_dtd, &parser->m_mem);
963 return XML_TRUE;
964}
static void FASTCALL moveToFreeBindingList(XML_Parser parser, BINDING *bindings)
Definition: xmlparse.cc:920
static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms)
Definition: xmlparse.cc:5684

References _dtd, tag::bindings, dtdReset(), FREE, freeInternalEntities, freeTagList, inheritedBindings, moveToFreeBindingList(), open_internal_entity::next, openInternalEntities, tag::parent, parentParser, geant4_check_module_cycles::parser, parserInit(), poolClear(), tagStack, temp2Pool, tempPool, unknownEncodingData, unknownEncodingMem, unknownEncodingRelease, XML_FALSE, and XML_TRUE.

◆ XML_ResumeParser()

enum XML_Status XMLCALL XML_ResumeParser ( XML_Parser  parser)

Definition at line 1796 of file xmlparse.cc.

1797{
1798 enum XML_Status result = XML_STATUS_OK;
1799
1800 if (ps_parsing != XML_SUSPENDED) {
1802 return XML_STATUS_ERROR;
1803 }
1805
1807
1808 if (errorCode != XML_ERROR_NONE) {
1811 return XML_STATUS_ERROR;
1812 }
1813 else {
1814 switch (ps_parsing) {
1815 case XML_SUSPENDED:
1816 result = XML_STATUS_SUSPENDED;
1817 break;
1818 case XML_INITIALIZED:
1819 case XML_PARSING:
1820 if (ps_finalBuffer) {
1822 return result;
1823 }
1824 default: ;
1825 }
1826 }
1827
1830 return result;
1831}
@ XML_ERROR_NOT_SUSPENDED
Definition: expat.h:91

References bufferPtr, errorCode, errorProcessor, eventEndPtr, eventPtr, parseEndPtr, geant4_check_module_cycles::parser, positionPtr, processor, ps_finalBuffer, ps_parsing, XML_ERROR_NONE, XML_ERROR_NOT_SUSPENDED, XML_FINISHED, XML_INITIALIZED, XML_PARSING, XML_STATUS_ERROR, XML_STATUS_OK, XML_STATUS_SUSPENDED, XML_SUSPENDED, and XmlUpdatePosition.

◆ XML_SetAttlistDeclHandler()

void XMLCALL XML_SetAttlistDeclHandler ( XML_Parser  parser,
XML_AttlistDeclHandler  attdecl 
)

Definition at line 1460 of file xmlparse.cc.

1462{
1463 attlistDeclHandler = attdecl;
1464}

References attlistDeclHandler.

◆ XML_SetBase()

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

Definition at line 1239 of file xmlparse.cc.

1240{
1241 if (p) {
1242 p = poolCopyString(&_dtd->pool, p);
1243 if (!p)
1244 return XML_STATUS_ERROR;
1245 curBase = p;
1246 }
1247 else
1248 curBase = NULL;
1249 return XML_STATUS_OK;
1250}

References _dtd, curBase, poolCopyString(), XML_STATUS_ERROR, and XML_STATUS_OK.

◆ XML_SetCdataSectionHandler()

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

Definition at line 1321 of file xmlparse.cc.

1324{
1327}

References endCdataSectionHandler, and startCdataSectionHandler.

◆ XML_SetCharacterDataHandler()

void XMLCALL XML_SetCharacterDataHandler ( XML_Parser  parser,
XML_CharacterDataHandler  handler 
)

Definition at line 1300 of file xmlparse.cc.

1302{
1303 characterDataHandler = handler;
1304}

References characterDataHandler.

Referenced by xDataXML_initializeDoc().

◆ XML_SetCommentHandler()

void XMLCALL XML_SetCommentHandler ( XML_Parser  parser,
XML_CommentHandler  handler 
)

Definition at line 1314 of file xmlparse.cc.

1316{
1317 commentHandler = handler;
1318}

References commentHandler.

◆ XML_SetDefaultHandler()

void XMLCALL XML_SetDefaultHandler ( XML_Parser  parser,
XML_DefaultHandler  handler 
)

Definition at line 1342 of file xmlparse.cc.

1344{
1345 defaultHandler = handler;
1347}

References defaultExpandInternalEntities, defaultHandler, and XML_FALSE.

◆ XML_SetDefaultHandlerExpand()

void XMLCALL XML_SetDefaultHandlerExpand ( XML_Parser  parser,
XML_DefaultHandler  handler 
)

Definition at line 1350 of file xmlparse.cc.

1352{
1353 defaultHandler = handler;
1355}

References defaultExpandInternalEntities, defaultHandler, and XML_TRUE.

◆ XML_SetDoctypeDeclHandler()

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

Definition at line 1358 of file xmlparse.cc.

1361{
1364}

References endDoctypeDeclHandler, and startDoctypeDeclHandler.

◆ XML_SetElementDeclHandler()

void XMLCALL XML_SetElementDeclHandler ( XML_Parser  parser,
XML_ElementDeclHandler  eldecl 
)

Definition at line 1453 of file xmlparse.cc.

1455{
1456 elementDeclHandler = eldecl;
1457}

References elementDeclHandler.

◆ XML_SetElementHandler()

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

Definition at line 1279 of file xmlparse.cc.

1282{
1283 startElementHandler = start;
1284 endElementHandler = end;
1285}

References endElementHandler, and startElementHandler.

Referenced by xDataXML_initializeDoc().

◆ XML_SetEncoding()

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

Definition at line 967 of file xmlparse.cc.

968{
969 /* Block after XML_Parse()/XML_ParseBuffer() has been called.
970 XXX There's no way for the caller to determine which of the
971 XXX possible error cases caused the XML_STATUS_ERROR return.
972 */
974 return XML_STATUS_ERROR;
975 if (encodingName == NULL)
977 else {
980 return XML_STATUS_ERROR;
981 }
982 return XML_STATUS_OK;
983}

References poolCopyString(), protocolEncodingName, ps_parsing, tempPool, XML_PARSING, XML_STATUS_ERROR, XML_STATUS_OK, and XML_SUSPENDED.

◆ XML_SetEndCdataSectionHandler()

void XMLCALL XML_SetEndCdataSectionHandler ( XML_Parser  parser,
XML_EndCdataSectionHandler  end 
)

Definition at line 1336 of file xmlparse.cc.

1337 {
1339}

References endCdataSectionHandler.

◆ XML_SetEndDoctypeDeclHandler()

void XMLCALL XML_SetEndDoctypeDeclHandler ( XML_Parser  parser,
XML_EndDoctypeDeclHandler  end 
)

Definition at line 1373 of file xmlparse.cc.

1374 {
1376}

References endDoctypeDeclHandler.

◆ XML_SetEndElementHandler()

void XMLCALL XML_SetEndElementHandler ( XML_Parser  parser,
XML_EndElementHandler  end 
)

Definition at line 1294 of file xmlparse.cc.

1295 {
1296 endElementHandler = end;
1297}

References endElementHandler.

◆ XML_SetEndNamespaceDeclHandler()

void XMLCALL XML_SetEndNamespaceDeclHandler ( XML_Parser  parser,
XML_EndNamespaceDeclHandler  end 
)

Definition at line 1408 of file xmlparse.cc.

1409 {
1411}

References endNamespaceDeclHandler.

◆ XML_SetEntityDeclHandler()

void XMLCALL XML_SetEntityDeclHandler ( XML_Parser  parser,
XML_EntityDeclHandler  handler 
)

Definition at line 1467 of file xmlparse.cc.

1469{
1470 entityDeclHandler = handler;
1471}

References entityDeclHandler.

◆ XML_SetExternalEntityRefHandler()

void XMLCALL XML_SetExternalEntityRefHandler ( XML_Parser  parser,
XML_ExternalEntityRefHandler  handler 
)

Definition at line 1421 of file xmlparse.cc.

1423{
1424 externalEntityRefHandler = handler;
1425}

References externalEntityRefHandler.

◆ XML_SetExternalEntityRefHandlerArg()

void XMLCALL XML_SetExternalEntityRefHandlerArg ( XML_Parser  parser,
void *  arg 
)

Definition at line 1428 of file xmlparse.cc.

1429{
1430 if (arg)
1432 else
1434}

References externalEntityRefHandlerArg, and geant4_check_module_cycles::parser.

◆ XML_SetHashSalt()

int XMLCALL XML_SetHashSalt ( XML_Parser  parser,
unsigned long  hash_salt 
)

Definition at line 1495 of file xmlparse.cc.

1497{
1498 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1500 return 0;
1501 hash_secret_salt = hash_salt;
1502 return 1;
1503}

References hash_secret_salt, ps_parsing, XML_PARSING, and XML_SUSPENDED.

◆ XML_SetNamespaceDeclHandler()

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

Definition at line 1393 of file xmlparse.cc.

1396{
1399}

References endNamespaceDeclHandler, and startNamespaceDeclHandler.

◆ XML_SetNotationDeclHandler()

void XMLCALL XML_SetNotationDeclHandler ( XML_Parser  parser,
XML_NotationDeclHandler  handler 
)

Definition at line 1386 of file xmlparse.cc.

1388{
1389 notationDeclHandler = handler;
1390}

References notationDeclHandler.

◆ XML_SetNotStandaloneHandler()

void XMLCALL XML_SetNotStandaloneHandler ( XML_Parser  parser,
XML_NotStandaloneHandler  handler 
)

Definition at line 1414 of file xmlparse.cc.

1416{
1417 notStandaloneHandler = handler;
1418}

References notStandaloneHandler.

◆ XML_SetParamEntityParsing()

int XMLCALL XML_SetParamEntityParsing ( XML_Parser  parser,
enum XML_ParamEntityParsing  peParsing 
)

Definition at line 1480 of file xmlparse.cc.

1482{
1483 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1485 return 0;
1486#ifdef XML_DTD
1487 paramEntityParsing = peParsing;
1488 return 1;
1489#else
1490 return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;
1491#endif
1492}

References ps_parsing, XML_PARAM_ENTITY_PARSING_NEVER, XML_PARSING, and XML_SUSPENDED.

◆ XML_SetProcessingInstructionHandler()

void XMLCALL XML_SetProcessingInstructionHandler ( XML_Parser  parser,
XML_ProcessingInstructionHandler  handler 
)

Definition at line 1307 of file xmlparse.cc.

1309{
1311}

References processingInstructionHandler.

◆ XML_SetReturnNSTriplet()

void XMLCALL XML_SetReturnNSTriplet ( XML_Parser  parser,
int  do_nst 
)

Definition at line 1221 of file xmlparse.cc.

1222{
1223 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1225 return;
1226 ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
1227}

References ns_triplets, ps_parsing, XML_FALSE, XML_PARSING, XML_SUSPENDED, and XML_TRUE.

◆ XML_SetSkippedEntityHandler()

void XMLCALL XML_SetSkippedEntityHandler ( XML_Parser  parser,
XML_SkippedEntityHandler  handler 
)

Definition at line 1437 of file xmlparse.cc.

1439{
1440 skippedEntityHandler = handler;
1441}

References skippedEntityHandler.

◆ XML_SetStartCdataSectionHandler()

void XMLCALL XML_SetStartCdataSectionHandler ( XML_Parser  parser,
XML_StartCdataSectionHandler  start 
)

Definition at line 1330 of file xmlparse.cc.

1331 {
1333}

References startCdataSectionHandler.

◆ XML_SetStartDoctypeDeclHandler()

void XMLCALL XML_SetStartDoctypeDeclHandler ( XML_Parser  parser,
XML_StartDoctypeDeclHandler  start 
)

Definition at line 1367 of file xmlparse.cc.

1368 {
1370}

References startDoctypeDeclHandler.

◆ XML_SetStartElementHandler()

void XMLCALL XML_SetStartElementHandler ( XML_Parser  parser,
XML_StartElementHandler  start 
)

Definition at line 1288 of file xmlparse.cc.

1289 {
1290 startElementHandler = start;
1291}

References startElementHandler.

◆ XML_SetStartNamespaceDeclHandler()

void XMLCALL XML_SetStartNamespaceDeclHandler ( XML_Parser  parser,
XML_StartNamespaceDeclHandler  start 
)

Definition at line 1402 of file xmlparse.cc.

1403 {
1405}

References startNamespaceDeclHandler.

◆ XML_SetUnknownEncodingHandler()

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

Definition at line 1444 of file xmlparse.cc.

1447{
1448 unknownEncodingHandler = handler;
1450}

References unknownEncodingHandler, and unknownEncodingHandlerData.

◆ XML_SetUnparsedEntityDeclHandler()

void XMLCALL XML_SetUnparsedEntityDeclHandler ( XML_Parser  parser,
XML_UnparsedEntityDeclHandler  handler 
)

Definition at line 1379 of file xmlparse.cc.

1381{
1382 unparsedEntityDeclHandler = handler;
1383}

References unparsedEntityDeclHandler.

◆ XML_SetUserData()

void XMLCALL XML_SetUserData ( XML_Parser  parser,
void *  p 
)

Definition at line 1230 of file xmlparse.cc.

1231{
1232 if (handlerArg == userData)
1233 handlerArg = userData = p;
1234 else
1235 userData = p;
1236}

References handlerArg, and userData.

Referenced by xDataXML_initializeDoc().

◆ XML_SetXmlDeclHandler()

void XMLCALL XML_SetXmlDeclHandler ( XML_Parser  parser,
XML_XmlDeclHandler  handler 
)

Definition at line 1474 of file xmlparse.cc.

1475 {
1476 xmlDeclHandler = handler;
1477}

References xmlDeclHandler.

◆ XML_StopParser()

enum XML_Status XMLCALL XML_StopParser ( XML_Parser  parser,
XML_Bool  resumable 
)

Definition at line 1766 of file xmlparse.cc.

1767{
1768 switch (ps_parsing) {
1769 case XML_SUSPENDED:
1770 if (resumable) {
1772 return XML_STATUS_ERROR;
1773 }
1775 break;
1776 case XML_FINISHED:
1778 return XML_STATUS_ERROR;
1779 default:
1780 if (resumable) {
1781#ifdef XML_DTD
1782 if (isParamEntity) {
1784 return XML_STATUS_ERROR;
1785 }
1786#endif
1788 }
1789 else
1791 }
1792 return XML_STATUS_OK;
1793}
@ XML_ERROR_SUSPEND_PE
Definition: expat.h:94

References errorCode, ps_parsing, XML_ERROR_FINISHED, XML_ERROR_SUSPEND_PE, XML_ERROR_SUSPENDED, XML_FINISHED, XML_STATUS_ERROR, XML_STATUS_OK, and XML_SUSPENDED.

◆ XML_UseForeignDTD()

enum XML_Error XMLCALL XML_UseForeignDTD ( XML_Parser  parser,
XML_Bool  useDTD 
)

Definition at line 1207 of file xmlparse.cc.

1208{
1209#ifdef XML_DTD
1210 /* block after XML_Parse()/XML_ParseBuffer() has been called */
1213 useForeignDTD = useDTD;
1214 return XML_ERROR_NONE;
1215#else
1217#endif
1218}
@ XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
Definition: expat.h:81
@ XML_ERROR_FEATURE_REQUIRES_XML_DTD
Definition: expat.h:80

References ps_parsing, XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, XML_ERROR_FEATURE_REQUIRES_XML_DTD, XML_ERROR_NONE, XML_PARSING, and XML_SUSPENDED.

◆ XML_UseParserAsHandlerArg()

void XMLCALL XML_UseParserAsHandlerArg ( XML_Parser  parser)

Definition at line 1201 of file xmlparse.cc.

1202{
1204}

References handlerArg, and geant4_check_module_cycles::parser.

Variable Documentation

◆ cdataSectionProcessor

Processor cdataSectionProcessor
static

Definition at line 314 of file xmlparse.cc.

Referenced by doContent().

◆ contentProcessor

Processor contentProcessor
static

Definition at line 313 of file xmlparse.cc.

Referenced by cdataSectionProcessor(), doProlog(), and internalEntityProcessor().

◆ epilogProcessor

Processor epilogProcessor
static

Definition at line 322 of file xmlparse.cc.

Referenced by doContent(), and epilogProcessor().

◆ errorProcessor

Processor errorProcessor
static

Definition at line 323 of file xmlparse.cc.

Referenced by XML_Parse(), XML_ParseBuffer(), and XML_ResumeParser().

◆ externalEntityContentProcessor

Processor externalEntityContentProcessor
static

Definition at line 327 of file xmlparse.cc.

Referenced by cdataSectionProcessor(), and externalEntityInitProcessor3().

◆ externalEntityInitProcessor

Processor externalEntityInitProcessor
static

Definition at line 324 of file xmlparse.cc.

Referenced by XML_ExternalEntityParserCreate().

◆ externalEntityInitProcessor2

Processor externalEntityInitProcessor2
static

Definition at line 325 of file xmlparse.cc.

Referenced by externalEntityInitProcessor().

◆ externalEntityInitProcessor3

Processor externalEntityInitProcessor3
static

Definition at line 326 of file xmlparse.cc.

Referenced by externalEntityInitProcessor2().

◆ implicitContext

const XML_Char implicitContext[]
static

◆ internalEntityProcessor

Processor internalEntityProcessor
static

Definition at line 328 of file xmlparse.cc.

Referenced by processInternalEntity().

◆ prologInitProcessor

Processor prologInitProcessor
static

Definition at line 312 of file xmlparse.cc.

Referenced by parserInit().

◆ prologProcessor

Processor prologProcessor
static

Definition at line 311 of file xmlparse.cc.

Referenced by internalEntityProcessor(), and prologInitProcessor().