Lines Matching full:code
63 XML parser for the open source Mozilla project, Perl's <code>XML::Parser</code>,
64 Python's <code>xml.parsers.expat</code>, and other open-source XML parsers.
482 <code><a href="#XML_ParserCreate">XML_ParserCreate</a></code>
490 <code><a href="#XML_SetElementHandler">XML_SetElementHandler</a></code>
498 <code><a href=
499 "#XML_SetCharacterDataHandler">XML_SetCharacterDataHandler</a></code>
507 <code><a href="#XML_Parse">XML_Parse</a></code>
528 Finally it increments the global <code>Depth</code> variable.
552 The end tag simply does the bookkeeping work of decrementing <code>Depth</code>.
562 Note the <code>XMLCALL</code> annotation used for the callbacks. This is used to
564 case the compiler options used for Expat itself and the client code are
567 platforms. For code which uses Expat, however, the calling convention is
568 specified by the <code>XMLCALL</code> annotation on most platforms; callbacks
573 The <code>XMLCALL</code> annotation was added in Expat 1.95.7, but existing
620 can use CMake to generate a <code>.sln</code> file, e.g. <code>cmake -G"Visual
621 Studio 17 2022" -DCMAKE_BUILD_TYPE=RelWithDebInfo .</code> , and build Expat
622 using <code>msbuild /m expat.sln</code> after.
652 we'll mention here is the <code>--prefix</code> option. You can find out all the
653 options available by running configure with just the <code>--help</code> option.
658 installed in <code>/usr/local/lib</code> and the associated header file in
659 <code>/usr/local/include</code>. But if you were to give the option,
660 <code>--prefix=/home/me/mystuff</code>, then the library and header would get
661 installed in <code>/home/me/mystuff/lib</code> and
662 <code>/home/me/mystuff/include</code> respectively.
682 entities</a> (syntax <code>&e1;</code> to reference and syntax
683 <code><!ENTITY e1 'value1'></code> (an internal general entity) or
684 <code><!ENTITY e2 SYSTEM 'file2'></code> (an external general entity) to
685 declare). With <code>XML_GE</code> enabled, general entities will be replaced
687 general entities, in addition an <code><a href=
688 "#XML_SetExternalEntityRefHandler">XML_ExternalEntityRefHandler</a></code> must
689 be set using <code><a href=
690 "#XML_SetExternalEntityRefHandler">XML_SetExternalEntityRefHandler</a></code>.
691 Also, enabling <code>XML_GE</code> makes the functions <code><a href=
692 …ProtectionMaximumAmplification">XML_SetBillionLaughsAttackProtectionMaximumAmplification</a></code>
693 and <code><a href=
694 …ckProtectionActivationThreshold">XML_SetBillionLaughsAttackProtectionActivationThreshold</a></code>
696 With <code>XML_GE</code> disabled, Expat has a smaller memory footprint and can
700 five</a>: <code>amp</code>, <code>apos</code>, <code>gt</code>,
701 <code>lt</code>, <code>quot</code>) with a self-reference: for example,
702 referencing an entity <code>e1</code> via <code>&e1;</code> will be
703 replaced by text <code>&e1;</code>.
716 sections. If defined, makes the functions <code><a href=
717 …ProtectionMaximumAmplification">XML_SetBillionLaughsAttackProtectionMaximumAmplification</a></code>
718 and <code><a href=
719 …ckProtectionActivationThreshold">XML_SetBillionLaughsAttackProtectionActivationThreshold</a></code>
739 using wide characters of the type <code>XML_Char</code>. This is implied if
740 <code>XML_UNICODE_WCHAR_T</code> is defined.
748 If defined, causes the <code>XML_Char</code> character type to be defined using
749 the <code>wchar_t</code> type; otherwise, <code>unsigned short</code> is used.
750 Defining this implies <code>XML_UNICODE</code>.
758 If defined, causes the <code>XML_Size</code> and <code>XML_Index</code> integer
760 very large input streams, where the return values of <code><a href=
761 "#XML_GetCurrentByteIndex">XML_GetCurrentByteIndex</a></code>, <code><a href=
762 "#XML_GetCurrentLineNumber">XML_GetCurrentLineNumber</a></code> and
763 <code><a href=
764 "#XML_GetCurrentColumnNumber">XML_GetCurrentColumnNumber</a></code> could
775 available for reporting via <code><a href=
776 "#XML_GetInputContext">XML_GetInputContext</a></code>. This is normally set to
778 the input context will not be available and <code><a href=
779 "#XML_GetInputContext">XML_GetInputContext</a></code> will always report
780 <code>NULL</code>. Without this, Expat has a smaller memory footprint and can
790 the code that calls it; this is required to get all the right MSVC magic
799 If defined, makes the additional function <code><a href=
800 "#XML_GetAttributeInfo">XML_GetAttributeInfo</a></code> available for reporting
818 header (<code>#include <expat.h></code>) in your files that make calls to
820 Unix systems, this would usually be done with the <code>-lexpat</code> argument.
839 If you installed Expat in, say, <code>/home/me/mystuff</code>, then the Makefile
852 You'd also have to set the environment variable <code>LD_LIBRARY_PATH</code> to
853 <code>/home/me/mystuff/lib</code> (or to
854 <code>${LD_LIBRARY_PATH}:/home/me/mystuff/lib</code> if LD_LIBRARY_PATH already
866 However, only two of these (<code><a href=
867 "#XML_ParserCreate">XML_ParserCreate</a></code> and <code><a href=
868 "#XML_ParserCreateNS">XML_ParserCreateNS</a></code>) can be used for constructing
872 must call <code><a href="#XML_ParserFree">XML_ParserFree</a></code>. Note that if
875 <code>XML_ParserFree</code>.
952 code, then in the end handler, we need to manipulate it <em>before</em> the main
964 can then tell Expat (with the <code><a href=
965 "#XML_SetUserData">XML_SetUserData</a></code> function) to pass a pointer to this
968 function is named <code>userData</code> and have type <code>void *</code> if the
969 user data is passed; it will have the type <code>XML_Parser</code> if the parser
971 <code><a href="#XML_GetUserData">XML_GetUserData</a></code>.
977 character data handler (set by <code><a href=
978 "#XML_SetCharacterDataHandler">XML_SetCharacterDataHandler</a></code>) needs to
995 <code>version</code> pseudo-attribute in the XML declaration, if present.
1000 processing), it should use the <code><a href=
1001 "#XML_SetXmlDeclHandler">XML_SetXmlDeclHandler</a></code> function to set a
1003 This example shows how to check that only a version number of <code>"1.0"</code>
1038 When the parser is created using the <code><a href=
1039 "#XML_ParserCreateNS">XML_ParserCreateNS</a></code>, function, Expat performs
1041 <code>xmlns</code> and <code>xmlns:...</code> attributes, which declare
1046 "#XML_SetNamespaceDeclHandler"><code>XML_SetNamespaceDeclHandler</code></a>.
1053 argument to <code><a href="#XML_ParserCreateNS">XML_ParserCreateNS</a></code>),
1062 However if <code><a href=
1063 "#XML_SetReturnNSTriplet">XML_SetReturnNSTriplet</a></code> has been called with
1064 a non-zero <code>do_nst</code> parameter, then the expanded form for names with
1071 a scope of a declaration with the <code><a href=
1072 "#XML_SetNamespaceDeclHandler">XML_SetNamespaceDeclHandler</a></code> function.
1077 be <code>NULL</code>. The URI will be <code>NULL</code> for the case where the
1139 <code>UnknownEncodingHandler</code>. This handler gets passed the encoding name
1140 and a pointer to an <code>XML_Encoding</code> data structure. Your handler must
1141 fill in this structure and return <code>XML_STATUS_OK</code> if it knows how to
1143 <code>XML_STATUS_ERROR</code>. The handler also gets passed a pointer to an
1150 in the <code>XML_Encoding</code> structure. include file:
1172 <code>XML_Encoding</code> contains an array of integers that correspond to the
1178 pointed at in the <code>XML_Encoding</code> structure. This function should
1198 <code>ExternalEntityRefHandler</code>, then external entity references are
1205 responsible for creating a subsidiary parser with <code><a href=
1206 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code> that
1207 will do the job. This returns an instance of <code>XML_Parser</code> that has
1209 then use <code><a href="#XML_Parse">XML_Parse</a></code> or <code><a href=
1210 "#XML_ParseBuffer">XML_ParseBuffer</a></code> calls against this parser. Since
1221 <code><a href="#XML_SetParamEntityParsing">XML_SetParamEntityParsing</a></code>
1227 <code>XML_PARAM_ENTITY_PARSING_NEVER</code>
1235 <code>XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE</code>
1239 Parse parameter entities and the external subset unless <code>standalone</code>
1244 <code>XML_PARAM_ENTITY_PARSING_ALWAYS</code>
1295 structure (in pseudo-code):
1322 This C function could be used for the <code>parse_xml</code> function mentioned
1323 in the pseudo-code above:
1366 The corresponding <code>continue_parsing</code> function is somewhat simpler,
1367 since it only need deal with the return code from <code><a href=
1368 "#XML_ResumeParser">XML_ResumeParser</a></code>; it can delegate the input
1369 handling to the <code>parse_xml</code> function:
1396 we gained? Very simply, we can now use the <code><a href=
1397 "#XML_StopParser">XML_StopParser</a></code> function to stop parsing, without
1404 To stop parsing from a handler function, use the <code><a href=
1405 "#XML_StopParser">XML_StopParser</a></code> function. This function takes two
1432 Construct a new parser. If encoding is non-<code>NULL</code>, it specifies a
1472 <code>'\xFF'</code> is not legal in UTF-8, and <code>'\xFFFF'</code> is not legal
1474 <code>'\0'</code>: the namespace URI and the local part will be concatenated
1509 in <code>ms</code>. If <code>ms</code> is <code>NULL</code>, then use the
1510 standard set of memory management functions. If <code>sep</code> is
1511 non-<code>NULL</code>, then namespace processing is enabled in the created
1529 Construct a new <code>XML_Parser</code> object for parsing an external general
1539 <code><a href=
1540 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code>
1567 <code><a href=
1568 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code>
1586 again. After this has been called, <code>parser</code> is ready to start parsing
1590 created using <code><a href=
1591 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code>; it
1592 will return <code>XML_FALSE</code> in that case. Returns <code>XML_TRUE</code> on
1602 To state the obvious: the three parsing functions <code><a href=
1603 "#XML_Parse">XML_Parse</a></code>, <code><a href=
1604 "#XML_ParseBuffer">XML_ParseBuffer</a></code> and <code><a href=
1605 "#XML_GetBuffer">XML_GetBuffer</a></code> as well as the two cleanup functions
1606 <code><a href="#XML_ParserFree">XML_ParserFree</a></code> and <code><a href=
1607 "#XML_ParserReset">XML_ParserReset</a></code> must not be called from within a
1610 within an <code>XML_ExternalEntityRefHandler</code>, if they apply to the parser
1611 created by <code><a href=
1612 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code>.
1616 Note: The <code>len</code> argument passed to these functions should be
1626 concluding <code><a href="#XML_Parse">XML_Parse</a></code> or <code><a href=
1627 "#XML_ParseBuffer">XML_ParseBuffer</a></code> call with <code>isFinal</code> set
1628 to <code>XML_TRUE</code>.
1651 Parse some more of the document. The string <code>s</code> is a buffer
1653 are part of the document is indicated by <code>len</code>. This means that
1654 <code>s</code> doesn't have to be null-terminated. It also means that if
1655 <code>len</code> is larger than the number of bytes in the block of memory that
1656 <code>s</code> points at, then a memory fault is likely. Negative values for
1657 <code>len</code> are rejected since Expat 2.2.1. The <code>isFinal</code>
1659 Frequently, the last piece is empty (i.e. <code>len</code> is zero.)
1663 If a parse error occurred, it returns <code>XML_STATUS_ERROR</code>. Otherwise
1664 it returns <code>XML_STATUS_OK</code> value. Note that regardless of the return
1671 Simplified, <code>XML_Parse</code> can be considered a convenience wrapper that
1672 is pairing calls to <code><a href="#XML_GetBuffer">XML_GetBuffer</a></code> and
1673 <code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code> (when Expat is
1674 built with macro <code>XML_CONTEXT_BYTES</code> defined to a positive value,
1675 which is both common and default). <code>XML_Parse</code> is then functionally
1676 equivalent to calling <code><a href="#XML_GetBuffer">XML_GetBuffer</a></code>,
1677 <code>memcpy</code>, and <code><a href=
1678 "#XML_ParseBuffer">XML_ParseBuffer</a></code>.
1682 To avoid double copying of the input, direct use of functions <code><a href=
1683 "#XML_GetBuffer">XML_GetBuffer</a></code> and <code><a href=
1684 "#XML_ParseBuffer">XML_ParseBuffer</a></code> is advised for most production
1685 use, e.g. if you're using <code>read</code> or similar functionality to fill
1686 your buffers, fill directly into the buffer from <code><a href=
1687 "#XML_GetBuffer">XML_GetBuffer</a></code>, then parse with <code><a href=
1688 "#XML_ParseBuffer">XML_ParseBuffer</a></code>.
1704 This is just like <code><a href="#XML_Parse">XML_Parse</a></code>, except in
1706 the <code><a href="#XML_GetBuffer">XML_GetBuffer</a></code> function, the
1711 Negative values for <code>len</code> are rejected since Expat 2.6.3.
1725 Obtain a buffer of size <code>len</code> to read a piece of the document into. A
1726 <code>NULL</code> value is returned if Expat can't allocate enough memory for
1727 this buffer. A <code>NULL</code> value may also be returned if <code>len</code>
1728 is zero. This has to be called prior to every call to <code><a href=
1729 "#XML_ParseBuffer">XML_ParseBuffer</a></code>. A typical use would look like
1766 Stops parsing, causing <code><a href="#XML_Parse">XML_Parse</a></code> or
1767 <code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code> to return. Must be
1769 <code>resumable</code> is <code>XML_FALSE</code>) an already suspended parser.
1794 when parsing an external parameter entity and <code>resumable</code> is
1795 <code>XML_TRUE</code>. Returns <code>XML_STATUS_OK</code> when successful,
1796 <code>XML_STATUS_ERROR</code> otherwise. The possible error codes are:
1801 <code>XML_ERROR_NOT_STARTED</code>
1810 <code>XML_ERROR_SUSPENDED</code>
1818 <code>XML_ERROR_FINISHED</code>
1826 <code>XML_ERROR_SUSPEND_PE</code>
1842 When <code>resumable</code> is <code>XML_TRUE</code> then parsing is
1843 <em>suspended</em>, that is, <code><a href="#XML_Parse">XML_Parse</a></code>
1844 and <code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code> return
1845 <code>XML_STATUS_SUSPENDED</code>. Otherwise, parsing is <em>aborted</em>, that
1846 is, <code><a href="#XML_Parse">XML_Parse</a></code> and <code><a href=
1847 "#XML_ParseBuffer">XML_ParseBuffer</a></code> return
1848 <code>XML_STATUS_ERROR</code> with error code <code>XML_ERROR_ABORTED</code>.
1855 of that handler to call <code><a href=
1856 "#XML_StopParser">XML_StopParser</a></code> on the parent parser (recursively),
1861 When suspended, parsing can be resumed by calling <code><a href=
1862 "#XML_ResumeParser">XML_ResumeParser</a></code>.
1880 Resumes parsing after it has been suspended with <code><a href=
1881 "#XML_StopParser">XML_StopParser</a></code>. Must not be called from within a
1882 handler call-back. Returns same status codes as <code><a href=
1883 "#XML_Parse">XML_Parse</a></code> or <code><a href=
1884 "#XML_ParseBuffer">XML_ParseBuffer</a></code>. An additional error code,
1885 <code>XML_ERROR_NOT_SUSPENDED</code>, will be returned if the parser was not
1894 the application to call <code><a href=
1895 "#XML_ResumeParser">XML_ResumeParser</a></code> on it at the appropriate
1931 <code>status</code> parameter <em>must not</em> be <code>NULL</code>.
1947 text not descended from a <code>para</code> element. One way it could do this is
1953 A handler may be <em>unset</em> by providing a <code>NULL</code> pointer to the
1959 Your handlers will be receiving strings in arrays of type <code>XML_Char</code>.
1960 This type is conditionally defined in expat.h as either <code>char</code>,
1961 <code>wchar_t</code> or <code>unsigned short</code>. The former implies UTF-8
1988 <code>NULL</code> pointer.
2058 handler. Note: Setting this handler to <code>NULL</code> may <em>NOT
2199 See also <code><a href="#XML_DefaultCurrent">XML_DefaultCurrent</a></code>.
2227 See also <code><a href="#XML_DefaultCurrent">XML_DefaultCurrent</a></code>.
2254 "#XML_SetParamEntityParsing"><code>XML_SetParamEntityParsing</code></a>.)
2265 The <code>context</code> parameter specifies the parsing context in the format
2266 expected by the <code>context</code> argument to <code><a href=
2267 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code>.
2268 <code>code</code> is valid only until the handler returns, so if the referenced
2269 entity is to be parsed later, it must be copied. <code>context</code> is
2270 <code>NULL</code> only when the entity is a parameter entity, which is how one
2275 The <code>base</code> parameter is the base to use for relative system
2276 identifiers. It is set by <code><a href="#XML_SetBase">XML_SetBase</a></code>
2277 and may be <code>NULL</code>. The <code>publicId</code> parameter is the public
2278 id given in the entity declaration and may be <code>NULL</code>.
2279 <code>systemId</code> is the system identifier specified in the entity
2280 declaration and is never <code>NULL</code>.
2286 <code>XML_STATUS_OK</code> should be returned for successful handling of the
2287 external entity reference. Returning <code>XML_STATUS_ERROR</code> indicates
2289 <code>XML_ERROR_EXTERNAL_ENTITY_HANDLING</code> error.
2295 parameter, may be used as arguments to a call to <code><a href=
2296 "#XML_ExternalEntityParserCreate">XML_ExternalEntityParserCreate</a></code>.
2318 Set the argument passed to the ExternalEntityRefHandler. If <code>arg</code> is
2319 not <code>NULL</code>, it is the new value passed to the handler set using
2320 <code><a href=
2321 "#XML_SetExternalEntityRefHandler">XML_SetExternalEntityRefHandler</a></code>;
2322 if <code>arg</code> is <code>NULL</code>, the argument passed to the handler
2327 <strong>Note:</strong> The type of <code>arg</code> and the type of the first
2329 <code>void *</code> to be passed to the handler, while the handler accepts an
2330 <code>XML_Parser</code>. This is a historical accident, but will not be
2332 for code that's known to work with this API. It is the responsibility of the
2333 application code to know the actual type of the argument passed to the handler
2365 "#XML_SetDefaultHandler"><code>XML_SetDefaultHandler</code></a> has been
2371 The <code>is_parameter_entity</code> argument will be non-zero for a parameter
2410 <code><a href="#XML_Parse">XML_Parse</a></code> or <code><a href=
2411 "#XML_ParseBuffer">XML_ParseBuffer</a></code> have been called on the given
2417 should fill in the <code>info</code> data structure and return
2418 <code>XML_STATUS_OK</code>. Otherwise it should return
2419 <code>XML_STATUS_ERROR</code>. The handler will be called at most once per
2421 <code>encodingHandlerData</code> will be passed back to the handler.
2432 convert pointer may be <code>NULL</code> if there are only single byte codes.
2434 <code>XML_Encoding</code>. The string s is <em>NOT</em> null-terminated and
2439 The function pointed at by <code>release</code> is called by the parser when it
2440 is finished with the encoding. It may be <code>NULL</code>.
2528 the <code>version</code> parameter will be <code>NULL</code> for text
2529 declarations. The <code>encoding</code> parameter may be <code>NULL</code> for
2530 an XML declaration. The <code>standalone</code> argument will contain -1, 0, or
2557 external or internal subset is parsed. Both <code>sysid</code> and
2558 <code>pubid</code> may be <code>NULL</code>. The
2559 <code>has_internal_subset</code> will be non-zero if the DOCTYPE declaration
2649 contains the element model. It's the user code's responsibility to free model
2650 when finished with via a call to <code><a href=
2651 "#XML_FreeContentModel">XML_FreeContentModel</a></code>. There is no need to
2657 The <code>model</code> argument is the root of a tree of
2658 <code>XML_Content</code> nodes. If <code>type</code> equals
2659 <code>XML_CTYPE_EMPTY</code> or <code>XML_CTYPE_ANY</code>, then
2660 <code>quant</code> will be <code>XML_CQUANT_NONE</code>, and the other fields
2661 will be zero or <code>NULL</code>. If <code>type</code> is
2662 <code>XML_CTYPE_MIXED</code>, then <code>quant</code> will be
2663 <code>XML_CQUANT_NONE</code> or <code>XML_CQUANT_REP</code> and
2664 <code>numchildren</code> will contain the number of elements that are allowed
2665 to be mixed in and <code>children</code> points to an array of
2666 <code>XML_Content</code> structures that will all have type XML_CTYPE_NAME with
2667 no quantification. Only the root node can be type <code>XML_CTYPE_EMPTY</code>,
2668 <code>XML_CTYPE_ANY</code>, or <code>XML_CTYPE_MIXED</code>.
2672 For type <code>XML_CTYPE_NAME</code>, the <code>name</code> field points to the
2673 name and the <code>numchildren</code> and <code>children</code> fields will be
2674 zero and <code>NULL</code>. The <code>quant</code> field will indicate any
2679 Types <code>XML_CTYPE_CHOICE</code> and <code>XML_CTYPE_SEQ</code> indicate a
2680 choice or sequence respectively. The <code>numchildren</code> field indicates
2681 how many nodes in the choice or sequence and <code>children</code> points to
2710 <code>elname</code> parameter returns the name of the element for which the
2711 attribute is being declared. The attribute name is in the <code>attname</code>
2712 parameter. The attribute type is in the <code>att_type</code> parameter. It is
2717 The <code>dflt</code> parameter holds the default value. It will be
2718 <code>NULL</code> in the case of "#IMPLIED" or "#REQUIRED" attributes. You can
2719 distinguish these two cases by checking the <code>isrequired</code> parameter,
2721 "#FIXED" will have also have a true <code>isrequired</code>, but they will have
2722 the non-<code>NULL</code> fixed value in the <code>dflt</code> parameter.
2751 <code>is_parameter_entity</code> argument will be non-zero in the case of
2756 For internal entities (<code><!ENTITY foo "bar"></code>),
2757 <code>value</code> will be non-<code>NULL</code> and <code>systemId</code>,
2758 <code>publicId</code>, and <code>notationName</code> will all be
2759 <code>NULL</code>. The value string is <em>not</em> null-terminated; the length
2760 is provided in the <code>value_length</code> parameter. Do not use
2761 <code>value_length</code> to test for internal entities, since it is legal to
2762 have zero-length values. Instead check for whether or not <code>value</code> is
2763 <code>NULL</code>.
2767 The <code>notationName</code> argument will have a non-<code>NULL</code> value
2852 <code>XML_STATUS_ERROR</code>, then the parser will throw an
2853 <code>XML_ERROR_NOT_STANDALONE</code> error.
2863 <code>XML_STATUS_ERROR</code> (a parse error has occurred), although the position
2867 the parse functions to return <code>XML_STATUS_ERROR</code>.) The exceptions are
2897 XML_ErrorString(enum XML_Error code);
2900 Return a string describing the error corresponding to code. The code should be
2901 one of the enums that can be returned from <code><a href=
2902 "#XML_GetErrorCode">XML_GetErrorCode</a></code>.
2915 returned by <code><a href=
2916 "#XML_GetCurrentLineNumber">XML_GetCurrentLineNumber</a></code> and
2917 <code><a href="#XML_GetCurrentColumnNumber">XML_GetCurrentColumnNumber</a></code>.
2921 <strong>Note:</strong> Type <code>XML_Index</code> is known to wrap around on
2923 (non-default and uncommon) macro <code><a href=
2924 "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
2937 <code>1</code>.
2941 <strong>Note:</strong> Type <code>XML_Size</code> is known to wrap around on
2943 (non-default and uncommon) macro <code><a href=
2944 "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
2957 position. The first column is reported as <code>0</code>.
2961 <strong>Note:</strong> Type <code>XML_Size</code> is known to wrap around on
2963 (non-default and uncommon) macro <code><a href=
2964 "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
2976 Return the number of bytes in the current event. Returns <code>0</code> if the
2995 <code>offset</code> to the offset within this buffer of the current parse
2996 position, and set the integer pointed at by <code>size</code> to the size of
3013 If <code>XML_CONTEXT_BYTES</code> is zero, this will always return
3014 <code>NULL</code>.
3037 attacks</a> (default: <code>100.0</code>) of parser <code>p</code> to
3038 <code>maximumAmplificationFactor</code>, and returns <code>XML_TRUE</code> upon
3039 success and <code>XML_FALSE</code> upon error.
3050 .. while parsing, whereas <code>direct</code> is the number of bytes read from
3051 the primary document in parsing and <code>indirect</code> is the number of
3057 <code>XML_SetBillionLaughsAttackProtectionMaximumAmplification</code> to
3062 <li>parser <code>p</code> must be a non-<code>NULL</code> root parser (without
3067 <code>maximumAmplificationFactor</code> must be non-<code>NaN</code> and
3068 greater than or equal to <code>1.0</code>.
3103 attacks</a> (default: <code>8 MiB</code>) of parser <code>p</code> to
3104 <code>activationThresholdBytes</code>, and returns <code>XML_TRUE</code> upon
3105 success and <code>XML_FALSE</code> upon error.
3110 <code>XML_SetBillionLaughsAttackProtectionActivationThreshold</code> to
3115 <li>parser <code>p</code> must be a non-<code>NULL</code> root parser (without
3147 of dynamic memory allocated (default: <code>100.0</code>) of parser
3148 <code>p</code> to <code>maximumAmplificationFactor</code>, and returns
3149 <code>XML_TRUE</code> upon success and <code>XML_FALSE</code> upon error.
3158 <li>application calls to functions <code><a href=
3159 "#XML_MemMalloc">XML_MemMalloc</a></code> and <code><a href="#XML_MemRealloc">
3160 XML_MemRealloc</a></code> — <em>healthy</em> use of these two functions
3164 <li>the main character buffer used by functions <code><a href="#XML_GetBuffer">
3165 XML_GetBuffer</a></code> and <code><a href=
3166 "#XML_ParseBuffer">XML_ParseBuffer</a></code> (and thus also by plain
3167 <code><a href="#XML_Parse">XML_Parse</a></code>), and
3172 handler</a> and freed by a call to <code><a href=
3173 "#XML_FreeContentModel">XML_FreeContentModel</a></code>).
3184 .. while parsing, whereas <code>direct</code> is the number of bytes read from
3185 the primary document in parsing and <code>allocated</code> is the number of
3190 For a call to <code>XML_SetAllocTrackerMaximumAmplification</code> to succeed:
3194 <li>parser <code>p</code> must be a non-<code>NULL</code> root parser (without
3199 <code>maximumAmplificationFactor</code> must be non-<code>NaN</code> and
3200 greater than or equal to <code>1.0</code>.
3211 <strong>Note:</strong> Amplifications factors greater than <code>100.0</code>
3232 against disproportionate use of RAM (default: <code>64 MiB</code>) of parser
3233 <code>p</code> to <code>activationThresholdBytes</code>, and returns
3234 <code>XML_TRUE</code> upon success and <code>XML_FALSE</code> upon error.
3239 tracking and limiting, please see <code><a href=
3240 … "#XML_SetAllocTrackerMaximumAmplification">XML_SetAllocTrackerMaximumAmplification</a></code>
3245 For a call to <code>XML_SetAllocTrackerActivationThreshold</code> to succeed:
3249 <li>parser <code>p</code> must be a non-<code>NULL</code> root parser (without
3280 The <code>enabled</code> argument should be <code>XML_TRUE</code> or
3281 <code>XML_FALSE</code>.
3285 Returns <code>XML_TRUE</code> on success, and <code>XML_FALSE</code> on error.
3310 freeing the memory associated with <code>userData</code> when it is finished with
3338 After this is called, handlers receive the parser in their <code>userData</code>
3339 arguments. The user data can still be obtained using the <code><a href=
3340 "#XML_GetUserData">XML_GetUserData</a></code> function.
3354 return value is <code>XML_STATUS_ERROR</code> if there's no memory to store base,
3355 otherwise it's <code>XML_STATUS_OK</code>.
3383 the offset in the <code>atts</code> array passed to the start tag handler of the
3399 to <code><a href="#XML_StartElementHandler">XML_StartElementHandler</a></code>,
3422 Returns an array of <code>XML_AttrInfo</code> structures for the attribute/value
3423 pairs passed in the last call to the <code>XML_StartElementHandler</code> that
3426 <code>XML_GetSpecifiedAttributeCount(parser) / 2</code>.
3430 <strong>Note:</strong> Type <code>XML_Index</code> is known to wrap around on
3432 (non-default and uncommon) macro <code><a href=
3433 "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
3447 non-<code>NULL</code> encoding argument to the parser creation functions. It must
3448 not be called after <code><a href="#XML_Parse">XML_Parse</a></code> or
3449 <code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code> have been called on
3450 the given parser. Returns <code>XML_STATUS_OK</code> on success or
3451 <code>XML_STATUS_ERROR</code> on error.
3461 enum XML_ParamEntityParsing code);
3465 entity that is the external DTD subset, according to <code>code</code>. The
3466 choices for <code>code</code> are:
3469 <code>XML_PARAM_ENTITY_PARSING_NEVER</code>
3473 <code>XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE</code>
3477 <code>XML_PARAM_ENTITY_PARSING_ALWAYS</code>
3480 <b>Note:</b> If <code>XML_SetParamEntityParsing</code> is called after
3481 <code>XML_Parse</code> or <code>XML_ParseBuffer</code>, then it has no effect and
3498 called after <code>XML_Parse</code> or <code>XML_ParseBuffer</code> or when
3499 <code>parser</code> is <code>NULL</code>.
3501 <b>Note:</b> Function <code>XML_SetHashSalt</code> is
3502 <strong>deprecated</strong>. Please use function <code><a href=
3503 "#XML_SetHashSalt16Bytes">XML_SetHashSalt16Bytes</a></code> instead for better
3504 security. <code>XML_SetHashSalt</code> only provides 4 to 8 bytes of entropy
3505 (depending on the size of type <code>unsigned long</code>) while the SipHash
3507 twice as much. Function <code><a href=
3508 "#XML_SetHashSalt16Bytes">XML_SetHashSalt16Bytes</a></code> of Expat >=2.8.0
3518 <b>Note:</b> One should not call <code>XML_SetHashSalt</code> with a hash salt
3520 <code>XML_SetHashSalt</code> has <b>not</b> been called. Consequently such a
3538 this must be called before parsing has started. Returns <code>XML_TRUE</code> if
3539 successful, <code>XML_FALSE</code> when called after <code>XML_Parse</code> or
3540 <code>XML_ParseBuffer</code> or when <code>parser</code> is <code>NULL</code>.
3543 entropy (like <code>getentropy(3)</code>) will make the parser vulnerable to
3567 does not contain a DOCTYPE declaration at all and <code>useDTD</code> is true,
3569 <code>startDoctypeDeclHandler</code> and <code>endDoctypeDeclHandler</code>
3571 controlled using <code><a href=
3572 "#XML_SetParamEntityParsing">XML_SetParamEntityParsing</a></code>, will be
3578 reference handler set via <code><a href=
3579 "#XML_SetExternalEntityRefHandler">XML_SetExternalEntityRefHandler</a></code>
3580 with both <code>publicId</code> and <code>systemId</code> set to
3581 <code>NULL</code>.
3586 <code>XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING</code> and ignores
3587 <code>useDTD</code>. If called when Expat has been compiled without DTD
3588 support, it returns <code>XML_ERROR_FEATURE_REQUIRES_XML_DTD</code>. Otherwise,
3589 it returns <code>XML_ERROR_NONE</code>.
3594 <code>useDTD == XML_TRUE</code> will make the parser behave as if the document
3612 <code><a href="#XML_ParserCreateNS">XML_ParserCreateNS</a></code>, i.e. when
3613 namespace processing is in effect. The <code>do_nst</code> sets whether or not
3615 function is called with <code>do_nst</code> non-zero, then afterwards namespace
3623 If <code>do_nst</code> is zero, then namespaces are reported in the default
3639 the default handler set by <code><a href=
3640 "#XML_SetDefaultHandler">XML_SetDefaultHandler</a></code> or <code><a href=
3641 "#XML_SetDefaultHandlerExpand">XML_SetDefaultHandlerExpand</a></code>. It does
3654 Return the library version as a string (e.g. <code>"expat_1.95.1"</code>).
3678 <code>XML_MAJOR_VERSION</code>
3682 <code>XML_MINOR_VERSION</code>
3686 <code>XML_MICRO_VERSION</code>
3727 allows code that does need to check these features to do so at runtime.
3731 The return value is an array of <code>XML_Feature</code>, terminated by a
3732 record with a <code>feature</code> of <code>XML_FEATURE_END</code> and
3733 <code>name</code> of <code>NULL</code>, identifying the feature-test macros
3735 information needs to determine the type of character the <code>name</code>
3736 points to, records for the <code>XML_FEATURE_SIZEOF_XML_CHAR</code> and
3737 <code>XML_FEATURE_SIZEOF_XML_LCHAR</code> will be located at the beginning of
3738 the list, followed by <code>XML_FEATURE_UNICODE</code> and
3739 <code>XML_FEATURE_UNICODE_WCHAR_T</code>, if they are present at all.
3744 <code>value</code> field is set to 0. At this time, the following features have
3750 <code>XML_FEATURE_SIZEOF_XML_CHAR</code>
3754 The number of bytes occupied by one <code>XML_Char</code> character.
3758 <code>XML_FEATURE_SIZEOF_XML_LCHAR</code>
3762 The number of bytes occupied by one <code>XML_LChar</code> character.
3766 <code>XML_FEATURE_CONTEXT_BYTES</code>
3771 <code><a href="#XML_GetInputContext">XML_GetInputContext</a></code>.
3785 Function to deallocate the <code>model</code> argument passed to the
3786 <code>XML_ElementDeclHandler</code> callback set using <code><a href=
3787 "#XML_SetElementDeclHandler">XML_ElementDeclHandler</a></code>. This function
3792 The following functions allow external code to share the memory allocator an
3793 <code>XML_Parser</code> has been configured to use. This is especially useful for
3795 code, or heavily layered applications. This can be essential when using
3809 Allocate <code>size</code> bytes of memory using the allocator the
3810 <code>parser</code> object has been configured to use. Returns a pointer to the
3811 memory or <code>NULL</code> on failure. Memory allocated in this way must be
3812 freed using <code><a href="#XML_MemFree">XML_MemFree</a></code>.
3824 Allocate <code>size</code> bytes of memory using the allocator the
3825 <code>parser</code> object has been configured to use. <code>ptr</code> must
3826 point to a block of memory allocated by <code><a href=
3827 "#XML_MemMalloc">XML_MemMalloc</a></code> or <code>XML_MemRealloc</code>, or be
3828 <code>NULL</code>. This function tries to expand the block pointed to by
3829 <code>ptr</code> if possible. Returns a pointer to the memory or
3830 <code>NULL</code> on failure. On success, the original block has either been
3833 be freed using <code><a href="#XML_MemFree">XML_MemFree</a></code>.
3845 Free a block of memory pointed to by <code>ptr</code>. The block must have been
3846 allocated by <code><a href="#XML_MemMalloc">XML_MemMalloc</a></code> or
3847 <code>XML_MemRealloc</code>, or be <code>NULL</code>.