9 #define XML_BUILDING_EXPAT 1
11 #ifdef COMPILED_FROM_DSP
12 #include "winconfig.h"
13 #elif defined(MACOS_CLASSIC)
14 #include "macconfig.h"
15 #elif defined(__amigaos4__)
16 #include "amigaconfig.h"
17 #elif defined(__WATCOMC__)
18 #include "watcomconfig.h"
19 #elif defined(HAVE_EXPAT_CONFIG_H)
20 #include <expat_config.h>
27 #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
28 #define XmlConvert XmlUtf16Convert
29 #define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
30 #define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
31 #define XmlEncode XmlUtf16Encode
33 #define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1))
34 typedef unsigned short ICHAR;
36 #define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
37 #define XmlConvert XmlUtf8Convert
38 #define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
39 #define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
40 #define XmlEncode XmlUtf8Encode
41 #define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
48 #define XmlInitEncodingNS XmlInitEncoding
49 #define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
50 #undef XmlGetInternalEncodingNS
51 #define XmlGetInternalEncodingNS XmlGetInternalEncoding
52 #define XmlParseXmlDeclNS XmlParseXmlDecl
58 #ifdef XML_UNICODE_WCHAR_T
59 #define XML_T(x) (const wchar_t)x
60 #define XML_L(x) L ## x
62 #define XML_T(x) (const unsigned short)x
74 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
79 #define memmove(d,s,l) bcopy((s),(d),(l))
81 #error memmove does not exist on this platform, nor is a substitute available
89 typedef const XML_Char *
KEY;
100 const XML_Memory_Handling_Suite *
mem;
108 #define CHAR_HASH(h, c) \
109 (((h) * 0xF4243) ^ (unsigned short)(c))
111 #define CHAR_HASH(h, c) \
112 (((h) * 0xF4243) ^ (unsigned char)(c))
123 #define SECOND_HASH(hash, mask, power) \
124 ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2))
125 #define PROBE_STEP(hash, mask, power) \
126 ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
133 #define INIT_TAG_BUF_SIZE 32
134 #define INIT_DATA_BUF_SIZE 1024
135 #define INIT_ATTS_SIZE 16
136 #define INIT_ATTS_VERSION 0xFFFFFFFF
137 #define INIT_BLOCK_SIZE 1024
138 #define INIT_BUFFER_SIZE 1024
140 #define EXPAND_SPARE 24
204 enum XML_Content_Type type;
205 enum XML_Content_Quant quant;
213 #define INIT_SCAFFOLD_ELEMENTS 32
227 const XML_Memory_Handling_Suite *
mem;
275 XML_Bool paramEntityRead;
298 typedef enum XML_Error PTRCALL
Processor(XML_Parser parser,
301 const char **endPtr);
309 static Processor externalParEntProcessor;
310 static Processor externalParEntInitProcessor;
312 static Processor entityValueInitProcessor;
322 static enum XML_Error
324 static enum XML_Error
326 const char *
s,
const char *
next);
327 static enum XML_Error
329 static enum XML_Error
330 doProlog(XML_Parser parser,
const ENCODING *enc,
const char *
s,
331 const char *end,
int tok,
const char *
next,
const char **nextPtr,
333 static enum XML_Error
336 static enum XML_Error
338 const char *start,
const char *end,
const char **endPtr,
340 static enum XML_Error
341 doCdataSection(XML_Parser parser,
const ENCODING *,
const char **startPtr,
342 const char *end,
const char **nextPtr, XML_Bool haveMore);
344 static enum XML_Error
345 doIgnoreSection(XML_Parser parser,
const ENCODING *,
const char **startPtr,
346 const char *end,
const char **nextPtr, XML_Bool haveMore);
349 static enum XML_Error
350 storeAtts(XML_Parser parser,
const ENCODING *,
const char *
s,
352 static enum XML_Error
354 const XML_Char *uri,
BINDING **bindingsPtr);
357 XML_Bool isId,
const XML_Char *dfltValue, XML_Parser parser);
358 static enum XML_Error
361 static enum XML_Error
365 getAttributeId(XML_Parser parser,
const ENCODING *enc,
const char *start,
369 static enum XML_Error
374 const char *start,
const char *end);
376 reportComment(XML_Parser parser,
const ENCODING *enc,
const char *start,
379 reportDefault(XML_Parser parser,
const ENCODING *enc,
const char *start,
382 static const XML_Char *
getContext(XML_Parser parser);
384 setContext(XML_Parser parser,
const XML_Char *context);
390 static void dtdReset(
DTD *p,
const XML_Memory_Handling_Suite *
ms);
392 dtdDestroy(
DTD *p, XML_Bool isDocEntity,
const XML_Memory_Handling_Suite *
ms);
394 dtdCopy(
DTD *newDtd,
const DTD *oldDtd,
const XML_Memory_Handling_Suite *
ms);
414 const char *ptr,
const char *end);
417 const char *ptr,
const char *end);
419 static const XML_Char * FASTCALL
421 static const XML_Char *
423 static const XML_Char * FASTCALL
427 static XML_Content *
build_model(XML_Parser parser);
430 const char *ptr,
const char *end);
434 const XML_Memory_Handling_Suite *memsuite,
435 const XML_Char *nameSep,
438 parserInit(XML_Parser parser,
const XML_Char *encodingName);
440 #define poolStart(pool) ((pool)->start)
441 #define poolEnd(pool) ((pool)->ptr)
442 #define poolLength(pool) ((pool)->ptr - (pool)->start)
443 #define poolChop(pool) ((void)--(pool->ptr))
444 #define poolLastChar(pool) (((pool)->ptr)[-1])
445 #define poolDiscard(pool) ((pool)->ptr = (pool)->start)
446 #define poolFinish(pool) ((pool)->start = (pool)->ptr)
447 #define poolAppendChar(pool, c) \
448 (((pool)->ptr == (pool)->end && !poolGrow(pool)) \
450 : ((*((pool)->ptr)++ = c), 1))
458 const XML_Memory_Handling_Suite
m_mem;
501 void (XMLCALL *m_unknownEncodingRelease)(
void *);
545 XML_Bool m_isParamEntity;
546 XML_Bool m_useForeignDTD;
547 enum XML_ParamEntityParsing m_paramEntityParsing;
551 #define MALLOC(s) (parser->m_mem.malloc_fcn((s)))
552 #define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s)))
553 #define FREE(p) (parser->m_mem.free_fcn((p)))
555 #define userData (parser->m_userData)
556 #define handlerArg (parser->m_handlerArg)
557 #define startElementHandler (parser->m_startElementHandler)
558 #define endElementHandler (parser->m_endElementHandler)
559 #define characterDataHandler (parser->m_characterDataHandler)
560 #define processingInstructionHandler \
561 (parser->m_processingInstructionHandler)
562 #define commentHandler (parser->m_commentHandler)
563 #define startCdataSectionHandler \
564 (parser->m_startCdataSectionHandler)
565 #define endCdataSectionHandler (parser->m_endCdataSectionHandler)
566 #define defaultHandler (parser->m_defaultHandler)
567 #define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler)
568 #define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler)
569 #define unparsedEntityDeclHandler \
570 (parser->m_unparsedEntityDeclHandler)
571 #define notationDeclHandler (parser->m_notationDeclHandler)
572 #define startNamespaceDeclHandler \
573 (parser->m_startNamespaceDeclHandler)
574 #define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler)
575 #define notStandaloneHandler (parser->m_notStandaloneHandler)
576 #define externalEntityRefHandler \
577 (parser->m_externalEntityRefHandler)
578 #define externalEntityRefHandlerArg \
579 (parser->m_externalEntityRefHandlerArg)
580 #define internalEntityRefHandler \
581 (parser->m_internalEntityRefHandler)
582 #define skippedEntityHandler (parser->m_skippedEntityHandler)
583 #define unknownEncodingHandler (parser->m_unknownEncodingHandler)
584 #define elementDeclHandler (parser->m_elementDeclHandler)
585 #define attlistDeclHandler (parser->m_attlistDeclHandler)
586 #define entityDeclHandler (parser->m_entityDeclHandler)
587 #define xmlDeclHandler (parser->m_xmlDeclHandler)
588 #define encoding (parser->m_encoding)
589 #define initEncoding (parser->m_initEncoding)
590 #define internalEncoding (parser->m_internalEncoding)
591 #define unknownEncodingMem (parser->m_unknownEncodingMem)
592 #define unknownEncodingData (parser->m_unknownEncodingData)
593 #define unknownEncodingHandlerData \
594 (parser->m_unknownEncodingHandlerData)
595 #define unknownEncodingRelease (parser->m_unknownEncodingRelease)
596 #define protocolEncodingName (parser->m_protocolEncodingName)
597 #define ns (parser->m_ns)
598 #define ns_triplets (parser->m_ns_triplets)
599 #define prologState (parser->m_prologState)
600 #define processor (parser->m_processor)
601 #define errorCode (parser->m_errorCode)
602 #define eventPtr (parser->m_eventPtr)
603 #define eventEndPtr (parser->m_eventEndPtr)
604 #define positionPtr (parser->m_positionPtr)
605 #define position (parser->m_position)
606 #define openInternalEntities (parser->m_openInternalEntities)
607 #define freeInternalEntities (parser->m_freeInternalEntities)
608 #define defaultExpandInternalEntities \
609 (parser->m_defaultExpandInternalEntities)
610 #define tagLevel (parser->m_tagLevel)
611 #define buffer (parser->m_buffer)
612 #define bufferPtr (parser->m_bufferPtr)
613 #define bufferEnd (parser->m_bufferEnd)
614 #define parseEndByteIndex (parser->m_parseEndByteIndex)
615 #define parseEndPtr (parser->m_parseEndPtr)
616 #define bufferLim (parser->m_bufferLim)
617 #define dataBuf (parser->m_dataBuf)
618 #define dataBufEnd (parser->m_dataBufEnd)
619 #define _dtd (parser->m_dtd)
620 #define curBase (parser->m_curBase)
621 #define declEntity (parser->m_declEntity)
622 #define doctypeName (parser->m_doctypeName)
623 #define doctypeSysid (parser->m_doctypeSysid)
624 #define doctypePubid (parser->m_doctypePubid)
625 #define declAttributeType (parser->m_declAttributeType)
626 #define declNotationName (parser->m_declNotationName)
627 #define declNotationPublicId (parser->m_declNotationPublicId)
628 #define declElementType (parser->m_declElementType)
629 #define declAttributeId (parser->m_declAttributeId)
630 #define declAttributeIsCdata (parser->m_declAttributeIsCdata)
631 #define declAttributeIsId (parser->m_declAttributeIsId)
632 #define freeTagList (parser->m_freeTagList)
633 #define freeBindingList (parser->m_freeBindingList)
634 #define inheritedBindings (parser->m_inheritedBindings)
635 #define tagStack (parser->m_tagStack)
636 #define atts (parser->m_atts)
637 #define attsSize (parser->m_attsSize)
638 #define nSpecifiedAtts (parser->m_nSpecifiedAtts)
639 #define idAttIndex (parser->m_idAttIndex)
640 #define nsAtts (parser->m_nsAtts)
641 #define nsAttsVersion (parser->m_nsAttsVersion)
642 #define nsAttsPower (parser->m_nsAttsPower)
643 #define tempPool (parser->m_tempPool)
644 #define temp2Pool (parser->m_temp2Pool)
645 #define groupConnector (parser->m_groupConnector)
646 #define groupSize (parser->m_groupSize)
647 #define namespaceSeparator (parser->m_namespaceSeparator)
648 #define parentParser (parser->m_parentParser)
649 #define ps_parsing (parser->m_parsingStatus.parsing)
650 #define ps_finalBuffer (parser->m_parsingStatus.finalBuffer)
652 #define isParamEntity (parser->m_isParamEntity)
653 #define useForeignDTD (parser->m_useForeignDTD)
654 #define paramEntityParsing (parser->m_paramEntityParsing)
672 ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p,
673 ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,
674 ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,
675 ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,
676 ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,
677 ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e,
'\0'
682 const XML_Memory_Handling_Suite *memsuite,
683 const XML_Char *nameSep)
685 XML_Parser parser =
parserCreate(encodingName, memsuite, nameSep, NULL);
686 if (parser != NULL &&
ns) {
700 const XML_Memory_Handling_Suite *memsuite,
701 const XML_Char *nameSep,
707 XML_Memory_Handling_Suite *mtemp;
708 parser = (XML_Parser)
710 if (parser != NULL) {
711 mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
712 mtemp->malloc_fcn = memsuite->malloc_fcn;
713 mtemp->realloc_fcn = memsuite->realloc_fcn;
714 mtemp->free_fcn = memsuite->free_fcn;
718 XML_Memory_Handling_Suite *mtemp;
720 if (parser != NULL) {
721 mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
722 mtemp->malloc_fcn =
malloc;
724 mtemp->free_fcn =
free;
865 isParamEntity = XML_FALSE;
866 useForeignDTD = XML_FALSE;
867 paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
902 while (openEntityList) {
904 openEntityList = openEntity->
next;
919 enum XML_Status XMLCALL
927 return XML_STATUS_ERROR;
928 if (encodingName == NULL)
933 return XML_STATUS_ERROR;
935 return XML_STATUS_OK;
940 const XML_Char *context,
941 const XML_Char *encodingName)
943 XML_Parser parser = oldParser;
949 XML_ProcessingInstructionHandler oldProcessingInstructionHandler
952 XML_StartCdataSectionHandler oldStartCdataSectionHandler
954 XML_EndCdataSectionHandler oldEndCdataSectionHandler
957 XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler
960 XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler
962 XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler
965 XML_ExternalEntityRefHandler oldExternalEntityRefHandler
968 XML_UnknownEncodingHandler oldUnknownEncodingHandler
981 enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;
999 parser =
parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
1002 parser =
parserCreate(encodingName, &parser->m_mem, NULL, newDtd);
1030 if (oldUserData == oldHandlerArg)
1034 if (oldExternalEntityRefHandlerArg != oldParser)
1040 paramEntityParsing = oldParamEntityParsing;
1060 isParamEntity = XML_TRUE;
1062 processor = externalParEntInitProcessor;
1068 static void FASTCALL
1092 if (tagList == NULL) {
1099 tagList = tagList->
parent;
1108 if (entityList == NULL) {
1114 openEntity = entityList;
1115 entityList = entityList->
next;
1127 if (!isParamEntity &&
_dtd)
1149 enum XML_Error XMLCALL
1155 return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;
1156 useForeignDTD = useDTD;
1157 return XML_ERROR_NONE;
1159 return XML_ERROR_FEATURE_REQUIRES_XML_DTD;
1181 enum XML_Status XMLCALL
1187 return XML_STATUS_ERROR;
1192 return XML_STATUS_OK;
1195 const XML_Char * XMLCALL
1215 XML_StartElementHandler start,
1216 XML_EndElementHandler end)
1224 XML_StartElementHandler start) {
1230 XML_EndElementHandler end) {
1236 XML_CharacterDataHandler handler)
1243 XML_ProcessingInstructionHandler handler)
1250 XML_CommentHandler handler)
1257 XML_StartCdataSectionHandler start,
1258 XML_EndCdataSectionHandler end)
1266 XML_StartCdataSectionHandler start) {
1272 XML_EndCdataSectionHandler end) {
1278 XML_DefaultHandler handler)
1286 XML_DefaultHandler handler)
1294 XML_StartDoctypeDeclHandler start,
1295 XML_EndDoctypeDeclHandler end)
1303 XML_StartDoctypeDeclHandler start) {
1309 XML_EndDoctypeDeclHandler end) {
1315 XML_UnparsedEntityDeclHandler handler)
1322 XML_NotationDeclHandler handler)
1329 XML_StartNamespaceDeclHandler start,
1330 XML_EndNamespaceDeclHandler end)
1338 XML_StartNamespaceDeclHandler start) {
1344 XML_EndNamespaceDeclHandler end) {
1350 XML_NotStandaloneHandler handler)
1357 XML_ExternalEntityRefHandler handler)
1373 XML_SkippedEntityHandler handler)
1380 XML_UnknownEncodingHandler handler,
1389 XML_ElementDeclHandler eldecl)
1396 XML_AttlistDeclHandler attdecl)
1403 XML_EntityDeclHandler handler)
1410 XML_XmlDeclHandler handler) {
1416 enum XML_ParamEntityParsing peParsing)
1422 paramEntityParsing = peParsing;
1425 return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;
1429 enum XML_Status XMLCALL
1430 XML_Parse(XML_Parser parser,
const char *
s,
int len,
int isFinal)
1435 return XML_STATUS_ERROR;
1438 return XML_STATUS_ERROR;
1446 return XML_STATUS_OK;
1461 return XML_STATUS_SUSPENDED;
1462 case XML_INITIALIZED:
1467 return XML_STATUS_OK;
1472 return XML_STATUS_ERROR;
1474 #ifndef XML_CONTEXT_BYTES
1478 enum XML_Error result;
1488 return XML_STATUS_ERROR;
1493 result = XML_STATUS_SUSPENDED;
1495 case XML_INITIALIZED:
1497 result = XML_STATUS_OK;
1506 nLeftOver = s + len - end;
1512 ? (
char *)
MALLOC(len * 2)
1516 return XML_STATUS_ERROR;
1523 return XML_STATUS_ERROR;
1527 memcpy(
buffer, end, nLeftOver);
1541 return XML_STATUS_ERROR;
1543 memcpy(buff, s, len);
1549 enum XML_Status XMLCALL
1553 enum XML_Status result = XML_STATUS_OK;
1558 return XML_STATUS_ERROR;
1561 return XML_STATUS_ERROR;
1578 return XML_STATUS_ERROR;
1583 result = XML_STATUS_SUSPENDED;
1585 case XML_INITIALIZED:
1616 #ifdef XML_CONTEXT_BYTES
1619 if (keep > XML_CONTEXT_BYTES)
1620 keep = XML_CONTEXT_BYTES;
1624 #ifdef XML_CONTEXT_BYTES
1640 if (bufferSize == 0)
1644 }
while (bufferSize < neededSize);
1645 newBuf = (
char *)
MALLOC(bufferSize);
1651 #ifdef XML_CONTEXT_BYTES
1654 if (keep > XML_CONTEXT_BYTES)
1655 keep = XML_CONTEXT_BYTES;
1679 enum XML_Status XMLCALL
1686 return XML_STATUS_ERROR;
1692 return XML_STATUS_ERROR;
1696 if (isParamEntity) {
1698 return XML_STATUS_ERROR;
1706 return XML_STATUS_OK;
1709 enum XML_Status XMLCALL
1712 enum XML_Status result = XML_STATUS_OK;
1716 return XML_STATUS_ERROR;
1725 return XML_STATUS_ERROR;
1730 result = XML_STATUS_SUSPENDED;
1732 case XML_INITIALIZED:
1751 *status = parser->m_parsingStatus;
1754 enum XML_Error XMLCALL
1776 const char * XMLCALL
1779 #ifdef XML_CONTEXT_BYTES
1847 const XML_LChar * XMLCALL
1850 static const XML_LChar*
const message[] = {
1852 XML_L(
"out of memory"),
1853 XML_L(
"syntax error"),
1854 XML_L(
"no element found"),
1855 XML_L(
"not well-formed (invalid token)"),
1856 XML_L(
"unclosed token"),
1857 XML_L(
"partial character"),
1858 XML_L(
"mismatched tag"),
1859 XML_L(
"duplicate attribute"),
1860 XML_L(
"junk after document element"),
1861 XML_L(
"illegal parameter entity reference"),
1862 XML_L(
"undefined entity"),
1863 XML_L(
"recursive entity reference"),
1864 XML_L(
"asynchronous entity"),
1865 XML_L(
"reference to invalid character number"),
1866 XML_L(
"reference to binary entity"),
1867 XML_L(
"reference to external entity in attribute"),
1868 XML_L(
"XML or text declaration not at start of entity"),
1869 XML_L(
"unknown encoding"),
1870 XML_L(
"encoding specified in XML declaration is incorrect"),
1871 XML_L(
"unclosed CDATA section"),
1872 XML_L(
"error in processing external entity reference"),
1873 XML_L(
"document is not standalone"),
1874 XML_L(
"unexpected parser state - please send a bug report"),
1875 XML_L(
"entity declared in parameter entity"),
1876 XML_L(
"requested feature requires XML_DTD support in Expat"),
1877 XML_L(
"cannot change setting once parsing has begun"),
1878 XML_L(
"unbound prefix"),
1879 XML_L(
"must not undeclare prefix"),
1880 XML_L(
"incomplete markup in parameter entity"),
1881 XML_L(
"XML declaration not well-formed"),
1882 XML_L(
"text declaration not well-formed"),
1883 XML_L(
"illegal character(s) in public id"),
1884 XML_L(
"parser suspended"),
1885 XML_L(
"parser not suspended"),
1886 XML_L(
"parsing aborted"),
1887 XML_L(
"parsing finished"),
1888 XML_L(
"cannot suspend in external parameter entity"),
1889 XML_L(
"reserved prefix (xml) must not be undeclared or bound to another namespace name"),
1890 XML_L(
"reserved prefix (xmlns) must not be declared or undeclared"),
1891 XML_L(
"prefix must not be bound to one of the reserved namespace names")
1893 if (code > 0 &&
unsigned(code) <
sizeof(message)/
sizeof(message[0]))
1894 return message[code];
1898 const XML_LChar * XMLCALL
1909 #define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c)
1910 #define V2(a,b,c) XML_L("expat_")V1(a,b,c)
1912 return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION);
1918 XML_Expat_Version XMLCALL
1921 XML_Expat_Version version;
1923 version.major = XML_MAJOR_VERSION;
1924 version.minor = XML_MINOR_VERSION;
1925 version.micro = XML_MICRO_VERSION;
1930 const XML_Feature * XMLCALL
1933 static const XML_Feature features[] = {
1934 {XML_FEATURE_SIZEOF_XML_CHAR,
XML_L(
"sizeof(XML_Char)"),
1936 {XML_FEATURE_SIZEOF_XML_LCHAR,
XML_L(
"sizeof(XML_LChar)"),
1939 {XML_FEATURE_UNICODE,
XML_L(
"XML_UNICODE"), 0},
1941 #ifdef XML_UNICODE_WCHAR_T
1942 {XML_FEATURE_UNICODE_WCHAR_T,
XML_L(
"XML_UNICODE_WCHAR_T"), 0},
1945 {XML_FEATURE_DTD,
XML_L(
"XML_DTD"), 0},
1947 #ifdef XML_CONTEXT_BYTES
1948 {XML_FEATURE_CONTEXT_BYTES,
XML_L(
"XML_CONTEXT_BYTES"),
1952 {XML_FEATURE_MIN_SIZE,
XML_L(
"XML_MIN_SIZE"), 0},
1955 {XML_FEATURE_NS,
XML_L(
"XML_NS"), 0},
1957 #ifdef XML_LARGE_SIZE
1958 {XML_FEATURE_LARGE_SIZE,
XML_L(
"XML_LARGE_SIZE"), 0},
1960 {XML_FEATURE_END, NULL, 0}
1977 int nameLen =
sizeof(XML_Char) * (tag->
name.
strLen + 1);
1978 char *rawNameBuf = tag->
buf + nameLen;
1984 if (tag->
rawName == rawNameBuf)
1991 char *temp = (
char *)
REALLOC(tag->
buf, bufSize);
1998 tag->
name.
str = (XML_Char *)temp;
2004 (XML_Char *)tag->
buf);
2006 tag->
bufEnd = temp + bufSize;
2007 rawNameBuf = temp + nameLen;
2016 static enum XML_Error PTRCALL
2020 const char **endPtr)
2024 if (result == XML_ERROR_NONE) {
2026 return XML_ERROR_NO_MEMORY;
2031 static enum XML_Error PTRCALL
2035 const char **endPtr)
2038 if (result != XML_ERROR_NONE)
2044 static enum XML_Error PTRCALL
2048 const char **endPtr)
2050 const char *next = start;
2051 int tok = XmlContentTok(
encoding, start, end, &next);
2061 return XML_ERROR_NONE;
2065 case XML_TOK_PARTIAL:
2068 return XML_ERROR_NONE;
2071 return XML_ERROR_UNCLOSED_TOKEN;
2072 case XML_TOK_PARTIAL_CHAR:
2075 return XML_ERROR_NONE;
2078 return XML_ERROR_PARTIAL_CHAR;
2084 static enum XML_Error PTRCALL
2088 const char **endPtr)
2091 const char *next = start;
2093 tok = XmlContentTok(
encoding, start, end, &next);
2097 case XML_TOK_XML_DECL:
2099 enum XML_Error result;
2101 if (result != XML_ERROR_NONE)
2106 return XML_ERROR_NONE;
2108 return XML_ERROR_ABORTED;
2114 case XML_TOK_PARTIAL:
2117 return XML_ERROR_NONE;
2119 return XML_ERROR_UNCLOSED_TOKEN;
2120 case XML_TOK_PARTIAL_CHAR:
2123 return XML_ERROR_NONE;
2125 return XML_ERROR_PARTIAL_CHAR;
2132 static enum XML_Error PTRCALL
2136 const char **endPtr)
2140 if (result == XML_ERROR_NONE) {
2142 return XML_ERROR_NO_MEMORY;
2147 static enum XML_Error
2150 const ENCODING *enc,
2153 const char **nextPtr,
2159 const char **eventPP;
2160 const char **eventEndPP;
2172 const char *next =
s;
2173 int tok = XmlContentTok(enc, s, end, &next);
2176 case XML_TOK_TRAILING_CR:
2179 return XML_ERROR_NONE;
2191 if (startTagLevel == 0)
2192 return XML_ERROR_NO_ELEMENTS;
2194 return XML_ERROR_ASYNC_ENTITY;
2196 return XML_ERROR_NONE;
2200 return XML_ERROR_NONE;
2202 if (startTagLevel > 0) {
2204 return XML_ERROR_ASYNC_ENTITY;
2206 return XML_ERROR_NONE;
2208 return XML_ERROR_NO_ELEMENTS;
2209 case XML_TOK_INVALID:
2211 return XML_ERROR_INVALID_TOKEN;
2212 case XML_TOK_PARTIAL:
2215 return XML_ERROR_NONE;
2217 return XML_ERROR_UNCLOSED_TOKEN;
2218 case XML_TOK_PARTIAL_CHAR:
2221 return XML_ERROR_NONE;
2223 return XML_ERROR_PARTIAL_CHAR;
2224 case XML_TOK_ENTITY_REF:
2226 const XML_Char *
name;
2228 XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
2229 s + enc->minBytesPerChar,
2230 next - enc->minBytesPerChar);
2239 s + enc->minBytesPerChar,
2240 next - enc->minBytesPerChar);
2242 return XML_ERROR_NO_MEMORY;
2251 return XML_ERROR_UNDEFINED_ENTITY;
2253 return XML_ERROR_ENTITY_DECLARED_IN_PE;
2263 return XML_ERROR_RECURSIVE_ENTITY_REF;
2265 return XML_ERROR_BINARY_ENTITY_REF;
2267 enum XML_Error result;
2276 if (result != XML_ERROR_NONE)
2280 const XML_Char *context;
2281 entity->
open = XML_TRUE;
2283 entity->
open = XML_FALSE;
2285 return XML_ERROR_NO_MEMORY;
2291 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
2298 case XML_TOK_START_TAG_NO_ATTS:
2300 case XML_TOK_START_TAG_WITH_ATTS:
2303 enum XML_Error result;
2312 return XML_ERROR_NO_MEMORY;
2316 return XML_ERROR_NO_MEMORY;
2325 tag->
rawName = s + enc->minBytesPerChar;
2330 const char *fromPtr = tag->
rawName;
2331 toPtr = (XML_Char *)tag->
buf;
2336 &fromPtr, rawNameEnd,
2338 convLen = (int)(toPtr - (XML_Char *)tag->
buf);
2339 if (fromPtr == rawNameEnd) {
2343 bufSize = (int)(tag->
bufEnd - tag->
buf) << 1;
2345 char *temp = (
char *)
REALLOC(tag->
buf, bufSize);
2347 return XML_ERROR_NO_MEMORY;
2349 tag->
bufEnd = temp + bufSize;
2350 toPtr = (XML_Char *)temp + convLen;
2355 *toPtr =
XML_T(
'\0');
2361 (
const XML_Char **)
atts);
2367 case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
2369 case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
2371 const char *rawName = s + enc->minBytesPerChar;
2372 enum XML_Error result;
2374 XML_Bool noElmHandlers = XML_TRUE;
2377 rawName + XmlNameLength(enc, rawName));
2379 return XML_ERROR_NO_MEMORY;
2381 result =
storeAtts(parser, enc, s, &name, &bindings);
2387 noElmHandlers = XML_FALSE;
2391 *eventPP = *eventEndPP;
2393 noElmHandlers = XML_FALSE;
2411 case XML_TOK_END_TAG:
2413 return XML_ERROR_ASYNC_ENTITY;
2416 const char *rawName;
2421 rawName = s + enc->minBytesPerChar*2;
2422 len = XmlNameLength(enc, rawName);
2424 || memcmp(tag->
rawName, rawName, len) != 0) {
2426 return XML_ERROR_TAG_MISMATCH;
2430 const XML_Char *localPart;
2434 if (
ns && localPart) {
2441 while (*localPart) *uri++ = *localPart++;
2445 while (*prefix) *uri++ = *prefix++;
2466 case XML_TOK_CHAR_REF:
2468 int n = XmlCharRefNumber(enc, s);
2470 return XML_ERROR_BAD_CHAR_REF;
2479 case XML_TOK_XML_DECL:
2480 return XML_ERROR_MISPLACED_XML_PI;
2481 case XML_TOK_DATA_NEWLINE:
2489 case XML_TOK_CDATA_SECT_OPEN:
2491 enum XML_Error result;
2512 result =
doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
2513 if (result != XML_ERROR_NONE)
2521 case XML_TOK_TRAILING_RSQB:
2524 return XML_ERROR_NONE;
2536 (
int)((XML_Char *)end - (XML_Char *)s));
2543 if (startTagLevel == 0) {
2545 return XML_ERROR_NO_ELEMENTS;
2549 return XML_ERROR_ASYNC_ENTITY;
2552 return XML_ERROR_NONE;
2553 case XML_TOK_DATA_CHARS:
2556 if (charDataHandler) {
2572 (
int)((XML_Char *)next - (XML_Char *)s));
2580 return XML_ERROR_NO_MEMORY;
2582 case XML_TOK_COMMENT:
2584 return XML_ERROR_NO_MEMORY;
2591 *eventPP = s = next;
2595 return XML_ERROR_NONE;
2597 return XML_ERROR_ABORTED;
2614 static enum XML_Error
2616 const char *attStr,
TAG_NAME *tagNamePtr,
2622 const XML_Char **appAtts;
2630 const XML_Char *localPart;
2637 return XML_ERROR_NO_MEMORY;
2641 return XML_ERROR_NO_MEMORY;
2643 return XML_ERROR_NO_MEMORY;
2655 return XML_ERROR_NO_MEMORY;
2657 if (n > oldAttsSize)
2658 XmlGetAttributes(enc, attStr, n,
atts);
2661 appAtts = (
const XML_Char **)
atts;
2662 for (i = 0; i <
n; i++) {
2666 + XmlNameLength(enc,
atts[i].name));
2668 return XML_ERROR_NO_MEMORY;
2673 if ((attId->
name)[-1]) {
2676 return XML_ERROR_DUPLICATE_ATTRIBUTE;
2678 (attId->
name)[-1] = 1;
2679 appAtts[attIndex++] = attId->
name;
2680 if (!
atts[i].normalized) {
2681 enum XML_Error result;
2682 XML_Bool isCdata = XML_TRUE;
2687 for (j = 0; j < nDefaultAtts; j++) {
2697 atts[i].valuePtr,
atts[i].valueEnd,
2708 if (appAtts[attIndex] == 0)
2709 return XML_ERROR_NO_MEMORY;
2717 appAtts[attIndex], bindingsPtr);
2726 (attId->
name)[-1] = 2;
2736 for (i = 0; i < attIndex; i += 2)
2737 if (appAtts[i] == elementType->
idAtt->
name) {
2746 for (i = 0; i < nDefaultAtts; i++) {
2752 da->
value, bindingsPtr);
2759 appAtts[attIndex++] = da->
id->
name;
2760 appAtts[attIndex++] = da->
value;
2765 appAtts[attIndex++] = da->
id->
name;
2766 appAtts[attIndex++] = da->
value;
2770 appAtts[attIndex] = 0;
2789 return XML_ERROR_NO_MEMORY;
2796 for (j = nsAttsSize; j != 0; )
2797 nsAtts[--j].version = version;
2802 for (; i < attIndex; i += 2) {
2803 const XML_Char *
s = appAtts[i];
2807 unsigned long uriHash = 0;
2808 ((XML_Char *)s)[-1] = 0;
2812 return XML_ERROR_UNBOUND_PREFIX;
2815 for (j = 0; j < b->
uriLen; j++) {
2816 const XML_Char c = b->
uri[j];
2818 return XML_ERROR_NO_MEMORY;
2821 while (*s++ !=
XML_T(ASCII_COLON))
2824 const XML_Char c = *
s;
2826 return XML_ERROR_NO_MEMORY;
2833 unsigned char step = 0;
2834 unsigned long mask = nsAttsSize - 1;
2836 while (
nsAtts[j].version == version) {
2840 const XML_Char *s2 =
nsAtts[j].uriName;
2842 for (; *s1 == *s2 && *s1 != 0; s1++, s2++);
2844 return XML_ERROR_DUPLICATE_ATTRIBUTE;
2848 j < step ? (j += nsAttsSize - step) : (j -= step);
2857 return XML_ERROR_NO_MEMORY;
2867 nsAtts[j].version = version;
2868 nsAtts[j].hash = uriHash;
2877 ((XML_Char *)s)[-1] = 0;
2881 for (; i < attIndex; i += 2)
2882 ((XML_Char *)(appAtts[i]))[-1] = 0;
2883 for (binding = *bindingsPtr; binding; binding = binding->
nextTagBinding)
2887 return XML_ERROR_NONE;
2890 if (elementType->
prefix) {
2893 return XML_ERROR_UNBOUND_PREFIX;
2894 localPart = tagNamePtr->
str;
2895 while (*localPart++ !=
XML_T(ASCII_COLON))
2900 localPart = tagNamePtr->
str;
2903 return XML_ERROR_NONE;
2913 for (i = 0; localPart[i++];)
2915 n = i + binding->
uriLen + prefixLen;
2920 return XML_ERROR_NO_MEMORY;
2922 memcpy(uri, binding->
uri, binding->
uriLen *
sizeof(XML_Char));
2931 memcpy(uri, localPart, i *
sizeof(XML_Char));
2936 memcpy(uri + 1, binding->
prefix->
name, prefixLen *
sizeof(XML_Char));
2938 tagNamePtr->
str = binding->
uri;
2939 return XML_ERROR_NONE;
2945 static enum XML_Error
2947 const XML_Char *uri,
BINDING **bindingsPtr)
2949 static const XML_Char xmlNamespace[] = {
2950 ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
2951 ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
2952 ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L,
2953 ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH,
2954 ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c,
2957 static const int xmlLen =
2958 (int)
sizeof(xmlNamespace)/
sizeof(XML_Char) - 1;
2959 static const XML_Char xmlnsNamespace[] = {
2960 ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
2961 ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
2962 ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0,
2963 ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s,
2966 static const int xmlnsLen =
2967 (int)
sizeof(xmlnsNamespace)/
sizeof(XML_Char) - 1;
2969 XML_Bool mustBeXML = XML_FALSE;
2970 XML_Bool isXML = XML_TRUE;
2971 XML_Bool isXMLNS = XML_TRUE;
2977 if (*uri ==
XML_T(
'\0') && prefix->
name)
2978 return XML_ERROR_UNDECLARING_PREFIX;
2989 return XML_ERROR_RESERVED_PREFIX_XMLNS;
2992 mustBeXML = XML_TRUE;
2995 for (len = 0; uri[len]; len++) {
2996 if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len]))
2999 if (!mustBeXML && isXMLNS
3000 && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
3001 isXMLNS = XML_FALSE;
3003 isXML = isXML && len == xmlLen;
3004 isXMLNS = isXMLNS && len == xmlnsLen;
3006 if (mustBeXML != isXML)
3007 return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML
3008 : XML_ERROR_RESERVED_NAMESPACE_URI;
3011 return XML_ERROR_RESERVED_NAMESPACE_URI;
3021 return XML_ERROR_NO_MEMORY;
3030 return XML_ERROR_NO_MEMORY;
3034 return XML_ERROR_NO_MEMORY;
3039 memcpy(b->
uri, uri, len *
sizeof(XML_Char));
3046 if (*uri ==
XML_T(
'\0') && prefix == &
_dtd->defaultPrefix)
3056 return XML_ERROR_NONE;
3062 static enum XML_Error PTRCALL
3066 const char **endPtr)
3070 if (result != XML_ERROR_NONE)
3088 static enum XML_Error
3090 const ENCODING *enc,
3091 const char **startPtr,
3093 const char **nextPtr,
3096 const char *
s = *startPtr;
3097 const char **eventPP;
3098 const char **eventEndPP;
3113 int tok = XmlCdataSectionTok(enc, s, end, &next);
3116 case XML_TOK_CDATA_SECT_CLOSE:
3129 return XML_ERROR_ABORTED;
3131 return XML_ERROR_NONE;
3132 case XML_TOK_DATA_NEWLINE:
3140 case XML_TOK_DATA_CHARS:
3143 if (charDataHandler) {
3159 (
int)((XML_Char *)next - (XML_Char *)s));
3165 case XML_TOK_INVALID:
3167 return XML_ERROR_INVALID_TOKEN;
3168 case XML_TOK_PARTIAL_CHAR:
3171 return XML_ERROR_NONE;
3173 return XML_ERROR_PARTIAL_CHAR;
3174 case XML_TOK_PARTIAL:
3178 return XML_ERROR_NONE;
3180 return XML_ERROR_UNCLOSED_CDATA_SECTION;
3183 return XML_ERROR_UNEXPECTED_STATE;
3186 *eventPP = s = next;
3190 return XML_ERROR_NONE;
3192 return XML_ERROR_ABORTED;
3204 static enum XML_Error PTRCALL
3205 ignoreSectionProcessor(XML_Parser parser,
3208 const char **endPtr)
3210 enum XML_Error result = doIgnoreSection(parser,
encoding, &start, end,
3212 if (result != XML_ERROR_NONE)
3224 static enum XML_Error
3225 doIgnoreSection(XML_Parser parser,
3226 const ENCODING *enc,
3227 const char **startPtr,
3229 const char **nextPtr,
3234 const char *
s = *startPtr;
3235 const char **eventPP;
3236 const char **eventEndPP;
3248 tok = XmlIgnoreSectionTok(enc, s, end, &next);
3251 case XML_TOK_IGNORE_SECT:
3257 return XML_ERROR_ABORTED;
3259 return XML_ERROR_NONE;
3260 case XML_TOK_INVALID:
3262 return XML_ERROR_INVALID_TOKEN;
3263 case XML_TOK_PARTIAL_CHAR:
3266 return XML_ERROR_NONE;
3268 return XML_ERROR_PARTIAL_CHAR;
3269 case XML_TOK_PARTIAL:
3273 return XML_ERROR_NONE;
3275 return XML_ERROR_SYNTAX;
3278 return XML_ERROR_UNEXPECTED_STATE;
3285 static enum XML_Error
3290 char encodingBuf[128];
3296 if (i ==
sizeof(encodingBuf) - 1
3298 encodingBuf[0] =
'\0';
3303 encodingBuf[i] =
'\0';
3310 return XML_ERROR_NONE;
3314 static enum XML_Error
3316 const char *s,
const char *next)
3318 const char *encodingName = NULL;
3319 const XML_Char *storedEncName = NULL;
3320 const ENCODING *newEncoding = NULL;
3321 const char *version = NULL;
3322 const char *versionend;
3323 const XML_Char *storedversion = NULL;
3324 int standalone = -1;
3327 : XmlParseXmlDecl)(isGeneralTextEntity,
3337 if (isGeneralTextEntity)
3338 return XML_ERROR_TEXT_DECL;
3340 return XML_ERROR_XML_DECL;
3342 if (!isGeneralTextEntity && standalone == 1) {
3343 _dtd->standalone = XML_TRUE;
3345 if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
3346 paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
3350 if (encodingName != NULL) {
3355 + XmlNameLength(
encoding, encodingName));
3357 return XML_ERROR_NO_MEMORY;
3364 versionend -
encoding->minBytesPerChar);
3366 return XML_ERROR_NO_MEMORY;
3374 if (newEncoding->minBytesPerChar !=
encoding->minBytesPerChar) {
3376 return XML_ERROR_INCORRECT_ENCODING;
3380 else if (encodingName) {
3381 enum XML_Error result;
3382 if (!storedEncName) {
3385 encodingName + XmlNameLength(
encoding, encodingName));
3387 return XML_ERROR_NO_MEMORY;
3391 if (result == XML_ERROR_UNKNOWN_ENCODING)
3397 if (storedEncName || storedversion)
3400 return XML_ERROR_NONE;
3403 static enum XML_Error
3409 for (i = 0; i < 256; i++)
3411 info.convert = NULL;
3413 info.release = NULL;
3420 info.release(info.data);
3421 return XML_ERROR_NO_MEMORY;
3433 return XML_ERROR_NONE;
3436 if (info.release != NULL)
3437 info.release(info.data);
3439 return XML_ERROR_UNKNOWN_ENCODING;
3442 static enum XML_Error PTRCALL
3446 const char **nextPtr)
3449 if (result != XML_ERROR_NONE)
3457 static enum XML_Error PTRCALL
3458 externalParEntInitProcessor(XML_Parser parser,
3461 const char **nextPtr)
3464 if (result != XML_ERROR_NONE)
3469 _dtd->paramEntityRead = XML_TRUE;
3473 return entityValueInitProcessor(parser, s, end, nextPtr);
3477 return externalParEntProcessor(parser, s, end, nextPtr);
3481 static enum XML_Error PTRCALL
3482 entityValueInitProcessor(XML_Parser parser,
3485 const char **nextPtr)
3488 const char *start =
s;
3489 const char *next = start;
3493 tok = XmlPrologTok(
encoding, start, end, &next);
3498 return XML_ERROR_NONE;
3501 case XML_TOK_INVALID:
3502 return XML_ERROR_INVALID_TOKEN;
3503 case XML_TOK_PARTIAL:
3504 return XML_ERROR_UNCLOSED_TOKEN;
3505 case XML_TOK_PARTIAL_CHAR:
3506 return XML_ERROR_PARTIAL_CHAR;
3514 else if (tok == XML_TOK_XML_DECL) {
3515 enum XML_Error result;
3517 if (result != XML_ERROR_NONE)
3522 return XML_ERROR_NONE;
3524 return XML_ERROR_ABORTED;
3530 return entityValueProcessor(parser, next, end, nextPtr);
3541 return XML_ERROR_NONE;
3548 static enum XML_Error PTRCALL
3549 externalParEntProcessor(XML_Parser parser,
3552 const char **nextPtr)
3554 const char *next =
s;
3557 tok = XmlPrologTok(
encoding, s, end, &next);
3561 return XML_ERROR_NONE;
3564 case XML_TOK_INVALID:
3565 return XML_ERROR_INVALID_TOKEN;
3566 case XML_TOK_PARTIAL:
3567 return XML_ERROR_UNCLOSED_TOKEN;
3568 case XML_TOK_PARTIAL_CHAR:
3569 return XML_ERROR_PARTIAL_CHAR;
3579 else if (tok == XML_TOK_BOM) {
3581 tok = XmlPrologTok(
encoding, s, end, &next);
3589 static enum XML_Error PTRCALL
3590 entityValueProcessor(XML_Parser parser,
3593 const char **nextPtr)
3595 const char *start =
s;
3596 const char *next =
s;
3601 tok = XmlPrologTok(enc, start, end, &next);
3605 return XML_ERROR_NONE;
3608 case XML_TOK_INVALID:
3609 return XML_ERROR_INVALID_TOKEN;
3610 case XML_TOK_PARTIAL:
3611 return XML_ERROR_UNCLOSED_TOKEN;
3612 case XML_TOK_PARTIAL_CHAR:
3613 return XML_ERROR_PARTIAL_CHAR;
3627 static enum XML_Error PTRCALL
3631 const char **nextPtr)
3633 const char *next =
s;
3634 int tok = XmlPrologTok(
encoding, s, end, &next);
3639 static enum XML_Error
3641 const ENCODING *enc,
3646 const char **nextPtr,
3650 static const XML_Char externalSubsetName[] = { ASCII_HASH ,
'\0' };
3652 static const XML_Char atypeCDATA[] =
3653 { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A,
'\0' };
3654 static const XML_Char atypeID[] = { ASCII_I, ASCII_D,
'\0' };
3655 static const XML_Char atypeIDREF[] =
3656 { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F,
'\0' };
3657 static const XML_Char atypeIDREFS[] =
3658 { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S,
'\0' };
3659 static const XML_Char atypeENTITY[] =
3660 { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y,
'\0' };
3661 static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N,
3662 ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S,
'\0' };
3663 static const XML_Char atypeNMTOKEN[] = {
3664 ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N,
'\0' };
3665 static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T,
3666 ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S,
'\0' };
3667 static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T,
3668 ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN,
'\0' };
3669 static const XML_Char enumValueSep[] = { ASCII_PIPE,
'\0' };
3670 static const XML_Char enumValueStart[] = { ASCII_LPAREN,
'\0' };
3675 const char **eventPP;
3676 const char **eventEndPP;
3677 enum XML_Content_Quant quant;
3690 XML_Bool handleDefault = XML_TRUE;
3694 if (haveMore && tok != XML_TOK_INVALID) {
3696 return XML_ERROR_NONE;
3699 case XML_TOK_INVALID:
3701 return XML_ERROR_INVALID_TOKEN;
3702 case XML_TOK_PARTIAL:
3703 return XML_ERROR_UNCLOSED_TOKEN;
3704 case XML_TOK_PARTIAL_CHAR:
3705 return XML_ERROR_PARTIAL_CHAR;
3711 return XML_ERROR_NONE;
3717 if (isParamEntity || enc !=
encoding) {
3718 if (XmlTokenRole(&
prologState, XML_TOK_NONE, end, end, enc)
3720 return XML_ERROR_INCOMPLETE_PE;
3722 return XML_ERROR_NONE;
3725 return XML_ERROR_NO_ELEMENTS;
3732 role = XmlTokenRole(&
prologState, tok, s, next, enc);
3734 case XML_ROLE_XML_DECL:
3737 if (result != XML_ERROR_NONE)
3740 handleDefault = XML_FALSE;
3743 case XML_ROLE_DOCTYPE_NAME:
3747 return XML_ERROR_NO_MEMORY;
3750 handleDefault = XML_FALSE;
3754 case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:
3760 handleDefault = XML_FALSE;
3764 case XML_ROLE_TEXT_DECL:
3767 if (result != XML_ERROR_NONE)
3770 handleDefault = XML_FALSE;
3774 case XML_ROLE_DOCTYPE_PUBLIC_ID:
3776 useForeignDTD = XML_FALSE;
3781 return XML_ERROR_NO_MEMORY;
3785 if (!XmlIsPublicId(enc, s, next, eventPP))
3786 return XML_ERROR_PUBLICID;
3788 s + enc->minBytesPerChar,
3789 next - enc->minBytesPerChar);
3791 return XML_ERROR_NO_MEMORY;
3794 handleDefault = XML_FALSE;
3795 goto alreadyChecked;
3798 case XML_ROLE_ENTITY_PUBLIC_ID:
3799 if (!XmlIsPublicId(enc, s, next, eventPP))
3800 return XML_ERROR_PUBLICID;
3805 s + enc->minBytesPerChar,
3806 next - enc->minBytesPerChar);
3808 return XML_ERROR_NO_MEMORY;
3813 handleDefault = XML_FALSE;
3816 case XML_ROLE_DOCTYPE_CLOSE:
3821 handleDefault = XML_FALSE;
3836 return XML_ERROR_NO_MEMORY;
3839 dtd->paramEntityRead = XML_FALSE;
3845 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
3846 if (dtd->paramEntityRead) {
3850 return XML_ERROR_NOT_STANDALONE;
3859 useForeignDTD = XML_FALSE;
3864 handleDefault = XML_FALSE;
3867 case XML_ROLE_INSTANCE_START:
3872 if (useForeignDTD) {
3880 return XML_ERROR_NO_MEMORY;
3882 dtd->paramEntityRead = XML_FALSE;
3888 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
3889 if (dtd->paramEntityRead) {
3893 return XML_ERROR_NOT_STANDALONE;
3906 case XML_ROLE_ATTLIST_ELEMENT_NAME:
3909 return XML_ERROR_NO_MEMORY;
3910 goto checkAttListDeclHandler;
3911 case XML_ROLE_ATTRIBUTE_NAME:
3914 return XML_ERROR_NO_MEMORY;
3918 goto checkAttListDeclHandler;
3919 case XML_ROLE_ATTRIBUTE_TYPE_CDATA:
3922 goto checkAttListDeclHandler;
3923 case XML_ROLE_ATTRIBUTE_TYPE_ID:
3926 goto checkAttListDeclHandler;
3927 case XML_ROLE_ATTRIBUTE_TYPE_IDREF:
3929 goto checkAttListDeclHandler;
3930 case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:
3932 goto checkAttListDeclHandler;
3933 case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:
3935 goto checkAttListDeclHandler;
3936 case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:
3938 goto checkAttListDeclHandler;
3939 case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:
3941 goto checkAttListDeclHandler;
3942 case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:
3944 checkAttListDeclHandler:
3946 handleDefault = XML_FALSE;
3948 case XML_ROLE_ATTRIBUTE_ENUM_VALUE:
3949 case XML_ROLE_ATTRIBUTE_NOTATION_VALUE:
3953 prefix = enumValueSep;
3956 prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE
3961 return XML_ERROR_NO_MEMORY;
3963 return XML_ERROR_NO_MEMORY;
3965 handleDefault = XML_FALSE;
3968 case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
3969 case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
3974 return XML_ERROR_NO_MEMORY;
3982 return XML_ERROR_NO_MEMORY;
3989 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);
3991 handleDefault = XML_FALSE;
3995 case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
3996 case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
3998 const XML_Char *attVal;
3999 enum XML_Error result =
4001 s + enc->minBytesPerChar,
4002 next - enc->minBytesPerChar,
4011 return XML_ERROR_NO_MEMORY;
4019 return XML_ERROR_NO_MEMORY;
4027 role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);
4029 handleDefault = XML_FALSE;
4033 case XML_ROLE_ENTITY_VALUE:
4036 s + enc->minBytesPerChar,
4037 next - enc->minBytesPerChar);
4050 handleDefault = XML_FALSE;
4055 if (result != XML_ERROR_NONE)
4059 case XML_ROLE_DOCTYPE_SYSTEM_ID:
4061 useForeignDTD = XML_FALSE;
4066 s + enc->minBytesPerChar,
4067 next - enc->minBytesPerChar);
4069 return XML_ERROR_NO_MEMORY;
4071 handleDefault = XML_FALSE;
4081 && !paramEntityParsing
4085 return XML_ERROR_NOT_STANDALONE;
4094 return XML_ERROR_NO_MEMORY;
4099 case XML_ROLE_ENTITY_SYSTEM_ID:
4102 s + enc->minBytesPerChar,
4103 next - enc->minBytesPerChar);
4105 return XML_ERROR_NO_MEMORY;
4109 handleDefault = XML_FALSE;
4112 case XML_ROLE_ENTITY_COMPLETE:
4123 handleDefault = XML_FALSE;
4126 case XML_ROLE_ENTITY_NOTATION_NAME:
4130 return XML_ERROR_NO_MEMORY;
4140 handleDefault = XML_FALSE;
4151 handleDefault = XML_FALSE;
4155 case XML_ROLE_GENERAL_ENTITY_NAME:
4157 if (XmlPredefinedEntityName(enc, s, next)) {
4164 return XML_ERROR_NO_MEMORY;
4168 return XML_ERROR_NO_MEMORY;
4182 handleDefault = XML_FALSE;
4191 case XML_ROLE_PARAM_ENTITY_NAME:
4196 return XML_ERROR_NO_MEMORY;
4200 return XML_ERROR_NO_MEMORY;
4214 handleDefault = XML_FALSE;
4225 case XML_ROLE_NOTATION_NAME:
4231 return XML_ERROR_NO_MEMORY;
4233 handleDefault = XML_FALSE;
4236 case XML_ROLE_NOTATION_PUBLIC_ID:
4237 if (!XmlIsPublicId(enc, s, next, eventPP))
4238 return XML_ERROR_PUBLICID;
4242 s + enc->minBytesPerChar,
4243 next - enc->minBytesPerChar);
4245 return XML_ERROR_NO_MEMORY;
4249 handleDefault = XML_FALSE;
4252 case XML_ROLE_NOTATION_SYSTEM_ID:
4254 const XML_Char *systemId
4256 s + enc->minBytesPerChar,
4257 next - enc->minBytesPerChar);
4259 return XML_ERROR_NO_MEMORY;
4266 handleDefault = XML_FALSE;
4270 case XML_ROLE_NOTATION_NO_SYSTEM_ID:
4278 handleDefault = XML_FALSE;
4282 case XML_ROLE_ERROR:
4284 case XML_TOK_PARAM_ENTITY_REF:
4287 return XML_ERROR_PARAM_ENTITY_REF;
4288 case XML_TOK_XML_DECL:
4289 return XML_ERROR_MISPLACED_XML_PI;
4291 return XML_ERROR_SYNTAX;
4294 case XML_ROLE_IGNORE_SECT:
4296 enum XML_Error result;
4299 handleDefault = XML_FALSE;
4300 result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore);
4301 if (result != XML_ERROR_NONE)
4310 case XML_ROLE_GROUP_OPEN:
4315 return XML_ERROR_NO_MEMORY;
4321 return XML_ERROR_NO_MEMORY;
4328 return XML_ERROR_NO_MEMORY;
4335 return XML_ERROR_NO_MEMORY;
4340 handleDefault = XML_FALSE;
4343 case XML_ROLE_GROUP_SEQUENCE:
4345 return XML_ERROR_SYNTAX;
4348 handleDefault = XML_FALSE;
4350 case XML_ROLE_GROUP_CHOICE:
4352 return XML_ERROR_SYNTAX;
4361 handleDefault = XML_FALSE;
4365 case XML_ROLE_PARAM_ENTITY_REF:
4367 case XML_ROLE_INNER_PARAM_ENTITY_REF:
4369 if (!paramEntityParsing)
4372 const XML_Char *
name;
4375 s + enc->minBytesPerChar,
4376 next - enc->minBytesPerChar);
4378 return XML_ERROR_NO_MEMORY;
4379 entity = (
ENTITY *)
lookup(&dtd->paramEntities, name, 0);
4390 return XML_ERROR_UNDEFINED_ENTITY;
4392 return XML_ERROR_ENTITY_DECLARED_IN_PE;
4399 handleDefault = XML_FALSE;
4404 return XML_ERROR_RECURSIVE_ENTITY_REF;
4406 enum XML_Error result;
4407 XML_Bool betweenDecl =
4408 (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE);
4410 if (result != XML_ERROR_NONE)
4412 handleDefault = XML_FALSE;
4416 dtd->paramEntityRead = XML_FALSE;
4417 entity->
open = XML_TRUE;
4423 entity->
open = XML_FALSE;
4424 return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
4426 entity->
open = XML_FALSE;
4427 handleDefault = XML_FALSE;
4428 if (!dtd->paramEntityRead) {
4442 return XML_ERROR_NOT_STANDALONE;
4447 case XML_ROLE_ELEMENT_NAME:
4451 return XML_ERROR_NO_MEMORY;
4455 handleDefault = XML_FALSE;
4459 case XML_ROLE_CONTENT_ANY:
4460 case XML_ROLE_CONTENT_EMPTY:
4463 XML_Content * content = (XML_Content *)
MALLOC(
sizeof(XML_Content));
4465 return XML_ERROR_NO_MEMORY;
4466 content->quant = XML_CQUANT_NONE;
4467 content->name = NULL;
4468 content->numchildren = 0;
4469 content->children = NULL;
4470 content->type = ((role == XML_ROLE_CONTENT_ANY) ?
4475 handleDefault = XML_FALSE;
4481 case XML_ROLE_CONTENT_PCDATA:
4486 handleDefault = XML_FALSE;
4490 case XML_ROLE_CONTENT_ELEMENT:
4491 quant = XML_CQUANT_NONE;
4492 goto elementContent;
4493 case XML_ROLE_CONTENT_ELEMENT_OPT:
4494 quant = XML_CQUANT_OPT;
4495 goto elementContent;
4496 case XML_ROLE_CONTENT_ELEMENT_REP:
4497 quant = XML_CQUANT_REP;
4498 goto elementContent;
4499 case XML_ROLE_CONTENT_ELEMENT_PLUS:
4500 quant = XML_CQUANT_PLUS;
4504 const XML_Char *
name;
4506 const char *nxt = (quant == XML_CQUANT_NONE
4508 : next - enc->minBytesPerChar);
4511 return XML_ERROR_NO_MEMORY;
4516 return XML_ERROR_NO_MEMORY;
4520 for (; name[nameLen++]; );
4523 handleDefault = XML_FALSE;
4527 case XML_ROLE_GROUP_CLOSE:
4528 quant = XML_CQUANT_NONE;
4530 case XML_ROLE_GROUP_CLOSE_OPT:
4531 quant = XML_CQUANT_OPT;
4533 case XML_ROLE_GROUP_CLOSE_REP:
4534 quant = XML_CQUANT_REP;
4536 case XML_ROLE_GROUP_CLOSE_PLUS:
4537 quant = XML_CQUANT_PLUS;
4541 handleDefault = XML_FALSE;
4545 if (!handleDefault) {
4548 return XML_ERROR_NO_MEMORY;
4561 return XML_ERROR_NO_MEMORY;
4562 handleDefault = XML_FALSE;
4564 case XML_ROLE_COMMENT:
4566 return XML_ERROR_NO_MEMORY;
4567 handleDefault = XML_FALSE;
4572 handleDefault = XML_FALSE;
4576 case XML_ROLE_DOCTYPE_NONE:
4578 handleDefault = XML_FALSE;
4580 case XML_ROLE_ENTITY_NONE:
4582 handleDefault = XML_FALSE;
4584 case XML_ROLE_NOTATION_NONE:
4586 handleDefault = XML_FALSE;
4588 case XML_ROLE_ATTLIST_NONE:
4590 handleDefault = XML_FALSE;
4592 case XML_ROLE_ELEMENT_NONE:
4594 handleDefault = XML_FALSE;
4604 return XML_ERROR_NONE;
4606 return XML_ERROR_ABORTED;
4609 tok = XmlPrologTok(enc, s, end, &next);
4615 static enum XML_Error PTRCALL
4619 const char **nextPtr)
4624 const char *next = NULL;
4625 int tok = XmlPrologTok(
encoding, s, end, &next);
4629 case -XML_TOK_PROLOG_S:
4633 return XML_ERROR_ABORTED;
4636 return XML_ERROR_NONE;
4639 return XML_ERROR_NONE;
4640 case XML_TOK_PROLOG_S:
4646 return XML_ERROR_NO_MEMORY;
4648 case XML_TOK_COMMENT:
4650 return XML_ERROR_NO_MEMORY;
4652 case XML_TOK_INVALID:
4654 return XML_ERROR_INVALID_TOKEN;
4655 case XML_TOK_PARTIAL:
4658 return XML_ERROR_NONE;
4660 return XML_ERROR_UNCLOSED_TOKEN;
4661 case XML_TOK_PARTIAL_CHAR:
4664 return XML_ERROR_NONE;
4666 return XML_ERROR_PARTIAL_CHAR;
4668 return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
4674 return XML_ERROR_NONE;
4676 return XML_ERROR_ABORTED;
4682 static enum XML_Error
4684 XML_Bool betweenDecl)
4686 const char *textStart, *textEnd;
4688 enum XML_Error result;
4698 return XML_ERROR_NO_MEMORY;
4700 entity->
open = XML_TRUE;
4704 openEntity->
entity = entity;
4709 textStart = (
char *)entity->
textPtr;
4716 next, &next, XML_FALSE);
4721 textEnd, &next, XML_FALSE);
4723 if (result == XML_ERROR_NONE) {
4724 if (textEnd != next &&
ps_parsing == XML_SUSPENDED) {
4725 entity->
processed = (int)(next - textStart);
4729 entity->
open = XML_FALSE;
4739 static enum XML_Error PTRCALL
4743 const char **nextPtr)
4746 const char *textStart, *textEnd;
4748 enum XML_Error result;
4751 return XML_ERROR_UNEXPECTED_STATE;
4753 entity = openEntity->
entity;
4761 next, &next, XML_FALSE);
4766 textStart, textEnd, &next, XML_FALSE);
4768 if (result != XML_ERROR_NONE)
4770 else if (textEnd != next &&
ps_parsing == XML_SUSPENDED) {
4775 entity->
open = XML_FALSE;
4786 tok = XmlPrologTok(
encoding, s, end, &next);
4800 static enum XML_Error PTRCALL
4804 const char **nextPtr)
4809 static enum XML_Error
4811 const char *ptr,
const char *end,
4821 return XML_ERROR_NO_MEMORY;
4822 return XML_ERROR_NONE;
4825 static enum XML_Error
4827 const char *ptr,
const char *end,
4833 int tok = XmlAttributeValueTok(enc, ptr, end, &next);
4836 return XML_ERROR_NONE;
4837 case XML_TOK_INVALID:
4840 return XML_ERROR_INVALID_TOKEN;
4841 case XML_TOK_PARTIAL:
4844 return XML_ERROR_INVALID_TOKEN;
4845 case XML_TOK_CHAR_REF:
4849 int n = XmlCharRefNumber(enc, ptr);
4853 return XML_ERROR_BAD_CHAR_REF;
4863 return XML_ERROR_BAD_CHAR_REF;
4865 for (i = 0; i <
n; i++) {
4867 return XML_ERROR_NO_MEMORY;
4871 case XML_TOK_DATA_CHARS:
4873 return XML_ERROR_NO_MEMORY;
4875 case XML_TOK_TRAILING_CR:
4876 next = ptr + enc->minBytesPerChar;
4878 case XML_TOK_ATTRIBUTE_VALUE_S:
4879 case XML_TOK_DATA_NEWLINE:
4883 return XML_ERROR_NO_MEMORY;
4885 case XML_TOK_ENTITY_REF:
4887 const XML_Char *
name;
4889 char checkEntityDecl;
4890 XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
4891 ptr + enc->minBytesPerChar,
4892 next - enc->minBytesPerChar);
4895 return XML_ERROR_NO_MEMORY;
4899 ptr + enc->minBytesPerChar,
4900 next - enc->minBytesPerChar);
4902 return XML_ERROR_NO_MEMORY;
4908 if (pool == &dtd->
pool)
4918 if (checkEntityDecl) {
4920 return XML_ERROR_UNDEFINED_ENTITY;
4922 return XML_ERROR_ENTITY_DECLARED_IN_PE;
4940 return XML_ERROR_RECURSIVE_ENTITY_REF;
4945 return XML_ERROR_BINARY_ENTITY_REF;
4950 return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
4953 enum XML_Error result;
4955 entity->
open = XML_TRUE;
4958 (
char *)textEnd, pool);
4959 entity->
open = XML_FALSE;
4968 return XML_ERROR_UNEXPECTED_STATE;
4975 static enum XML_Error
4977 const ENCODING *enc,
4978 const char *entityTextPtr,
4979 const char *entityTextEnd)
4983 enum XML_Error result = XML_ERROR_NONE;
4993 return XML_ERROR_NO_MEMORY;
4998 int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
5000 case XML_TOK_PARAM_ENTITY_REF:
5002 if (isParamEntity || enc !=
encoding) {
5003 const XML_Char *
name;
5006 entityTextPtr + enc->minBytesPerChar,
5007 next - enc->minBytesPerChar);
5009 result = XML_ERROR_NO_MEMORY;
5010 goto endEntityValue;
5012 entity = (
ENTITY *)
lookup(&dtd->paramEntities, name, 0);
5022 goto endEntityValue;
5027 result = XML_ERROR_RECURSIVE_ENTITY_REF;
5028 goto endEntityValue;
5032 dtd->paramEntityRead = XML_FALSE;
5033 entity->
open = XML_TRUE;
5039 entity->
open = XML_FALSE;
5040 result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
5041 goto endEntityValue;
5043 entity->
open = XML_FALSE;
5044 if (!dtd->paramEntityRead)
5051 entity->
open = XML_TRUE;
5057 entity->
open = XML_FALSE;
5059 goto endEntityValue;
5067 result = XML_ERROR_PARAM_ENTITY_REF;
5068 goto endEntityValue;
5070 result = XML_ERROR_NONE;
5071 goto endEntityValue;
5072 case XML_TOK_ENTITY_REF:
5073 case XML_TOK_DATA_CHARS:
5074 if (!
poolAppend(pool, enc, entityTextPtr, next)) {
5075 result = XML_ERROR_NO_MEMORY;
5076 goto endEntityValue;
5079 case XML_TOK_TRAILING_CR:
5080 next = entityTextPtr + enc->minBytesPerChar;
5082 case XML_TOK_DATA_NEWLINE:
5084 result = XML_ERROR_NO_MEMORY;
5085 goto endEntityValue;
5087 *(pool->
ptr)++ = 0xA;
5089 case XML_TOK_CHAR_REF:
5093 int n = XmlCharRefNumber(enc, entityTextPtr);
5097 result = XML_ERROR_BAD_CHAR_REF;
5098 goto endEntityValue;
5104 result = XML_ERROR_BAD_CHAR_REF;
5105 goto endEntityValue;
5107 for (i = 0; i <
n; i++) {
5109 result = XML_ERROR_NO_MEMORY;
5110 goto endEntityValue;
5112 *(pool->
ptr)++ = buf[i];
5116 case XML_TOK_PARTIAL:
5119 result = XML_ERROR_INVALID_TOKEN;
5120 goto endEntityValue;
5121 case XML_TOK_INVALID:
5124 result = XML_ERROR_INVALID_TOKEN;
5125 goto endEntityValue;
5129 result = XML_ERROR_UNEXPECTED_STATE;
5130 goto endEntityValue;
5132 entityTextPtr = next;
5141 static void FASTCALL
5146 if (*s ==
XML_T(
'\0'))
5166 const char *start,
const char *end)
5168 const XML_Char *target;
5176 start += enc->minBytesPerChar * 2;
5177 tem = start + XmlNameLength(enc, start);
5184 end - enc->minBytesPerChar*2);
5195 const char *start,
const char *end)
5205 start + enc->minBytesPerChar * 4,
5206 end - enc->minBytesPerChar * 3);
5217 const char *s,
const char *end)
5220 const char **eventPP;
5221 const char **eventEndPP;
5245 XML_Bool isId,
const XML_Char *value, XML_Parser parser)
5248 if (value || isId) {
5256 type->
idAtt = attId;
5291 const XML_Char *
name;
5292 for (name = elementType->
name; *name; name++) {
5293 if (*name ==
XML_T(ASCII_COLON)) {
5296 for (s = elementType->
name; s != name; s++) {
5310 elementType->
prefix = prefix;
5319 const char *start,
const char *end)
5323 const XML_Char *
name;
5334 if (id->
name != name)
5340 else if (name[0] ==
XML_T(ASCII_x)
5341 && name[1] ==
XML_T(ASCII_m)
5342 && name[2] ==
XML_T(ASCII_l)
5343 && name[3] ==
XML_T(ASCII_n)
5344 && name[4] ==
XML_T(ASCII_s)
5345 && (name[5] ==
XML_T(
'\0') || name[5] ==
XML_T(ASCII_COLON))) {
5346 if (name[5] ==
XML_T(
'\0'))
5350 id->xmlns = XML_TRUE;
5354 for (i = 0; name[i]; i++) {
5356 if (name[i] ==
XML_T(ASCII_COLON)) {
5358 for (j = 0; j < i; j++) {
5378 #define CONTEXT_SEP XML_T(ASCII_FF)
5380 static const XML_Char *
5385 XML_Bool needSep = XML_FALSE;
5395 for (i = 0; i < len; i++)
5413 for (s = prefix->
name; *s; s++)
5421 for (i = 0; i < len; i++)
5438 for (s = e->
name; *s; s++)
5453 const XML_Char *s = context;
5455 while (*context !=
XML_T(
'\0')) {
5463 if (*s !=
XML_T(
'\0'))
5468 else if (*s ==
XML_T(ASCII_EQUALS)) {
5486 for (context = s + 1;
5497 if (*context !=
XML_T(
'\0'))
5510 static void FASTCALL
5513 XML_Char *p = publicId;
5515 for (s = publicId; *
s; s++) {
5520 if (p != publicId && p[-1] != 0x20)
5527 if (p != publicId && p[-1] == 0x20)
5535 DTD *p = (
DTD *)ms->malloc_fcn(
sizeof(
DTD));
5545 p->paramEntityRead = XML_FALSE;
5579 p->paramEntityRead = XML_FALSE;
5647 const XML_Char *
name;
5664 const XML_Char *
name;
5698 const XML_Char *
name;
5748 &(oldDtd->paramEntities)))
5750 newDtd->paramEntityRead = oldDtd->paramEntityRead;
5774 const XML_Char *cachedOldBase = NULL;
5775 const XML_Char *cachedNewBase = NULL;
5781 const XML_Char *
name;
5797 if (oldE->
base == cachedOldBase)
5798 newE->
base = cachedNewBase;
5800 cachedOldBase = oldE->
base;
5804 cachedNewBase = newE->
base = tem;
5834 #define INIT_POWER 6
5836 static XML_Bool FASTCALL
5839 for (; *s1 == *s2; s1++, s2++)
5845 static unsigned long FASTCALL
5848 unsigned long h = 0;
5858 if (table->
size == 0) {
5866 table->
v = (
NAMED **)table->
mem->malloc_fcn(tsize);
5871 memset(table->
v, 0, tsize);
5872 i =
hash(name) & ((
unsigned long)table->
size - 1);
5875 unsigned long h =
hash(name);
5876 unsigned long mask = (
unsigned long)table->
size - 1;
5877 unsigned char step = 0;
5879 while (table->
v[i]) {
5884 i < step ? (i += table->
size - step) : (i -= step);
5890 if (table->
used >> (table->
power - 1)) {
5891 unsigned char newPower = table->
power + 1;
5892 size_t newSize = (size_t)1 << newPower;
5893 unsigned long newMask = (
unsigned long)newSize - 1;
5894 size_t tsize = newSize *
sizeof(
NAMED *);
5898 memset(newV, 0, tsize);
5899 for (i = 0; i < table->
size; i++)
5901 unsigned long newHash =
hash(table->
v[i]->
name);
5902 size_t j = newHash & newMask;
5906 step =
PROBE_STEP(newHash, newMask, newPower);
5907 j < step ? (j += newSize - step) : (j -= step);
5909 newV[j] = table->
v[i];
5911 table->
mem->free_fcn(table->
v);
5913 table->
power = newPower;
5914 table->
size = newSize;
5917 while (table->
v[i]) {
5920 i < step ? (i += newSize - step) : (i -= step);
5924 table->
v[i] = (
NAMED *)table->
mem->malloc_fcn(createSize);
5927 memset(table->
v[i], 0, createSize);
5933 static void FASTCALL
5937 for (i = 0; i < table->
size; i++) {
5938 table->
mem->free_fcn(table->
v[i]);
5944 static void FASTCALL
5948 for (i = 0; i < table->
size; i++)
5949 table->
mem->free_fcn(table->
v[i]);
5950 table->
mem->free_fcn(table->
v);
5953 static void FASTCALL
5963 static void FASTCALL
5970 static NAMED * FASTCALL
5973 while (iter->
p != iter->
end) {
5974 NAMED *tem = *(iter->
p)++;
5981 static void FASTCALL
5992 static void FASTCALL
6012 static void FASTCALL
6018 pool->
mem->free_fcn(p);
6024 pool->
mem->free_fcn(p);
6031 const char *ptr,
const char *end)
6045 static const XML_Char * FASTCALL
6057 static const XML_Char *
6062 for (; n > 0; --
n, s++) {
6071 static const XML_Char * FASTCALL
6084 const char *ptr,
const char *end)
6094 static XML_Bool FASTCALL
6098 if (pool->
start == 0) {
6113 (pool->
end - pool->
start) *
sizeof(XML_Char));
6121 int blockSize = (int)(pool->
end - pool->
start)*2;
6125 + blockSize *
sizeof(XML_Char)));
6126 if (pool->
blocks == NULL)
6131 pool->
end = pool->
start + blockSize;
6135 int blockSize = (int)(pool->
end - pool->
start);
6141 + blockSize *
sizeof(XML_Char));
6144 tem->
size = blockSize;
6148 memcpy(tem->
s, pool->
start,
6149 (pool->
ptr - pool->
start) *
sizeof(XML_Char));
6152 pool->
end = tem->
s + blockSize;
6209 XML_Content **contpos,
6215 if (dest->type == XML_CTYPE_NAME) {
6216 const XML_Char *src;
6217 dest->name = *strpos;
6220 *(*strpos)++ = *src;
6225 dest->numchildren = 0;
6226 dest->children = NULL;
6232 dest->children = *contpos;
6233 *contpos += dest->numchildren;
6235 i < dest->numchildren;
6237 build_node(parser, cn, &(dest->children[i]), contpos, strpos);
6243 static XML_Content *
6250 int allocsize = (dtd->
scaffCount *
sizeof(XML_Content)
6253 ret = (XML_Content *)
MALLOC(allocsize);
6266 const ENCODING *enc,
6279 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 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
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 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 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)
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 void FASTCALL hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms)
static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
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
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
static NAMED * lookup(HASH_TABLE *table, KEY name, size_t createSize)
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
static int copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *)
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 int dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
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 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 *)
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
void * realloc(void *__ptr, size_t __size)
static void FASTCALL poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms)
void * malloc(size_t __size)
#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)
static unsigned long FASTCALL hash(KEY s)
#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)