6 #if defined(__clang__) || defined(__GNUC__)
7 #pragma GCC diagnostic ignored "-Wshadow"
8 #pragma GCC diagnostic ignored "-Wunused-parameter"
17 #define XML_BUILDING_EXPAT 1
19 #ifdef COMPILED_FROM_DSP
20 #include "winconfig.h"
21 #elif defined(MACOS_CLASSIC)
22 #include "macconfig.h"
23 #elif defined(__amigaos__)
24 #include "amigaconfig.h"
25 #elif defined(__WATCOMC__)
26 #include "watcomconfig.h"
27 #elif defined(HAVE_EXPAT_CONFIG_H)
28 #include <expat_config.h>
35 #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
36 #define XmlConvert XmlUtf16Convert
37 #define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
38 #define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
39 #define XmlEncode XmlUtf16Encode
41 #define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1))
42 typedef unsigned short ICHAR;
44 #define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
45 #define XmlConvert XmlUtf8Convert
46 #define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
47 #define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
48 #define XmlEncode XmlUtf8Encode
49 #define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
56 #define XmlInitEncodingNS XmlInitEncoding
57 #define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
58 #undef XmlGetInternalEncodingNS
59 #define XmlGetInternalEncodingNS XmlGetInternalEncoding
60 #define XmlParseXmlDeclNS XmlParseXmlDecl
66 #ifdef XML_UNICODE_WCHAR_T
67 #define XML_T(x) (const wchar_t)x
68 #define XML_L(x) L ## x
70 #define XML_T(x) (const unsigned short)x
82 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
87 #define memmove(d,s,l) bcopy((s),(d),(l))
89 #error memmove does not exist on this platform, nor is a substitute available
97 typedef const XML_Char *
KEY;
108 const XML_Memory_Handling_Suite *
mem;
116 #define CHAR_HASH(h, c) \
117 (((h) * 0xF4243) ^ (unsigned short)(c))
119 #define CHAR_HASH(h, c) \
120 (((h) * 0xF4243) ^ (unsigned char)(c))
131 #define SECOND_HASH(hash, mask, power) \
132 ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2))
133 #define PROBE_STEP(hash, mask, power) \
134 ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
141 #define INIT_TAG_BUF_SIZE 32
142 #define INIT_DATA_BUF_SIZE 1024
143 #define INIT_ATTS_SIZE 16
144 #define INIT_ATTS_VERSION 0xFFFFFFFF
145 #define INIT_BLOCK_SIZE 1024
146 #define INIT_BUFFER_SIZE 1024
148 #define EXPAND_SPARE 24
212 enum XML_Content_Type type;
213 enum XML_Content_Quant quant;
221 #define INIT_SCAFFOLD_ELEMENTS 32
235 const XML_Memory_Handling_Suite *
mem;
283 XML_Bool paramEntityRead;
309 const char **endPtr);
317 static Processor externalParEntProcessor;
318 static Processor externalParEntInitProcessor;
320 static Processor entityValueInitProcessor;
330 static enum XML_Error
332 static enum XML_Error
334 const char *
s,
const char *
next);
335 static enum XML_Error
337 static enum XML_Error
339 const char *end,
int tok,
const char *
next,
const char **nextPtr,
341 static enum XML_Error
344 static enum XML_Error
346 const char *start,
const char *end,
const char **endPtr,
348 static enum XML_Error
350 const char *end,
const char **nextPtr, XML_Bool haveMore);
352 static enum XML_Error
353 doIgnoreSection(XML_Parser
parser,
const ENCODING *,
const char **startPtr,
354 const char *end,
const char **nextPtr, XML_Bool haveMore);
357 static enum XML_Error
360 static enum XML_Error
362 const XML_Char *uri,
BINDING **bindingsPtr);
365 XML_Bool isId,
const XML_Char *dfltValue, XML_Parser
parser);
366 static enum XML_Error
369 static enum XML_Error
377 static enum XML_Error
382 const char *start,
const char *end);
398 static void dtdReset(
DTD *p,
const XML_Memory_Handling_Suite *
ms);
400 dtdDestroy(
DTD *p, XML_Bool isDocEntity,
const XML_Memory_Handling_Suite *
ms);
403 DTD *newDtd,
const DTD *oldDtd,
const XML_Memory_Handling_Suite *
ms);
423 const char *ptr,
const char *end);
426 const char *ptr,
const char *end);
428 static const XML_Char * FASTCALL
430 static const XML_Char *
432 static const XML_Char * FASTCALL
439 const char *ptr,
const char *end);
446 const XML_Memory_Handling_Suite *memsuite,
447 const XML_Char *nameSep,
453 #define poolStart(pool) ((pool)->start)
454 #define poolEnd(pool) ((pool)->ptr)
455 #define poolLength(pool) ((pool)->ptr - (pool)->start)
456 #define poolChop(pool) ((void)--(pool->ptr))
457 #define poolLastChar(pool) (((pool)->ptr)[-1])
458 #define poolDiscard(pool) ((pool)->ptr = (pool)->start)
459 #define poolFinish(pool) ((pool)->start = (pool)->ptr)
460 #define poolAppendChar(pool, c) \
461 (((pool)->ptr == (pool)->end && !poolGrow(pool)) \
463 : ((*((pool)->ptr)++ = c), 1))
471 const XML_Memory_Handling_Suite
m_mem;
514 void (XMLCALL *m_unknownEncodingRelease)(
void *);
550 XML_AttrInfo *m_attInfo;
561 XML_Bool m_isParamEntity;
562 XML_Bool m_useForeignDTD;
563 enum XML_ParamEntityParsing m_paramEntityParsing;
568 #define MALLOC(s) (parser->m_mem.malloc_fcn((s)))
569 #define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s)))
570 #define FREE(p) (parser->m_mem.free_fcn((p)))
572 #define userData (parser->m_userData)
573 #define handlerArg (parser->m_handlerArg)
574 #define startElementHandler (parser->m_startElementHandler)
575 #define endElementHandler (parser->m_endElementHandler)
576 #define characterDataHandler (parser->m_characterDataHandler)
577 #define processingInstructionHandler \
578 (parser->m_processingInstructionHandler)
579 #define commentHandler (parser->m_commentHandler)
580 #define startCdataSectionHandler \
581 (parser->m_startCdataSectionHandler)
582 #define endCdataSectionHandler (parser->m_endCdataSectionHandler)
583 #define defaultHandler (parser->m_defaultHandler)
584 #define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler)
585 #define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler)
586 #define unparsedEntityDeclHandler \
587 (parser->m_unparsedEntityDeclHandler)
588 #define notationDeclHandler (parser->m_notationDeclHandler)
589 #define startNamespaceDeclHandler \
590 (parser->m_startNamespaceDeclHandler)
591 #define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler)
592 #define notStandaloneHandler (parser->m_notStandaloneHandler)
593 #define externalEntityRefHandler \
594 (parser->m_externalEntityRefHandler)
595 #define externalEntityRefHandlerArg \
596 (parser->m_externalEntityRefHandlerArg)
597 #define internalEntityRefHandler \
598 (parser->m_internalEntityRefHandler)
599 #define skippedEntityHandler (parser->m_skippedEntityHandler)
600 #define unknownEncodingHandler (parser->m_unknownEncodingHandler)
601 #define elementDeclHandler (parser->m_elementDeclHandler)
602 #define attlistDeclHandler (parser->m_attlistDeclHandler)
603 #define entityDeclHandler (parser->m_entityDeclHandler)
604 #define xmlDeclHandler (parser->m_xmlDeclHandler)
605 #define encoding (parser->m_encoding)
606 #define initEncoding (parser->m_initEncoding)
607 #define internalEncoding (parser->m_internalEncoding)
608 #define unknownEncodingMem (parser->m_unknownEncodingMem)
609 #define unknownEncodingData (parser->m_unknownEncodingData)
610 #define unknownEncodingHandlerData \
611 (parser->m_unknownEncodingHandlerData)
612 #define unknownEncodingRelease (parser->m_unknownEncodingRelease)
613 #define protocolEncodingName (parser->m_protocolEncodingName)
614 #define ns (parser->m_ns)
615 #define ns_triplets (parser->m_ns_triplets)
616 #define prologState (parser->m_prologState)
617 #define processor (parser->m_processor)
618 #define errorCode (parser->m_errorCode)
619 #define eventPtr (parser->m_eventPtr)
620 #define eventEndPtr (parser->m_eventEndPtr)
621 #define positionPtr (parser->m_positionPtr)
622 #define position (parser->m_position)
623 #define openInternalEntities (parser->m_openInternalEntities)
624 #define freeInternalEntities (parser->m_freeInternalEntities)
625 #define defaultExpandInternalEntities \
626 (parser->m_defaultExpandInternalEntities)
627 #define tagLevel (parser->m_tagLevel)
628 #define buffer (parser->m_buffer)
629 #define bufferPtr (parser->m_bufferPtr)
630 #define bufferEnd (parser->m_bufferEnd)
631 #define parseEndByteIndex (parser->m_parseEndByteIndex)
632 #define parseEndPtr (parser->m_parseEndPtr)
633 #define bufferLim (parser->m_bufferLim)
634 #define dataBuf (parser->m_dataBuf)
635 #define dataBufEnd (parser->m_dataBufEnd)
636 #define _dtd (parser->m_dtd)
637 #define curBase (parser->m_curBase)
638 #define declEntity (parser->m_declEntity)
639 #define doctypeName (parser->m_doctypeName)
640 #define doctypeSysid (parser->m_doctypeSysid)
641 #define doctypePubid (parser->m_doctypePubid)
642 #define declAttributeType (parser->m_declAttributeType)
643 #define declNotationName (parser->m_declNotationName)
644 #define declNotationPublicId (parser->m_declNotationPublicId)
645 #define declElementType (parser->m_declElementType)
646 #define declAttributeId (parser->m_declAttributeId)
647 #define declAttributeIsCdata (parser->m_declAttributeIsCdata)
648 #define declAttributeIsId (parser->m_declAttributeIsId)
649 #define freeTagList (parser->m_freeTagList)
650 #define freeBindingList (parser->m_freeBindingList)
651 #define inheritedBindings (parser->m_inheritedBindings)
652 #define tagStack (parser->m_tagStack)
653 #define atts (parser->m_atts)
654 #define attsSize (parser->m_attsSize)
655 #define nSpecifiedAtts (parser->m_nSpecifiedAtts)
656 #define idAttIndex (parser->m_idAttIndex)
657 #define nsAtts (parser->m_nsAtts)
658 #define nsAttsVersion (parser->m_nsAttsVersion)
659 #define nsAttsPower (parser->m_nsAttsPower)
660 #define attInfo (parser->m_attInfo)
661 #define tempPool (parser->m_tempPool)
662 #define temp2Pool (parser->m_temp2Pool)
663 #define groupConnector (parser->m_groupConnector)
664 #define groupSize (parser->m_groupSize)
665 #define namespaceSeparator (parser->m_namespaceSeparator)
666 #define parentParser (parser->m_parentParser)
667 #define ps_parsing (parser->m_parsingStatus.parsing)
668 #define ps_finalBuffer (parser->m_parsingStatus.finalBuffer)
670 #define isParamEntity (parser->m_isParamEntity)
671 #define useForeignDTD (parser->m_useForeignDTD)
672 #define paramEntityParsing (parser->m_paramEntityParsing)
674 #define hash_secret_salt (parser->m_hash_secret_salt)
691 ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p,
692 ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,
693 ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,
694 ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,
695 ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,
696 ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e,
'\0'
702 unsigned int seed = time(NULL) % UINT_MAX;
724 const XML_Memory_Handling_Suite *memsuite,
725 const XML_Char *nameSep)
727 return parserCreate(encodingName, memsuite, nameSep, NULL);
732 const XML_Memory_Handling_Suite *memsuite,
733 const XML_Char *nameSep,
739 XML_Memory_Handling_Suite *mtemp;
740 parser = (XML_Parser)
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;
750 XML_Memory_Handling_Suite *mtemp;
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;
911 isParamEntity = XML_FALSE;
912 useForeignDTD = XML_FALSE;
913 paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
949 while (openEntityList) {
951 openEntityList = openEntity->
next;
966 enum XML_Status XMLCALL
974 return XML_STATUS_ERROR;
975 if (encodingName == NULL)
980 return XML_STATUS_ERROR;
982 return XML_STATUS_OK;
987 const XML_Char *context,
988 const XML_Char *encodingName)
990 XML_Parser
parser = oldParser;
996 XML_ProcessingInstructionHandler oldProcessingInstructionHandler
999 XML_StartCdataSectionHandler oldStartCdataSectionHandler
1001 XML_EndCdataSectionHandler oldEndCdataSectionHandler
1004 XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler
1007 XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler
1009 XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler
1012 XML_ExternalEntityRefHandler oldExternalEntityRefHandler
1015 XML_UnknownEncodingHandler oldUnknownEncodingHandler
1028 enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;
1052 parser =
parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
1055 parser =
parserCreate(encodingName, &parser->m_mem, NULL, newDtd);
1083 if (oldUserData == oldHandlerArg)
1087 if (oldExternalEntityRefHandlerArg != oldParser)
1094 paramEntityParsing = oldParamEntityParsing;
1098 if (!
dtdCopy(oldParser,
_dtd, oldDtd, &parser->m_mem)
1114 isParamEntity = XML_TRUE;
1116 processor = externalParEntInitProcessor;
1122 static void FASTCALL
1146 if (tagList == NULL) {
1153 tagList = tagList->
parent;
1162 if (entityList == NULL) {
1168 openEntity = entityList;
1169 entityList = entityList->
next;
1181 if (!isParamEntity &&
_dtd)
1187 #ifdef XML_ATTR_INFO
1206 enum XML_Error XMLCALL
1212 return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;
1213 useForeignDTD = useDTD;
1214 return XML_ERROR_NONE;
1216 return XML_ERROR_FEATURE_REQUIRES_XML_DTD;
1238 enum XML_Status XMLCALL
1244 return XML_STATUS_ERROR;
1249 return XML_STATUS_OK;
1252 const XML_Char * XMLCALL
1270 #ifdef XML_ATTR_INFO
1271 const XML_AttrInfo * XMLCALL
1272 XML_GetAttributeInfo(XML_Parser
parser)
1280 XML_StartElementHandler start,
1281 XML_EndElementHandler end)
1289 XML_StartElementHandler start) {
1295 XML_EndElementHandler end) {
1301 XML_CharacterDataHandler handler)
1308 XML_ProcessingInstructionHandler handler)
1315 XML_CommentHandler handler)
1322 XML_StartCdataSectionHandler start,
1323 XML_EndCdataSectionHandler end)
1331 XML_StartCdataSectionHandler start) {
1337 XML_EndCdataSectionHandler end) {
1343 XML_DefaultHandler handler)
1351 XML_DefaultHandler handler)
1359 XML_StartDoctypeDeclHandler start,
1360 XML_EndDoctypeDeclHandler end)
1368 XML_StartDoctypeDeclHandler start) {
1374 XML_EndDoctypeDeclHandler end) {
1380 XML_UnparsedEntityDeclHandler handler)
1387 XML_NotationDeclHandler handler)
1394 XML_StartNamespaceDeclHandler start,
1395 XML_EndNamespaceDeclHandler end)
1403 XML_StartNamespaceDeclHandler start) {
1409 XML_EndNamespaceDeclHandler end) {
1415 XML_NotStandaloneHandler handler)
1422 XML_ExternalEntityRefHandler handler)
1438 XML_SkippedEntityHandler handler)
1445 XML_UnknownEncodingHandler handler,
1454 XML_ElementDeclHandler eldecl)
1461 XML_AttlistDeclHandler attdecl)
1468 XML_EntityDeclHandler handler)
1475 XML_XmlDeclHandler handler) {
1481 enum XML_ParamEntityParsing peParsing)
1487 paramEntityParsing = peParsing;
1490 return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;
1496 unsigned long hash_salt)
1505 enum XML_Status XMLCALL
1511 return XML_STATUS_ERROR;
1514 return XML_STATUS_ERROR;
1515 case XML_INITIALIZED:
1518 return XML_STATUS_ERROR;
1527 return XML_STATUS_OK;
1542 return XML_STATUS_SUSPENDED;
1543 case XML_INITIALIZED:
1548 return XML_STATUS_OK;
1553 return XML_STATUS_ERROR;
1555 #ifndef XML_CONTEXT_BYTES
1559 enum XML_Error result;
1569 return XML_STATUS_ERROR;
1574 result = XML_STATUS_SUSPENDED;
1576 case XML_INITIALIZED:
1580 return XML_STATUS_OK;
1584 result = XML_STATUS_OK;
1589 nLeftOver = s + len - end;
1595 ? (
char *)
MALLOC(len * 2)
1601 return XML_STATUS_ERROR;
1606 memcpy(
buffer, end, nLeftOver);
1620 return XML_STATUS_ERROR;
1622 memcpy(buff, s, len);
1628 enum XML_Status XMLCALL
1632 enum XML_Status result = XML_STATUS_OK;
1637 return XML_STATUS_ERROR;
1640 return XML_STATUS_ERROR;
1641 case XML_INITIALIZED:
1644 return XML_STATUS_ERROR;
1662 return XML_STATUS_ERROR;
1667 result = XML_STATUS_SUSPENDED;
1669 case XML_INITIALIZED:
1700 #ifdef XML_CONTEXT_BYTES
1703 if (keep > XML_CONTEXT_BYTES)
1704 keep = XML_CONTEXT_BYTES;
1708 #ifdef XML_CONTEXT_BYTES
1724 if (bufferSize == 0)
1728 }
while (bufferSize < neededSize);
1729 newBuf = (
char *)
MALLOC(bufferSize);
1735 #ifdef XML_CONTEXT_BYTES
1738 if (keep > XML_CONTEXT_BYTES)
1739 keep = XML_CONTEXT_BYTES;
1765 enum XML_Status XMLCALL
1772 return XML_STATUS_ERROR;
1778 return XML_STATUS_ERROR;
1782 if (isParamEntity) {
1784 return XML_STATUS_ERROR;
1792 return XML_STATUS_OK;
1795 enum XML_Status XMLCALL
1798 enum XML_Status result = XML_STATUS_OK;
1802 return XML_STATUS_ERROR;
1811 return XML_STATUS_ERROR;
1816 result = XML_STATUS_SUSPENDED;
1818 case XML_INITIALIZED:
1836 assert(status != NULL);
1837 *status = parser->m_parsingStatus;
1840 enum XML_Error XMLCALL
1862 const char * XMLCALL
1865 #ifdef XML_CONTEXT_BYTES
1933 const XML_LChar * XMLCALL
1936 static const XML_LChar*
const message[] = {
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")
1979 if (code > 0 && code <
sizeof(message)/
sizeof(message[0]))
1980 return message[code];
1984 const XML_LChar * XMLCALL
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)
1998 return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION);
2004 XML_Expat_Version XMLCALL
2007 XML_Expat_Version version;
2009 version.major = XML_MAJOR_VERSION;
2010 version.minor = XML_MINOR_VERSION;
2011 version.micro = XML_MICRO_VERSION;
2016 const XML_Feature * XMLCALL
2019 static const XML_Feature features[] = {
2020 {XML_FEATURE_SIZEOF_XML_CHAR,
XML_L(
"sizeof(XML_Char)"),
2022 {XML_FEATURE_SIZEOF_XML_LCHAR,
XML_L(
"sizeof(XML_LChar)"),
2025 {XML_FEATURE_UNICODE,
XML_L(
"XML_UNICODE"), 0},
2027 #ifdef XML_UNICODE_WCHAR_T
2028 {XML_FEATURE_UNICODE_WCHAR_T,
XML_L(
"XML_UNICODE_WCHAR_T"), 0},
2031 {XML_FEATURE_DTD,
XML_L(
"XML_DTD"), 0},
2033 #ifdef XML_CONTEXT_BYTES
2034 {XML_FEATURE_CONTEXT_BYTES,
XML_L(
"XML_CONTEXT_BYTES"),
2038 {XML_FEATURE_MIN_SIZE,
XML_L(
"XML_MIN_SIZE"), 0},
2041 {XML_FEATURE_NS,
XML_L(
"XML_NS"), 0},
2043 #ifdef XML_LARGE_SIZE
2044 {XML_FEATURE_LARGE_SIZE,
XML_L(
"XML_LARGE_SIZE"), 0},
2046 #ifdef XML_ATTR_INFO
2047 {XML_FEATURE_ATTR_INFO,
XML_L(
"XML_ATTR_INFO"), 0},
2049 {XML_FEATURE_END, NULL, 0}
2066 int nameLen =
sizeof(XML_Char) * (tag->
name.
strLen + 1);
2067 char *rawNameBuf = tag->
buf + nameLen;
2073 if (tag->
rawName == rawNameBuf)
2080 char *temp = (
char *)
REALLOC(tag->
buf, bufSize);
2087 tag->
name.
str = (XML_Char *)temp;
2093 (XML_Char *)tag->
buf);
2095 tag->
bufEnd = temp + bufSize;
2096 rawNameBuf = temp + nameLen;
2105 static enum XML_Error PTRCALL
2109 const char **endPtr)
2113 if (result == XML_ERROR_NONE) {
2115 return XML_ERROR_NO_MEMORY;
2120 static enum XML_Error PTRCALL
2124 const char **endPtr)
2127 if (result != XML_ERROR_NONE)
2133 static enum XML_Error PTRCALL
2137 const char **endPtr)
2139 const char *next = start;
2140 int tok = XmlContentTok(
encoding, start, end, &next);
2150 return XML_ERROR_NONE;
2154 case XML_TOK_PARTIAL:
2157 return XML_ERROR_NONE;
2160 return XML_ERROR_UNCLOSED_TOKEN;
2161 case XML_TOK_PARTIAL_CHAR:
2164 return XML_ERROR_NONE;
2167 return XML_ERROR_PARTIAL_CHAR;
2173 static enum XML_Error PTRCALL
2177 const char **endPtr)
2180 const char *next = start;
2182 tok = XmlContentTok(
encoding, start, end, &next);
2186 case XML_TOK_XML_DECL:
2188 enum XML_Error result;
2190 if (result != XML_ERROR_NONE)
2195 return XML_ERROR_NONE;
2197 return XML_ERROR_ABORTED;
2203 case XML_TOK_PARTIAL:
2206 return XML_ERROR_NONE;
2208 return XML_ERROR_UNCLOSED_TOKEN;
2209 case XML_TOK_PARTIAL_CHAR:
2212 return XML_ERROR_NONE;
2214 return XML_ERROR_PARTIAL_CHAR;
2221 static enum XML_Error PTRCALL
2225 const char **endPtr)
2229 if (result == XML_ERROR_NONE) {
2231 return XML_ERROR_NO_MEMORY;
2236 static enum XML_Error
2239 const ENCODING *enc,
2242 const char **nextPtr,
2248 const char **eventPP;
2249 const char **eventEndPP;
2261 const char *next =
s;
2262 int tok = XmlContentTok(enc, s, end, &next);
2265 case XML_TOK_TRAILING_CR:
2268 return XML_ERROR_NONE;
2280 if (startTagLevel == 0)
2281 return XML_ERROR_NO_ELEMENTS;
2283 return XML_ERROR_ASYNC_ENTITY;
2285 return XML_ERROR_NONE;
2289 return XML_ERROR_NONE;
2291 if (startTagLevel > 0) {
2293 return XML_ERROR_ASYNC_ENTITY;
2295 return XML_ERROR_NONE;
2297 return XML_ERROR_NO_ELEMENTS;
2298 case XML_TOK_INVALID:
2300 return XML_ERROR_INVALID_TOKEN;
2301 case XML_TOK_PARTIAL:
2304 return XML_ERROR_NONE;
2306 return XML_ERROR_UNCLOSED_TOKEN;
2307 case XML_TOK_PARTIAL_CHAR:
2310 return XML_ERROR_NONE;
2312 return XML_ERROR_PARTIAL_CHAR;
2313 case XML_TOK_ENTITY_REF:
2315 const XML_Char *
name;
2317 XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
2318 s + enc->minBytesPerChar,
2319 next - enc->minBytesPerChar);
2328 s + enc->minBytesPerChar,
2329 next - enc->minBytesPerChar);
2331 return XML_ERROR_NO_MEMORY;
2340 return XML_ERROR_UNDEFINED_ENTITY;
2342 return XML_ERROR_ENTITY_DECLARED_IN_PE;
2352 return XML_ERROR_RECURSIVE_ENTITY_REF;
2354 return XML_ERROR_BINARY_ENTITY_REF;
2356 enum XML_Error result;
2365 if (result != XML_ERROR_NONE)
2369 const XML_Char *context;
2370 entity->
open = XML_TRUE;
2372 entity->
open = XML_FALSE;
2374 return XML_ERROR_NO_MEMORY;
2380 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
2387 case XML_TOK_START_TAG_NO_ATTS:
2389 case XML_TOK_START_TAG_WITH_ATTS:
2392 enum XML_Error result;
2401 return XML_ERROR_NO_MEMORY;
2405 return XML_ERROR_NO_MEMORY;
2414 tag->
rawName = s + enc->minBytesPerChar;
2419 const char *fromPtr = tag->
rawName;
2420 toPtr = (XML_Char *)tag->
buf;
2425 &fromPtr, rawNameEnd,
2427 convLen = (int)(toPtr - (XML_Char *)tag->
buf);
2428 if (fromPtr == rawNameEnd) {
2432 bufSize = (int)(tag->
bufEnd - tag->
buf) << 1;
2434 char *temp = (
char *)
REALLOC(tag->
buf, bufSize);
2436 return XML_ERROR_NO_MEMORY;
2438 tag->
bufEnd = temp + bufSize;
2439 toPtr = (XML_Char *)temp + convLen;
2444 *toPtr =
XML_T(
'\0');
2450 (
const XML_Char **)
atts);
2456 case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
2458 case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
2460 const char *rawName = s + enc->minBytesPerChar;
2461 enum XML_Error result;
2463 XML_Bool noElmHandlers = XML_TRUE;
2466 rawName + XmlNameLength(enc, rawName));
2468 return XML_ERROR_NO_MEMORY;
2470 result =
storeAtts(parser, enc, s, &name, &bindings);
2476 noElmHandlers = XML_FALSE;
2480 *eventPP = *eventEndPP;
2482 noElmHandlers = XML_FALSE;
2500 case XML_TOK_END_TAG:
2502 return XML_ERROR_ASYNC_ENTITY;
2505 const char *rawName;
2510 rawName = s + enc->minBytesPerChar*2;
2511 len = XmlNameLength(enc, rawName);
2513 || memcmp(tag->
rawName, rawName, len) != 0) {
2515 return XML_ERROR_TAG_MISMATCH;
2519 const XML_Char *localPart;
2523 if (
ns && localPart) {
2530 while (*localPart) *uri++ = *localPart++;
2534 while (*prefix) *uri++ = *prefix++;
2555 case XML_TOK_CHAR_REF:
2557 int n = XmlCharRefNumber(enc, s);
2559 return XML_ERROR_BAD_CHAR_REF;
2568 case XML_TOK_XML_DECL:
2569 return XML_ERROR_MISPLACED_XML_PI;
2570 case XML_TOK_DATA_NEWLINE:
2578 case XML_TOK_CDATA_SECT_OPEN:
2580 enum XML_Error result;
2601 result =
doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
2602 if (result != XML_ERROR_NONE)
2610 case XML_TOK_TRAILING_RSQB:
2613 return XML_ERROR_NONE;
2625 (
int)((XML_Char *)end - (XML_Char *)s));
2632 if (startTagLevel == 0) {
2634 return XML_ERROR_NO_ELEMENTS;
2638 return XML_ERROR_ASYNC_ENTITY;
2641 return XML_ERROR_NONE;
2642 case XML_TOK_DATA_CHARS:
2645 if (charDataHandler) {
2661 (
int)((XML_Char *)next - (XML_Char *)s));
2669 return XML_ERROR_NO_MEMORY;
2671 case XML_TOK_COMMENT:
2673 return XML_ERROR_NO_MEMORY;
2680 *eventPP = s = next;
2684 return XML_ERROR_NONE;
2686 return XML_ERROR_ABORTED;
2703 static enum XML_Error
2705 const char *attStr,
TAG_NAME *tagNamePtr,
2711 const XML_Char **appAtts;
2719 const XML_Char *localPart;
2726 return XML_ERROR_NO_MEMORY;
2730 return XML_ERROR_NO_MEMORY;
2732 return XML_ERROR_NO_MEMORY;
2741 #ifdef XML_ATTR_INFO
2742 XML_AttrInfo *temp2;
2747 return XML_ERROR_NO_MEMORY;
2749 #ifdef XML_ATTR_INFO
2752 return XML_ERROR_NO_MEMORY;
2755 if (n > oldAttsSize)
2756 XmlGetAttributes(enc, attStr, n,
atts);
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];
2768 + XmlNameLength(enc, currAtt->name));
2770 return XML_ERROR_NO_MEMORY;
2771 #ifdef XML_ATTR_INFO
2773 currAttInfo->nameEnd = currAttInfo->nameStart +
2774 XmlNameLength(enc, currAtt->name);
2783 if ((attId->
name)[-1]) {
2786 return XML_ERROR_DUPLICATE_ATTRIBUTE;
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;
2797 for (j = 0; j < nDefaultAtts; j++) {
2807 atts[i].valuePtr,
atts[i].valueEnd,
2818 if (appAtts[attIndex] == 0)
2819 return XML_ERROR_NO_MEMORY;
2827 appAtts[attIndex], bindingsPtr);
2836 (attId->
name)[-1] = 2;
2846 for (i = 0; i < attIndex; i += 2)
2847 if (appAtts[i] == elementType->
idAtt->
name) {
2856 for (i = 0; i < nDefaultAtts; i++) {
2862 da->
value, bindingsPtr);
2869 appAtts[attIndex++] = da->
id->
name;
2870 appAtts[attIndex++] = da->
value;
2875 appAtts[attIndex++] = da->
id->
name;
2876 appAtts[attIndex++] = da->
value;
2880 appAtts[attIndex] = 0;
2899 return XML_ERROR_NO_MEMORY;
2906 for (j = nsAttsSize; j != 0; )
2907 nsAtts[--j].version = version;
2912 for (; i < attIndex; i += 2) {
2913 const XML_Char *
s = appAtts[i];
2918 ((XML_Char *)s)[-1] = 0;
2922 return XML_ERROR_UNBOUND_PREFIX;
2925 for (j = 0; j < b->
uriLen; j++) {
2926 const XML_Char c = b->
uri[j];
2928 return XML_ERROR_NO_MEMORY;
2931 while (*s++ !=
XML_T(ASCII_COLON))
2934 const XML_Char c = *
s;
2936 return XML_ERROR_NO_MEMORY;
2943 unsigned char step = 0;
2944 unsigned long mask = nsAttsSize - 1;
2946 while (
nsAtts[j].version == version) {
2950 const XML_Char *s2 =
nsAtts[j].uriName;
2952 for (; *s1 == *s2 && *s1 != 0; s1++, s2++);
2954 return XML_ERROR_DUPLICATE_ATTRIBUTE;
2958 j < step ? (j += nsAttsSize - step) : (j -= step);
2967 return XML_ERROR_NO_MEMORY;
2977 nsAtts[j].version = version;
2978 nsAtts[j].hash = uriHash;
2987 ((XML_Char *)s)[-1] = 0;
2991 for (; i < attIndex; i += 2)
2992 ((XML_Char *)(appAtts[i]))[-1] = 0;
2993 for (binding = *bindingsPtr; binding; binding = binding->
nextTagBinding)
2997 return XML_ERROR_NONE;
3000 if (elementType->
prefix) {
3003 return XML_ERROR_UNBOUND_PREFIX;
3004 localPart = tagNamePtr->
str;
3005 while (*localPart++ !=
XML_T(ASCII_COLON))
3010 localPart = tagNamePtr->
str;
3013 return XML_ERROR_NONE;
3023 for (i = 0; localPart[i++];)
3025 n = i + binding->
uriLen + prefixLen;
3030 return XML_ERROR_NO_MEMORY;
3032 memcpy(uri, binding->
uri, binding->
uriLen *
sizeof(XML_Char));
3041 memcpy(uri, localPart, i *
sizeof(XML_Char));
3046 memcpy(uri + 1, binding->
prefix->
name, prefixLen *
sizeof(XML_Char));
3048 tagNamePtr->
str = binding->
uri;
3049 return XML_ERROR_NONE;
3055 static enum XML_Error
3057 const XML_Char *uri,
BINDING **bindingsPtr)
3059 static const XML_Char xmlNamespace[] = {
3060 ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
3061 ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
3062 ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L,
3063 ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH,
3064 ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c,
3067 static const int xmlLen =
3068 (int)
sizeof(xmlNamespace)/
sizeof(XML_Char) - 1;
3069 static const XML_Char xmlnsNamespace[] = {
3070 ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
3071 ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
3072 ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0,
3073 ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s,
3076 static const int xmlnsLen =
3077 (int)
sizeof(xmlnsNamespace)/
sizeof(XML_Char) - 1;
3079 XML_Bool mustBeXML = XML_FALSE;
3080 XML_Bool isXML = XML_TRUE;
3081 XML_Bool isXMLNS = XML_TRUE;
3087 if (*uri ==
XML_T(
'\0') && prefix->
name)
3088 return XML_ERROR_UNDECLARING_PREFIX;
3099 return XML_ERROR_RESERVED_PREFIX_XMLNS;
3102 mustBeXML = XML_TRUE;
3105 for (len = 0; uri[len]; len++) {
3106 if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len]))
3109 if (!mustBeXML && isXMLNS
3110 && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
3111 isXMLNS = XML_FALSE;
3113 isXML = isXML && len == xmlLen;
3114 isXMLNS = isXMLNS && len == xmlnsLen;
3116 if (mustBeXML != isXML)
3117 return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML
3118 : XML_ERROR_RESERVED_NAMESPACE_URI;
3121 return XML_ERROR_RESERVED_NAMESPACE_URI;
3131 return XML_ERROR_NO_MEMORY;
3140 return XML_ERROR_NO_MEMORY;
3144 return XML_ERROR_NO_MEMORY;
3149 memcpy(b->
uri, uri, len *
sizeof(XML_Char));
3156 if (*uri ==
XML_T(
'\0') && prefix == &
_dtd->defaultPrefix)
3166 return XML_ERROR_NONE;
3172 static enum XML_Error PTRCALL
3176 const char **endPtr)
3180 if (result != XML_ERROR_NONE)
3198 static enum XML_Error
3200 const ENCODING *enc,
3201 const char **startPtr,
3203 const char **nextPtr,
3206 const char *
s = *startPtr;
3207 const char **eventPP;
3208 const char **eventEndPP;
3223 int tok = XmlCdataSectionTok(enc, s, end, &next);
3226 case XML_TOK_CDATA_SECT_CLOSE:
3239 return XML_ERROR_ABORTED;
3241 return XML_ERROR_NONE;
3242 case XML_TOK_DATA_NEWLINE:
3250 case XML_TOK_DATA_CHARS:
3253 if (charDataHandler) {
3269 (
int)((XML_Char *)next - (XML_Char *)s));
3275 case XML_TOK_INVALID:
3277 return XML_ERROR_INVALID_TOKEN;
3278 case XML_TOK_PARTIAL_CHAR:
3281 return XML_ERROR_NONE;
3283 return XML_ERROR_PARTIAL_CHAR;
3284 case XML_TOK_PARTIAL:
3288 return XML_ERROR_NONE;
3290 return XML_ERROR_UNCLOSED_CDATA_SECTION;
3293 return XML_ERROR_UNEXPECTED_STATE;
3296 *eventPP = s = next;
3300 return XML_ERROR_NONE;
3302 return XML_ERROR_ABORTED;
3314 static enum XML_Error PTRCALL
3315 ignoreSectionProcessor(XML_Parser
parser,
3318 const char **endPtr)
3320 enum XML_Error result = doIgnoreSection(parser,
encoding, &start, end,
3322 if (result != XML_ERROR_NONE)
3334 static enum XML_Error
3335 doIgnoreSection(XML_Parser parser,
3336 const ENCODING *enc,
3337 const char **startPtr,
3339 const char **nextPtr,
3344 const char *
s = *startPtr;
3345 const char **eventPP;
3346 const char **eventEndPP;
3358 tok = XmlIgnoreSectionTok(enc, s, end, &next);
3361 case XML_TOK_IGNORE_SECT:
3367 return XML_ERROR_ABORTED;
3369 return XML_ERROR_NONE;
3370 case XML_TOK_INVALID:
3372 return XML_ERROR_INVALID_TOKEN;
3373 case XML_TOK_PARTIAL_CHAR:
3376 return XML_ERROR_NONE;
3378 return XML_ERROR_PARTIAL_CHAR;
3379 case XML_TOK_PARTIAL:
3383 return XML_ERROR_NONE;
3385 return XML_ERROR_SYNTAX;
3388 return XML_ERROR_UNEXPECTED_STATE;
3395 static enum XML_Error
3400 char encodingBuf[128];
3406 if (i ==
sizeof(encodingBuf) - 1
3408 encodingBuf[0] =
'\0';
3413 encodingBuf[i] =
'\0';
3420 return XML_ERROR_NONE;
3424 static enum XML_Error
3426 const char *s,
const char *next)
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;
3437 : XmlParseXmlDecl)(isGeneralTextEntity,
3447 if (isGeneralTextEntity)
3448 return XML_ERROR_TEXT_DECL;
3450 return XML_ERROR_XML_DECL;
3452 if (!isGeneralTextEntity && standalone == 1) {
3453 _dtd->standalone = XML_TRUE;
3455 if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
3456 paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
3460 if (encodingName != NULL) {
3465 + XmlNameLength(
encoding, encodingName));
3467 return XML_ERROR_NO_MEMORY;
3474 versionend -
encoding->minBytesPerChar);
3476 return XML_ERROR_NO_MEMORY;
3484 if (newEncoding->minBytesPerChar !=
encoding->minBytesPerChar) {
3486 return XML_ERROR_INCORRECT_ENCODING;
3490 else if (encodingName) {
3491 enum XML_Error result;
3492 if (!storedEncName) {
3495 encodingName + XmlNameLength(
encoding, encodingName));
3497 return XML_ERROR_NO_MEMORY;
3501 if (result == XML_ERROR_UNKNOWN_ENCODING)
3507 if (storedEncName || storedversion)
3510 return XML_ERROR_NONE;
3513 static enum XML_Error
3519 for (i = 0; i < 256; i++)
3521 info.convert = NULL;
3523 info.release = NULL;
3530 info.release(info.data);
3531 return XML_ERROR_NO_MEMORY;
3543 return XML_ERROR_NONE;
3546 if (info.release != NULL)
3547 info.release(info.data);
3549 return XML_ERROR_UNKNOWN_ENCODING;
3552 static enum XML_Error PTRCALL
3556 const char **nextPtr)
3559 if (result != XML_ERROR_NONE)
3567 static enum XML_Error PTRCALL
3568 externalParEntInitProcessor(XML_Parser parser,
3571 const char **nextPtr)
3574 if (result != XML_ERROR_NONE)
3579 _dtd->paramEntityRead = XML_TRUE;
3583 return entityValueInitProcessor(parser, s, end, nextPtr);
3587 return externalParEntProcessor(parser, s, end, nextPtr);
3591 static enum XML_Error PTRCALL
3592 entityValueInitProcessor(XML_Parser parser,
3595 const char **nextPtr)
3598 const char *start =
s;
3599 const char *next = start;
3603 tok = XmlPrologTok(
encoding, start, end, &next);
3608 return XML_ERROR_NONE;
3611 case XML_TOK_INVALID:
3612 return XML_ERROR_INVALID_TOKEN;
3613 case XML_TOK_PARTIAL:
3614 return XML_ERROR_UNCLOSED_TOKEN;
3615 case XML_TOK_PARTIAL_CHAR:
3616 return XML_ERROR_PARTIAL_CHAR;
3624 else if (tok == XML_TOK_XML_DECL) {
3625 enum XML_Error result;
3627 if (result != XML_ERROR_NONE)
3632 return XML_ERROR_NONE;
3634 return XML_ERROR_ABORTED;
3640 return entityValueProcessor(parser, next, end, nextPtr);
3651 return XML_ERROR_NONE;
3658 static enum XML_Error PTRCALL
3659 externalParEntProcessor(XML_Parser parser,
3662 const char **nextPtr)
3664 const char *next =
s;
3667 tok = XmlPrologTok(
encoding, s, end, &next);
3671 return XML_ERROR_NONE;
3674 case XML_TOK_INVALID:
3675 return XML_ERROR_INVALID_TOKEN;
3676 case XML_TOK_PARTIAL:
3677 return XML_ERROR_UNCLOSED_TOKEN;
3678 case XML_TOK_PARTIAL_CHAR:
3679 return XML_ERROR_PARTIAL_CHAR;
3689 else if (tok == XML_TOK_BOM) {
3691 tok = XmlPrologTok(
encoding, s, end, &next);
3699 static enum XML_Error PTRCALL
3700 entityValueProcessor(XML_Parser parser,
3703 const char **nextPtr)
3705 const char *start =
s;
3706 const char *next =
s;
3711 tok = XmlPrologTok(enc, start, end, &next);
3715 return XML_ERROR_NONE;
3718 case XML_TOK_INVALID:
3719 return XML_ERROR_INVALID_TOKEN;
3720 case XML_TOK_PARTIAL:
3721 return XML_ERROR_UNCLOSED_TOKEN;
3722 case XML_TOK_PARTIAL_CHAR:
3723 return XML_ERROR_PARTIAL_CHAR;
3737 static enum XML_Error PTRCALL
3741 const char **nextPtr)
3743 const char *next =
s;
3744 int tok = XmlPrologTok(
encoding, s, end, &next);
3749 static enum XML_Error
3751 const ENCODING *enc,
3756 const char **nextPtr,
3760 static const XML_Char externalSubsetName[] = { ASCII_HASH ,
'\0' };
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[] =
3768 { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S,
'\0' };
3769 static const XML_Char atypeENTITY[] =
3770 { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y,
'\0' };
3771 static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N,
3772 ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S,
'\0' };
3773 static const XML_Char atypeNMTOKEN[] = {
3774 ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N,
'\0' };
3775 static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T,
3776 ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S,
'\0' };
3777 static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T,
3778 ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN,
'\0' };
3779 static const XML_Char enumValueSep[] = { ASCII_PIPE,
'\0' };
3780 static const XML_Char enumValueStart[] = { ASCII_LPAREN,
'\0' };
3785 const char **eventPP;
3786 const char **eventEndPP;
3787 enum XML_Content_Quant quant;
3800 XML_Bool handleDefault = XML_TRUE;
3804 if (haveMore && tok != XML_TOK_INVALID) {
3806 return XML_ERROR_NONE;
3809 case XML_TOK_INVALID:
3811 return XML_ERROR_INVALID_TOKEN;
3812 case XML_TOK_PARTIAL:
3813 return XML_ERROR_UNCLOSED_TOKEN;
3814 case XML_TOK_PARTIAL_CHAR:
3815 return XML_ERROR_PARTIAL_CHAR;
3816 case -XML_TOK_PROLOG_S:
3824 return XML_ERROR_NONE;
3830 if (isParamEntity || enc !=
encoding) {
3831 if (XmlTokenRole(&
prologState, XML_TOK_NONE, end, end, enc)
3833 return XML_ERROR_INCOMPLETE_PE;
3835 return XML_ERROR_NONE;
3838 return XML_ERROR_NO_ELEMENTS;
3845 role = XmlTokenRole(&
prologState, tok, s, next, enc);
3847 case XML_ROLE_XML_DECL:
3850 if (result != XML_ERROR_NONE)
3853 handleDefault = XML_FALSE;
3856 case XML_ROLE_DOCTYPE_NAME:
3860 return XML_ERROR_NO_MEMORY;
3863 handleDefault = XML_FALSE;
3867 case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:
3873 handleDefault = XML_FALSE;
3877 case XML_ROLE_TEXT_DECL:
3880 if (result != XML_ERROR_NONE)
3883 handleDefault = XML_FALSE;
3887 case XML_ROLE_DOCTYPE_PUBLIC_ID:
3889 useForeignDTD = XML_FALSE;
3891 &dtd->paramEntities,
3895 return XML_ERROR_NO_MEMORY;
3900 if (!XmlIsPublicId(enc, s, next, eventPP))
3901 return XML_ERROR_PUBLICID;
3903 s + enc->minBytesPerChar,
3904 next - enc->minBytesPerChar);
3906 return XML_ERROR_NO_MEMORY;
3910 handleDefault = XML_FALSE;
3911 goto alreadyChecked;
3914 case XML_ROLE_ENTITY_PUBLIC_ID:
3915 if (!XmlIsPublicId(enc, s, next, eventPP))
3916 return XML_ERROR_PUBLICID;
3921 s + enc->minBytesPerChar,
3922 next - enc->minBytesPerChar);
3924 return XML_ERROR_NO_MEMORY;
3929 handleDefault = XML_FALSE;
3932 case XML_ROLE_DOCTYPE_CLOSE:
3937 handleDefault = XML_FALSE;
3949 &dtd->paramEntities,
3953 return XML_ERROR_NO_MEMORY;
3956 dtd->paramEntityRead = XML_FALSE;
3962 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
3963 if (dtd->paramEntityRead) {
3967 return XML_ERROR_NOT_STANDALONE;
3976 useForeignDTD = XML_FALSE;
3981 handleDefault = XML_FALSE;
3984 case XML_ROLE_INSTANCE_START:
3989 if (useForeignDTD) {
3997 return XML_ERROR_NO_MEMORY;
3999 dtd->paramEntityRead = XML_FALSE;
4005 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
4006 if (dtd->paramEntityRead) {
4010 return XML_ERROR_NOT_STANDALONE;
4023 case XML_ROLE_ATTLIST_ELEMENT_NAME:
4026 return XML_ERROR_NO_MEMORY;
4027 goto checkAttListDeclHandler;
4028 case XML_ROLE_ATTRIBUTE_NAME:
4031 return XML_ERROR_NO_MEMORY;
4035 goto checkAttListDeclHandler;
4036 case XML_ROLE_ATTRIBUTE_TYPE_CDATA:
4039 goto checkAttListDeclHandler;
4040 case XML_ROLE_ATTRIBUTE_TYPE_ID:
4043 goto checkAttListDeclHandler;
4044 case XML_ROLE_ATTRIBUTE_TYPE_IDREF:
4046 goto checkAttListDeclHandler;
4047 case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:
4049 goto checkAttListDeclHandler;
4050 case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:
4052 goto checkAttListDeclHandler;
4053 case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:
4055 goto checkAttListDeclHandler;
4056 case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:
4058 goto checkAttListDeclHandler;
4059 case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:
4061 checkAttListDeclHandler:
4063 handleDefault = XML_FALSE;
4065 case XML_ROLE_ATTRIBUTE_ENUM_VALUE:
4066 case XML_ROLE_ATTRIBUTE_NOTATION_VALUE:
4070 prefix = enumValueSep;
4073 prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE
4078 return XML_ERROR_NO_MEMORY;
4080 return XML_ERROR_NO_MEMORY;
4082 handleDefault = XML_FALSE;
4085 case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
4086 case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
4091 return XML_ERROR_NO_MEMORY;
4099 return XML_ERROR_NO_MEMORY;
4106 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);
4108 handleDefault = XML_FALSE;
4112 case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
4113 case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
4115 const XML_Char *attVal;
4116 enum XML_Error result =
4118 s + enc->minBytesPerChar,
4119 next - enc->minBytesPerChar,
4128 return XML_ERROR_NO_MEMORY;
4136 return XML_ERROR_NO_MEMORY;
4144 role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);
4146 handleDefault = XML_FALSE;
4150 case XML_ROLE_ENTITY_VALUE:
4153 s + enc->minBytesPerChar,
4154 next - enc->minBytesPerChar);
4167 handleDefault = XML_FALSE;
4172 if (result != XML_ERROR_NONE)
4176 case XML_ROLE_DOCTYPE_SYSTEM_ID:
4178 useForeignDTD = XML_FALSE;
4183 s + enc->minBytesPerChar,
4184 next - enc->minBytesPerChar);
4186 return XML_ERROR_NO_MEMORY;
4188 handleDefault = XML_FALSE;
4198 && !paramEntityParsing
4202 return XML_ERROR_NOT_STANDALONE;
4208 &dtd->paramEntities,
4212 return XML_ERROR_NO_MEMORY;
4217 case XML_ROLE_ENTITY_SYSTEM_ID:
4220 s + enc->minBytesPerChar,
4221 next - enc->minBytesPerChar);
4223 return XML_ERROR_NO_MEMORY;
4227 handleDefault = XML_FALSE;
4230 case XML_ROLE_ENTITY_COMPLETE:
4241 handleDefault = XML_FALSE;
4244 case XML_ROLE_ENTITY_NOTATION_NAME:
4248 return XML_ERROR_NO_MEMORY;
4258 handleDefault = XML_FALSE;
4269 handleDefault = XML_FALSE;
4273 case XML_ROLE_GENERAL_ENTITY_NAME:
4275 if (XmlPredefinedEntityName(enc, s, next)) {
4282 return XML_ERROR_NO_MEMORY;
4286 return XML_ERROR_NO_MEMORY;
4300 handleDefault = XML_FALSE;
4309 case XML_ROLE_PARAM_ENTITY_NAME:
4314 return XML_ERROR_NO_MEMORY;
4318 return XML_ERROR_NO_MEMORY;
4332 handleDefault = XML_FALSE;
4343 case XML_ROLE_NOTATION_NAME:
4349 return XML_ERROR_NO_MEMORY;
4351 handleDefault = XML_FALSE;
4354 case XML_ROLE_NOTATION_PUBLIC_ID:
4355 if (!XmlIsPublicId(enc, s, next, eventPP))
4356 return XML_ERROR_PUBLICID;
4360 s + enc->minBytesPerChar,
4361 next - enc->minBytesPerChar);
4363 return XML_ERROR_NO_MEMORY;
4367 handleDefault = XML_FALSE;
4370 case XML_ROLE_NOTATION_SYSTEM_ID:
4372 const XML_Char *systemId
4374 s + enc->minBytesPerChar,
4375 next - enc->minBytesPerChar);
4377 return XML_ERROR_NO_MEMORY;
4384 handleDefault = XML_FALSE;
4388 case XML_ROLE_NOTATION_NO_SYSTEM_ID:
4396 handleDefault = XML_FALSE;
4400 case XML_ROLE_ERROR:
4402 case XML_TOK_PARAM_ENTITY_REF:
4405 return XML_ERROR_PARAM_ENTITY_REF;
4406 case XML_TOK_XML_DECL:
4407 return XML_ERROR_MISPLACED_XML_PI;
4409 return XML_ERROR_SYNTAX;
4412 case XML_ROLE_IGNORE_SECT:
4414 enum XML_Error result;
4417 handleDefault = XML_FALSE;
4418 result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore);
4419 if (result != XML_ERROR_NONE)
4428 case XML_ROLE_GROUP_OPEN:
4433 return XML_ERROR_NO_MEMORY;
4439 return XML_ERROR_NO_MEMORY;
4446 return XML_ERROR_NO_MEMORY;
4453 return XML_ERROR_NO_MEMORY;
4458 handleDefault = XML_FALSE;
4461 case XML_ROLE_GROUP_SEQUENCE:
4463 return XML_ERROR_SYNTAX;
4466 handleDefault = XML_FALSE;
4468 case XML_ROLE_GROUP_CHOICE:
4470 return XML_ERROR_SYNTAX;
4479 handleDefault = XML_FALSE;
4483 case XML_ROLE_PARAM_ENTITY_REF:
4485 case XML_ROLE_INNER_PARAM_ENTITY_REF:
4487 if (!paramEntityParsing)
4490 const XML_Char *
name;
4493 s + enc->minBytesPerChar,
4494 next - enc->minBytesPerChar);
4496 return XML_ERROR_NO_MEMORY;
4497 entity = (
ENTITY *)
lookup(parser, &dtd->paramEntities, name, 0);
4508 return XML_ERROR_UNDEFINED_ENTITY;
4510 return XML_ERROR_ENTITY_DECLARED_IN_PE;
4517 handleDefault = XML_FALSE;
4522 return XML_ERROR_RECURSIVE_ENTITY_REF;
4524 enum XML_Error result;
4525 XML_Bool betweenDecl =
4526 (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE);
4528 if (result != XML_ERROR_NONE)
4530 handleDefault = XML_FALSE;
4534 dtd->paramEntityRead = XML_FALSE;
4535 entity->
open = XML_TRUE;
4541 entity->
open = XML_FALSE;
4542 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
4544 entity->
open = XML_FALSE;
4545 handleDefault = XML_FALSE;
4546 if (!dtd->paramEntityRead) {
4560 return XML_ERROR_NOT_STANDALONE;
4565 case XML_ROLE_ELEMENT_NAME:
4569 return XML_ERROR_NO_MEMORY;
4573 handleDefault = XML_FALSE;
4577 case XML_ROLE_CONTENT_ANY:
4578 case XML_ROLE_CONTENT_EMPTY:
4581 XML_Content * content = (XML_Content *)
MALLOC(
sizeof(XML_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) ?
4593 handleDefault = XML_FALSE;
4599 case XML_ROLE_CONTENT_PCDATA:
4604 handleDefault = XML_FALSE;
4608 case XML_ROLE_CONTENT_ELEMENT:
4609 quant = XML_CQUANT_NONE;
4610 goto elementContent;
4611 case XML_ROLE_CONTENT_ELEMENT_OPT:
4612 quant = XML_CQUANT_OPT;
4613 goto elementContent;
4614 case XML_ROLE_CONTENT_ELEMENT_REP:
4615 quant = XML_CQUANT_REP;
4616 goto elementContent;
4617 case XML_ROLE_CONTENT_ELEMENT_PLUS:
4618 quant = XML_CQUANT_PLUS;
4622 const XML_Char *
name;
4624 const char *nxt = (quant == XML_CQUANT_NONE
4626 : next - enc->minBytesPerChar);
4629 return XML_ERROR_NO_MEMORY;
4634 return XML_ERROR_NO_MEMORY;
4638 for (; name[nameLen++]; );
4641 handleDefault = XML_FALSE;
4645 case XML_ROLE_GROUP_CLOSE:
4646 quant = XML_CQUANT_NONE;
4648 case XML_ROLE_GROUP_CLOSE_OPT:
4649 quant = XML_CQUANT_OPT;
4651 case XML_ROLE_GROUP_CLOSE_REP:
4652 quant = XML_CQUANT_REP;
4654 case XML_ROLE_GROUP_CLOSE_PLUS:
4655 quant = XML_CQUANT_PLUS;
4659 handleDefault = XML_FALSE;
4663 if (!handleDefault) {
4666 return XML_ERROR_NO_MEMORY;
4679 return XML_ERROR_NO_MEMORY;
4680 handleDefault = XML_FALSE;
4682 case XML_ROLE_COMMENT:
4684 return XML_ERROR_NO_MEMORY;
4685 handleDefault = XML_FALSE;
4690 handleDefault = XML_FALSE;
4694 case XML_ROLE_DOCTYPE_NONE:
4696 handleDefault = XML_FALSE;
4698 case XML_ROLE_ENTITY_NONE:
4700 handleDefault = XML_FALSE;
4702 case XML_ROLE_NOTATION_NONE:
4704 handleDefault = XML_FALSE;
4706 case XML_ROLE_ATTLIST_NONE:
4708 handleDefault = XML_FALSE;
4710 case XML_ROLE_ELEMENT_NONE:
4712 handleDefault = XML_FALSE;
4722 return XML_ERROR_NONE;
4724 return XML_ERROR_ABORTED;
4727 tok = XmlPrologTok(enc, s, end, &next);
4733 static enum XML_Error PTRCALL
4737 const char **nextPtr)
4742 const char *next = NULL;
4743 int tok = XmlPrologTok(
encoding, s, end, &next);
4747 case -XML_TOK_PROLOG_S:
4751 return XML_ERROR_ABORTED;
4754 return XML_ERROR_NONE;
4757 return XML_ERROR_NONE;
4758 case XML_TOK_PROLOG_S:
4764 return XML_ERROR_NO_MEMORY;
4766 case XML_TOK_COMMENT:
4768 return XML_ERROR_NO_MEMORY;
4770 case XML_TOK_INVALID:
4772 return XML_ERROR_INVALID_TOKEN;
4773 case XML_TOK_PARTIAL:
4776 return XML_ERROR_NONE;
4778 return XML_ERROR_UNCLOSED_TOKEN;
4779 case XML_TOK_PARTIAL_CHAR:
4782 return XML_ERROR_NONE;
4784 return XML_ERROR_PARTIAL_CHAR;
4786 return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
4792 return XML_ERROR_NONE;
4794 return XML_ERROR_ABORTED;
4800 static enum XML_Error
4802 XML_Bool betweenDecl)
4804 const char *textStart, *textEnd;
4806 enum XML_Error result;
4816 return XML_ERROR_NO_MEMORY;
4818 entity->
open = XML_TRUE;
4822 openEntity->
entity = entity;
4827 textStart = (
char *)entity->
textPtr;
4834 next, &next, XML_FALSE);
4839 textEnd, &next, XML_FALSE);
4841 if (result == XML_ERROR_NONE) {
4842 if (textEnd != next &&
ps_parsing == XML_SUSPENDED) {
4843 entity->
processed = (int)(next - textStart);
4847 entity->
open = XML_FALSE;
4857 static enum XML_Error PTRCALL
4861 const char **nextPtr)
4864 const char *textStart, *textEnd;
4866 enum XML_Error result;
4869 return XML_ERROR_UNEXPECTED_STATE;
4871 entity = openEntity->
entity;
4879 next, &next, XML_FALSE);
4884 textStart, textEnd, &next, XML_FALSE);
4886 if (result != XML_ERROR_NONE)
4888 else if (textEnd != next &&
ps_parsing == XML_SUSPENDED) {
4893 entity->
open = XML_FALSE;
4904 tok = XmlPrologTok(
encoding, s, end, &next);
4918 static enum XML_Error PTRCALL
4922 const char **nextPtr)
4927 static enum XML_Error
4929 const char *ptr,
const char *end,
4939 return XML_ERROR_NO_MEMORY;
4940 return XML_ERROR_NONE;
4943 static enum XML_Error
4945 const char *ptr,
const char *end,
4951 int tok = XmlAttributeValueTok(enc, ptr, end, &next);
4954 return XML_ERROR_NONE;
4955 case XML_TOK_INVALID:
4958 return XML_ERROR_INVALID_TOKEN;
4959 case XML_TOK_PARTIAL:
4962 return XML_ERROR_INVALID_TOKEN;
4963 case XML_TOK_CHAR_REF:
4967 int n = XmlCharRefNumber(enc, ptr);
4971 return XML_ERROR_BAD_CHAR_REF;
4981 return XML_ERROR_BAD_CHAR_REF;
4983 for (i = 0; i <
n; i++) {
4985 return XML_ERROR_NO_MEMORY;
4989 case XML_TOK_DATA_CHARS:
4991 return XML_ERROR_NO_MEMORY;
4993 case XML_TOK_TRAILING_CR:
4994 next = ptr + enc->minBytesPerChar;
4996 case XML_TOK_ATTRIBUTE_VALUE_S:
4997 case XML_TOK_DATA_NEWLINE:
5001 return XML_ERROR_NO_MEMORY;
5003 case XML_TOK_ENTITY_REF:
5005 const XML_Char *
name;
5007 char checkEntityDecl;
5008 XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
5009 ptr + enc->minBytesPerChar,
5010 next - enc->minBytesPerChar);
5013 return XML_ERROR_NO_MEMORY;
5017 ptr + enc->minBytesPerChar,
5018 next - enc->minBytesPerChar);
5020 return XML_ERROR_NO_MEMORY;
5026 if (pool == &dtd->
pool)
5036 if (checkEntityDecl) {
5038 return XML_ERROR_UNDEFINED_ENTITY;
5040 return XML_ERROR_ENTITY_DECLARED_IN_PE;
5058 return XML_ERROR_RECURSIVE_ENTITY_REF;
5063 return XML_ERROR_BINARY_ENTITY_REF;
5068 return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
5071 enum XML_Error result;
5073 entity->
open = XML_TRUE;
5076 (
char *)textEnd, pool);
5077 entity->
open = XML_FALSE;
5086 return XML_ERROR_UNEXPECTED_STATE;
5093 static enum XML_Error
5095 const ENCODING *enc,
5096 const char *entityTextPtr,
5097 const char *entityTextEnd)
5101 enum XML_Error result = XML_ERROR_NONE;
5111 return XML_ERROR_NO_MEMORY;
5116 int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
5118 case XML_TOK_PARAM_ENTITY_REF:
5120 if (isParamEntity || enc !=
encoding) {
5121 const XML_Char *
name;
5124 entityTextPtr + enc->minBytesPerChar,
5125 next - enc->minBytesPerChar);
5127 result = XML_ERROR_NO_MEMORY;
5128 goto endEntityValue;
5130 entity = (
ENTITY *)
lookup(parser, &dtd->paramEntities, name, 0);
5140 goto endEntityValue;
5145 result = XML_ERROR_RECURSIVE_ENTITY_REF;
5146 goto endEntityValue;
5150 dtd->paramEntityRead = XML_FALSE;
5151 entity->
open = XML_TRUE;
5157 entity->
open = XML_FALSE;
5158 result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
5159 goto endEntityValue;
5161 entity->
open = XML_FALSE;
5162 if (!dtd->paramEntityRead)
5169 entity->
open = XML_TRUE;
5175 entity->
open = XML_FALSE;
5177 goto endEntityValue;
5185 result = XML_ERROR_PARAM_ENTITY_REF;
5186 goto endEntityValue;
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;
5197 case XML_TOK_TRAILING_CR:
5198 next = entityTextPtr + enc->minBytesPerChar;
5200 case XML_TOK_DATA_NEWLINE:
5202 result = XML_ERROR_NO_MEMORY;
5203 goto endEntityValue;
5205 *(pool->
ptr)++ = 0xA;
5207 case XML_TOK_CHAR_REF:
5211 int n = XmlCharRefNumber(enc, entityTextPtr);
5215 result = XML_ERROR_BAD_CHAR_REF;
5216 goto endEntityValue;
5222 result = XML_ERROR_BAD_CHAR_REF;
5223 goto endEntityValue;
5225 for (i = 0; i <
n; i++) {
5227 result = XML_ERROR_NO_MEMORY;
5228 goto endEntityValue;
5230 *(pool->
ptr)++ = buf[i];
5234 case XML_TOK_PARTIAL:
5237 result = XML_ERROR_INVALID_TOKEN;
5238 goto endEntityValue;
5239 case XML_TOK_INVALID:
5242 result = XML_ERROR_INVALID_TOKEN;
5243 goto endEntityValue;
5247 result = XML_ERROR_UNEXPECTED_STATE;
5248 goto endEntityValue;
5250 entityTextPtr = next;
5259 static void FASTCALL
5264 if (*s ==
XML_T(
'\0'))
5284 const char *start,
const char *end)
5286 const XML_Char *target;
5294 start += enc->minBytesPerChar * 2;
5295 tem = start + XmlNameLength(enc, start);
5302 end - enc->minBytesPerChar*2);
5313 const char *start,
const char *end)
5323 start + enc->minBytesPerChar * 4,
5324 end - enc->minBytesPerChar * 3);
5335 const char *s,
const char *end)
5338 const char **eventPP;
5339 const char **eventEndPP;
5363 XML_Bool isId,
const XML_Char *value, XML_Parser parser)
5366 if (value || isId) {
5374 type->
idAtt = attId;
5409 const XML_Char *
name;
5410 for (name = elementType->
name; *name; name++) {
5411 if (*name ==
XML_T(ASCII_COLON)) {
5414 for (s = elementType->
name; s != name; s++) {
5428 elementType->
prefix = prefix;
5437 const char *start,
const char *end)
5441 const XML_Char *
name;
5452 if (id->
name != name)
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'))
5468 id->xmlns = XML_TRUE;
5472 for (i = 0; name[i]; i++) {
5474 if (name[i] ==
XML_T(ASCII_COLON)) {
5476 for (j = 0; j < i; j++) {
5496 #define CONTEXT_SEP XML_T(ASCII_FF)
5498 static const XML_Char *
5503 XML_Bool needSep = XML_FALSE;
5513 for (i = 0; i < len; i++)
5531 for (s = prefix->
name; *s; s++)
5539 for (i = 0; i < len; i++)
5556 for (s = e->
name; *s; s++)
5571 const XML_Char *s = context;
5573 while (*context !=
XML_T(
'\0')) {
5581 if (*s !=
XML_T(
'\0'))
5586 else if (*s ==
XML_T(ASCII_EQUALS)) {
5604 for (context = s + 1;
5615 if (*context !=
XML_T(
'\0'))
5628 static void FASTCALL
5631 XML_Char *p = publicId;
5633 for (s = publicId; *
s; s++) {
5638 if (p != publicId && p[-1] != 0x20)
5645 if (p != publicId && p[-1] == 0x20)
5653 DTD *p = (
DTD *)ms->malloc_fcn(
sizeof(
DTD));
5663 p->paramEntityRead = XML_FALSE;
5697 p->paramEntityRead = XML_FALSE;
5757 dtdCopy(XML_Parser oldParser,
DTD *newDtd,
const DTD *oldDtd,
const XML_Memory_Handling_Suite *
ms)
5765 const XML_Char *
name;
5782 const XML_Char *
name;
5816 const XML_Char *
name;
5866 &(newDtd->paramEntities),
5868 &(oldDtd->paramEntities)))
5870 newDtd->paramEntityRead = oldDtd->paramEntityRead;
5895 const XML_Char *cachedOldBase = NULL;
5896 const XML_Char *cachedNewBase = NULL;
5902 const XML_Char *
name;
5918 if (oldE->
base == cachedOldBase)
5919 newE->
base = cachedNewBase;
5921 cachedOldBase = oldE->
base;
5925 cachedNewBase = newE->
base = tem;
5955 #define INIT_POWER 6
5957 static XML_Bool FASTCALL
5960 for (; *s1 == *s2; s1++, s2++)
5966 static unsigned long FASTCALL
5979 if (table->
size == 0) {
5987 table->
v = (
NAMED **)table->
mem->malloc_fcn(tsize);
5992 memset(table->
v, 0, tsize);
5993 i =
hash(parser, name) & ((
unsigned long)table->
size - 1);
5996 unsigned long h =
hash(parser, name);
5997 unsigned long mask = (
unsigned long)table->
size - 1;
5998 unsigned char step = 0;
6000 while (table->
v[i]) {
6005 i < step ? (i += table->
size - step) : (i -= step);
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 *);
6019 memset(newV, 0, tsize);
6020 for (i = 0; i < table->
size; i++)
6022 unsigned long newHash =
hash(parser, table->
v[i]->
name);
6023 size_t j = newHash & newMask;
6027 step =
PROBE_STEP(newHash, newMask, newPower);
6028 j < step ? (j += newSize - step) : (j -= step);
6030 newV[j] = table->
v[i];
6032 table->
mem->free_fcn(table->
v);
6034 table->
power = newPower;
6035 table->
size = newSize;
6038 while (table->
v[i]) {
6041 i < step ? (i += newSize - step) : (i -= step);
6045 table->
v[i] = (
NAMED *)table->
mem->malloc_fcn(createSize);
6048 memset(table->
v[i], 0, createSize);
6054 static void FASTCALL
6058 for (i = 0; i < table->
size; i++) {
6059 table->
mem->free_fcn(table->
v[i]);
6065 static void FASTCALL
6069 for (i = 0; i < table->
size; i++)
6070 table->
mem->free_fcn(table->
v[i]);
6071 table->
mem->free_fcn(table->
v);
6074 static void FASTCALL
6084 static void FASTCALL
6091 static NAMED * FASTCALL
6094 while (iter->
p != iter->
end) {
6095 NAMED *tem = *(iter->
p)++;
6102 static void FASTCALL
6113 static void FASTCALL
6133 static void FASTCALL
6139 pool->
mem->free_fcn(p);
6145 pool->
mem->free_fcn(p);
6152 const char *ptr,
const char *end)
6166 static const XML_Char * FASTCALL
6178 static const XML_Char *
6183 for (; n > 0; --
n, s++) {
6192 static const XML_Char * FASTCALL
6205 const char *ptr,
const char *end)
6215 static XML_Bool FASTCALL
6219 if (pool->
start == 0) {
6234 (pool->
end - pool->
start) *
sizeof(XML_Char));
6242 int blockSize = (int)(pool->
end - pool->
start)*2;
6246 + blockSize *
sizeof(XML_Char)));
6253 pool->
end = pool->
start + blockSize;
6257 int blockSize = (int)(pool->
end - pool->
start);
6263 + blockSize *
sizeof(XML_Char));
6266 tem->
size = blockSize;
6270 memcpy(tem->
s, pool->
start,
6271 (pool->
ptr - pool->
start) *
sizeof(XML_Char));
6274 pool->
end = tem->
s + blockSize;
6331 XML_Content **contpos,
6337 if (dest->type == XML_CTYPE_NAME) {
6338 const XML_Char *src;
6339 dest->name = *strpos;
6342 *(*strpos)++ = *src;
6347 dest->numchildren = 0;
6348 dest->children = NULL;
6354 dest->children = *contpos;
6355 *contpos += dest->numchildren;
6357 i < dest->numchildren;
6359 build_node(parser, cn, &(dest->children[i]), contpos, strpos);
6365 static XML_Content *
6372 int allocsize = (dtd->
scaffCount *
sizeof(XML_Content)
6375 ret = (XML_Content *)
MALLOC(allocsize);
6388 const ENCODING *enc,
6401 if (ret->
name != name)
#define parseEndByteIndex
#define startDoctypeDeclHandler
XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler
XML_EndElementHandler m_endElementHandler
ATTRIBUTE_ID * m_declAttributeId
static void FASTCALL poolClear(STRING_POOL *)
unsigned long m_nsAttsVersion
XML_Parser m_externalEntityRefHandlerArg
#define endElementHandler
static int FASTCALL nextScaffoldPart(XML_Parser parser)
const XML_Char * m_declNotationName
static ATTRIBUTE_ID * getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
XML_Parser m_parentParser
void XMLCALL XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler)
XML_CommentHandler m_commentHandler
XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser)
static XML_Bool FASTCALL poolGrow(STRING_POOL *pool)
unsigned char m_nsAttsPower
enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
static XML_Char * poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end)
#define unknownEncodingRelease
#define PROBE_STEP(hash, mask, power)
XML_Bool m_defaultExpandInternalEntities
static constexpr double s
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)
XML_XmlDeclHandler m_xmlDeclHandler
#define unparsedEntityDeclHandler
OPEN_INTERNAL_ENTITY * m_openInternalEntities
static Processor prologProcessor
static void build_node(XML_Parser parser, int src_node, XML_Content *dest, XML_Content **contpos, XML_Char **strpos)
void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end)
static const XML_Char implicitContext[]
static Processor internalEntityProcessor
void XMLCALL XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl)
const XML_LChar *XMLCALL XML_ErrorString(enum XML_Error code)
static void parserInit(XML_Parser parser, const XML_Char *encodingName)
XML_ExternalEntityRefHandler m_externalEntityRefHandler
static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr)
void XMLCALL XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler)
XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser)
const XML_Char *XMLCALL XML_GetBase(XML_Parser parser)
static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s, const char *next)
#define unknownEncodingHandler
const XML_Char * m_doctypeSysid
XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep)
enum XML_Status XMLCALL XML_ResumeParser(XML_Parser parser)
#define unknownEncodingMem
void *XMLCALL XML_MemMalloc(XML_Parser parser, size_t size)
XML_DefaultHandler m_defaultHandler
#define notationDeclHandler
#define attlistDeclHandler
INIT_ENCODING m_initEncoding
void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
#define XmlGetInternalEncoding
int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt)
const XML_Memory_Handling_Suite * mem
void XMLCALL XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler)
enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start, const char *end, const char **endPtr)
#define startNamespaceDeclHandler
static void FASTCALL normalizePublicId(XML_Char *s)
XML_Parser XMLCALL XML_ParserCreate(const XML_Char *encodingName)
XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser)
const char *XMLCALL XML_GetInputContext(XML_Parser parser, int *offset, int *size)
#define defaultExpandInternalEntities
static Processor epilogProcessor
static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end)
static void FASTCALL moveToFreeBindingList(XML_Parser parser, BINDING *bindings)
XML_Parser XMLCALL XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName)
static Processor prologInitProcessor
#define characterDataHandler
const char * name(G4int ptype)
const XML_Feature *XMLCALL XML_GetFeatureList(void)
int XMLCALL XML_GetIdAttributeIndex(XML_Parser parser)
const XML_Char * publicId
STRING_POOL entityValuePool
#define openInternalEntities
#define namespaceSeparator
void XMLCALL XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler)
#define XmlInitEncodingNS
void XMLCALL XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl)
struct binding * prevPrefixBinding
CONTENT_SCAFFOLD * scaffold
static void FASTCALL normalizeLines(XML_Char *s)
XML_Bool XMLCALL XML_ParserReset(XML_Parser parser, const XML_Char *encodingName)
XML_NotStandaloneHandler m_notStandaloneHandler
static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
int XmlSizeOfUnknownEncoding(void)
static void FASTCALL destroyBindings(BINDING *bindings, XML_Parser parser)
static Processor externalEntityInitProcessor
XML_AttlistDeclHandler m_attlistDeclHandler
static unsigned long generate_hash_secret_salt(void)
static XML_Char * poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end)
#define unknownEncodingHandlerData
XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler
void XMLCALL XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *data)
const ENCODING * m_internalEncoding
static Processor contentProcessor
XML_Index m_parseEndByteIndex
static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
XML_StartCdataSectionHandler m_startCdataSectionHandler
#define MUST_CONVERT(enc, s)
void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler)
#define skippedEntityHandler
XML_CharacterDataHandler m_characterDataHandler
XML_ParsingStatus m_parsingStatus
#define inheritedBindings
#define poolAppendChar(pool, c)
enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p)
XML_Char m_namespaceSeparator
void(XMLCALL *m_unknownEncodingRelease)(void *)
void * m_unknownEncodingMem
XML_SkippedEntityHandler m_skippedEntityHandler
static XML_Content * build_model(XML_Parser parser)
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)
#define endNamespaceDeclHandler
static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *)
#define XmlGetInternalEncodingNS
static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *)
static const XML_Char * getContext(XML_Parser parser)
#define protocolEncodingName
void XMLCALL XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler)
static Processor externalEntityInitProcessor3
void XMLCALL XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)
const XML_Memory_Handling_Suite * mem
static void FASTCALL hashTableDestroy(HASH_TABLE *)
struct open_internal_entity OPEN_INTERNAL_ENTITY
void XMLCALL XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end)
const ATTRIBUTE_ID * idAtt
#define declAttributeType
static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore)
#define INIT_TAG_BUF_SIZE
int XMLCALL XML_GetCurrentByteCount(XML_Parser parser)
unsigned long m_hash_secret_salt
void XMLCALL XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler)
#define entityDeclHandler
#define poolDiscard(pool)
void XMLCALL XML_SetUserData(XML_Parser parser, void *p)
#define unknownEncodingData
#define INIT_ATTS_VERSION
static NAMED * lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize)
static void FASTCALL hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms)
static unsigned long FASTCALL hash(XML_Parser parser, KEY s)
static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *, STRING_POOL *, const HASH_TABLE *)
HASH_TABLE generalEntities
XML_Bool m_declAttributeIsId
#define externalEntityRefHandlerArg
#define endDoctypeDeclHandler
ELEMENT_TYPE * m_declElementType
DEFAULT_ATTRIBUTE * defaultAtts
struct open_internal_entity * next
const char * internalEventEndPtr
CommandLineParser * parser(0)
enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
static Processor externalEntityContentProcessor
XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler
#define elementDeclHandler
void XMLCALL XML_UseParserAsHandlerArg(XML_Parser parser)
void XMLCALL XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler)
const char * internalEventPtr
XML_StartElementHandler m_startElementHandler
static void FASTCALL hashTableClear(HASH_TABLE *)
int XMLCALL XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing peParsing)
BINDING * m_inheritedBindings
void XMLCALL XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start)
void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler)
enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable)
static void FASTCALL poolDestroy(STRING_POOL *)
const XML_Char * m_declNotationPublicId
XML_ElementDeclHandler m_elementDeclHandler
OPEN_INTERNAL_ENTITY * m_freeInternalEntities
XML_EntityDeclHandler m_entityDeclHandler
static enum XML_Error handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
unsigned contentStringLen
const struct attribute_id * attId
void XMLCALL XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status)
enum XML_Error XMLCALL XML_GetErrorCode(XML_Parser parser)
static const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool, const XML_Char *s)
static NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *)
const XML_Char * notation
BINDING * m_freeBindingList
void XMLCALL XML_DefaultCurrent(XML_Parser parser)
static void reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
#define processingInstructionHandler
#define XmlParseXmlDeclNS
int XMLCALL XML_GetSpecifiedAttributeCount(XML_Parser parser)
static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms)
void XMLCALL XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
#define notStandaloneHandler
#define INIT_DATA_BUF_SIZE
void XMLCALL XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start)
XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler
void XmlPrologStateInit(PROLOG_STATE *state)
void XMLCALL XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end)
void XMLCALL XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler)
static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms)
#define XmlInitUnknownEncodingNS
static Processor errorProcessor
static XML_Parser parserCreate(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, DTD *dtd)
static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl)
#define endCdataSectionHandler
const char * m_positionPtr
enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
static enum XML_Error initializeEncoding(XML_Parser parser)
static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr)
void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start)
#define declNotationPublicId
ENCODING * XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, void *userData)
const char * m_eventEndPtr
static int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
static const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool, const XML_Char *s)
void XMLCALL XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start)
void XMLCALL XML_FreeContentModel(XML_Parser parser, XML_Content *model)
const XML_Char * localPart
XML_EndCdataSectionHandler m_endCdataSectionHandler
void * m_unknownEncodingHandlerData
static Processor externalEntityInitProcessor2
void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler)
XML_Bool hasParamEntityRefs
const char * m_parseEndPtr
XML_Expat_Version XMLCALL XML_ExpatVersionInfo(void)
const XML_Char * m_curBase
XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler
static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *)
static XML_Bool startParsing(XML_Parser parser)
const XML_Char * m_doctypeName
#define poolLastChar(pool)
struct attribute_id ATTRIBUTE_ID
const XML_Char * m_protocolEncodingName
const XML_LChar *XMLCALL XML_ExpatVersion(void)
static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *)
static XML_Bool storeRawNames(XML_Parser parser)
void XMLCALL XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end)
XML_NotationDeclHandler m_notationDeclHandler
static constexpr double ms
static void FASTCALL poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms)
#define INIT_SCAFFOLD_ELEMENTS
static void dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms)
enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
void XMLCALL XML_MemFree(XML_Parser parser, void *ptr)
void *XMLCALL XML_MemRealloc(XML_Parser parser, void *ptr, size_t size)
enum XML_Content_Type type
XML_Bool m_declAttributeIsCdata
XML_ProcessingInstructionHandler m_processingInstructionHandler
static XML_Bool FASTCALL keyeq(KEY s1, KEY s2)
void * m_unknownEncodingData
struct binding * nextTagBinding
enum XML_Error m_errorCode
void XMLCALL XML_ParserFree(XML_Parser parser)
#define startElementHandler
const XML_Char * m_declAttributeType
const XML_Char * systemId
void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser)
const XML_Char * m_doctypePubid
enum XML_Content_Quant quant
void XMLCALL XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler)
XML_Parser XMLCALL XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
const ENCODING * m_encoding
static XML_Bool setContext(XML_Parser parser, const XML_Char *context)
#define externalEntityRefHandler
#define freeInternalEntities
#define declAttributeIsCdata
void XMLCALL XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end)
PROLOG_STATE m_prologState
XML_UnknownEncodingHandler m_unknownEncodingHandler
void *XMLCALL XML_GetBuffer(XML_Parser parser, int len)
static Processor cdataSectionProcessor
#define startCdataSectionHandler
void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end)
#define declAttributeIsId
const XML_Memory_Handling_Suite m_mem
static const XML_Char * poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)