/* The XML_Status enum gives the possible return values for several APIfunctions.Thepreprocessor#definesareincludedsothis stanzacanbeaddedtocodethatstillneedstosupportolder versionsofExpat1.95.x:
/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be XML_CQUANT_NONE,andtheotherfieldswillbezeroorNULL. Iftype==XML_CTYPE_MIXED,thenquantwillbeNONEorREPand numchildrenwillcontainnumberofelementsthatmaybemixedin andchildrenpointtoanarrayofXML_Contentcellsthatwillbe allofXML_CTYPE_NAMEtypewithnoquantification.
/* This is called for an element declaration. See above for descriptionofthemodelargument.It'stheusercode'sresponsibility tofreemodelwhenfinishedwithit.SeeXML_FreeContentModel. Thereisnoneedtofreethemodelfromthehandler,itcanbekept aroundandfreedatalaterstage.
*/ typedefvoid(XMLCALL *XML_ElementDeclHandler)(void *userData, const XML_Char *name,
XML_Content *model);
/* The XML declaration handler is called for *both* XML declarations andtextdeclarations.Thewaytodistinguishisthattheversion parameterwillbeNULLfortextdeclarations.Theencoding parametermaybeNULLforXMLdeclarations.Thestandalone parameterwillbe-1,0,or1indicatingrespectivelythatthere wasnostandaloneparameterinthedeclaration,thatitwasgiven asno,orthatitwasgivenasyes.
*/ typedefvoid(XMLCALL *XML_XmlDeclHandler)(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone);
/* Constructs a new parser; encoding is the encoding specified by the externalprotocolorNULLifthereisnonespecified.
*/
XMLPARSEAPI(XML_Parser)
XML_ParserCreate(const XML_Char *encoding);
/* Constructs a new parser and namespace processor. Element type namesandattributenamesthatbelongtoanamespacewillbe expanded;unprefixedattributenamesareneverexpanded;unprefixed elementtypenamesareexpandedonlyifthereisadefault namespace.Theexpandednameistheconcatenationofthenamespace URI,thenamespaceseparatorcharacter,andthelocalpartofthe name.Ifthenamespaceseparatoris'\0'thenthenamespaceURI andthelocalpartwillbeconcatenatedwithoutanyseparator. Itisaprogrammingerrortousetheseparator'\0'withnamespace triplets(seeXML_SetReturnNSTriplet). IfanamespaceseparatorischosenthatcanbepartofaURIor partofanXMLname,splittinganexpandednamebackintoits 1,2or3originalpartsonapplicationlevelintheelementhandler mayendupvulnerable,sotheseareadvisedagainst;sanechoicesfor anamespaceseparatoraree.g.'\n'(linefeed)and'|'(pipe).
/* Constructs a new parser using the memory management suite referred to bymemsuite.IfmemsuiteisNULL,thenusethestandardlibrarymemory suite.IfnamespaceSeparatorisnon-NULLitcreatesaparserwith namespaceprocessingasdescribedabove.Thecharacterpointedat willserveasthenamespaceseparator.
/* Prepare a parser object to be reused. This is particularly valuablewhenmemoryallocationoverheadisdisproportionatelyhigh, suchaswhenalargenumberofsmalldocumentsneedtobeparsed. Allhandlersareclearedfromtheparser,exceptforthe unknownEncodingHandler.Theparser'sexternalstateisre-initialized exceptforthevaluesofnsandns_triplets.
/* This is called for any characters in the XML document for which thereisnoapplicablehandler.Thisincludesbothcharactersthat arepartofmarkupwhichisofakindthatisnotreported (comments,markupdeclarations),orcharactersthatarepartofa constructwhichcouldbereportedbutforwhichnohandlerhasbeen supplied.ThecharactersarepassedexactlyastheywereintheXML documentexceptthattheywillbeencodedinUTF-8orUTF-16. Lineboundariesarenotnormalized.Notethatabyteordermark characterisnotpassedtothedefaulthandler.Thereareno guaranteesabouthowcharactersaredividedbetweencallstothe defaulthandler:forexample,acommentmightbesplitbetween multiplecalls.
*/ typedefvoid(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s, int len);
/* This is called for the start of the DOCTYPE declaration, before anyDTDorinternalsubsetisparsed.
*/ typedefvoid(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset);
/* This is called for the end of the DOCTYPE declaration when the closing>isencountered,butafterprocessinganyexternal subset.
*/ typedefvoid(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
/* This is called for entity declarations. The is_parameter_entity argumentwillbenon-zeroiftheentityisaparameterentity,zero otherwise.
/* This is called for a declaration of notation. The base argument is whateverwassetbyXML_SetBase.ThenotationNamewillneverbe NULL.Theotherargumentscanbe.
*/ typedefvoid(XMLCALL *XML_NotationDeclHandler)(void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId);
/* When namespace processing is enabled, these are called once for eachnamespacedeclaration.Thecalltothestartandendelement handlersoccurbetweenthecallstothestartandendnamespace declarationhandlers.Foranxmlnsattribute,prefixwillbe NULL.Foranxmlns=""attribute,uriwillbeNULL.
*/ typedefvoid(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData, const XML_Char *prefix, const XML_Char *uri);
/* This is called if the document is not standalone, that is, it has an externalsubsetorareferencetoaparameterentity,butdoesnot havestandalone="yes".IfthishandlerreturnsXML_STATUS_ERROR, thenprocessingwillnotcontinue,andtheparserwillreturna XML_ERROR_NOT_STANDALONEerror. Ifparameterentityparsingisenabled,theninadditiontothe conditionsabovethishandlerwillonlybecalledifthereferenced entitywasactuallyread.
*/ typedefint(XMLCALL *XML_NotStandaloneHandler)(void *userData);
/* This is called for a reference to an external parsed general entity.Thereferencedentityisnotautomaticallyparsed.The applicationcanparseitimmediatelyorlaterusing XML_ExternalEntityParserCreate.
/* This is called in two situations: 1)Anentityreferenceisencounteredforwhichnodeclaration hasbeenread*and*thisisnotanerror. 2)Aninternalentityreferenceisread,butnotexpanded,because XML_SetDefaultHandlerhasbeencalled. Note:skippedparameterentitiesindeclarationsandskippedgeneral entitiesinattributevaluescannotbereported,because theeventwouldbeoutofsyncwiththereportingofthe declarationsorattributevalues
*/ typedefvoid(XMLCALL *XML_SkippedEntityHandler)(void *userData, const XML_Char *entityName, int is_parameter_entity);
/* This structure is filled in by the XML_UnknownEncodingHandler to provideinformationtotheparseraboutencodingsthatareunknown totheparser.
/* This sets the default handler and also inhibits expansion of internalentities.Theseentityreferenceswillbepassedtothe defaulthandler,ortotheskippedentityhandler,ifoneisset.
*/
XMLPARSEAPI(void)
XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);
/* This sets the default handler but does not inhibit expansion of internalentities.Theentityreferencewillnotbepassedtothe defaulthandler.
*/
XMLPARSEAPI(void)
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
/* If a non-NULL value for arg is specified here, then it will be passedasthefirstargumenttotheexternalentityrefhandler insteadoftheparserobject.
*/
XMLPARSEAPI(void)
XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
/* This can be called within a handler for a start element, end element,processinginstructionorcharacterdata.Itcausesthe correspondingmarkuptobepassedtothedefaulthandler.
*/
XMLPARSEAPI(void)
XML_DefaultCurrent(XML_Parser parser);
/* If do_nst is non-zero, and namespace processing is in effect, and anamehasaprefix(i.e.anexplicitnamespacequalifier)then thatnameisreturnedasatripletinasinglestringseparatedby theseparatorcharacterspecifiedwhentheparserwascreated:URI +sep+local_name+sep+prefix.
XMLPARSEAPI(void)
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
/* This value is passed as the userData argument to callbacks. */
XMLPARSEAPI(void)
XML_SetUserData(XML_Parser parser, void *userData);
/* Returns the last value set by XML_SetUserData or NULL. */ # define XML_GetUserData(parser) (*(void **)(parser))
/* This is equivalent to supplying an encoding argument to XML_ParserCreate.OnsuccessXML_SetEncodingreturnsnon-zero, zerootherwise. Note:CallingXML_SetEncodingafterXML_ParseorXML_ParseBuffer hasnoeffectandreturnsXML_STATUS_ERROR.
*/
XMLPARSEAPI(enum XML_Status)
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
/* If this function is called, then the parser will be passed as the firstargumenttocallbacksinsteadofuserData.TheuserDatawill stillbeaccessibleusingXML_GetUserData.
*/
XMLPARSEAPI(void)
XML_UseParserAsHandlerArg(XML_Parser parser);
/* If useDTD == XML_TRUE is passed to this function, then the parser willassumethatthereisanexternalsubset,evenifnoneis specifiedinthedocument.Insuchacasetheparserwillcallthe externalEntityRefHandlerwithavalueofNULLforthesystemId argument(thepublicIdandcontextargumentswillbeNULLaswell). Note:ForthepurposeofcheckingWFC:EntityDeclared,passing useDTD==XML_TRUEwillmaketheparserbehaveasifthedocument hadaDTDwithanexternalsubset. Note:Ifthisfunctioniscalled,thenthismustbedonebefore thefirstcalltoXML_ParseorXML_ParseBuffer,sinceitwill havenoeffectafterthat.Returns XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. Note:IfthedocumentdoesnothaveaDOCTYPEdeclarationatall, thenstartDoctypeDeclHandlerandendDoctypeDeclHandlerwillnot becalled,despiteanexternalsubsetbeingparsed. Note:IfXML_DTDisnotdefinedwhenExpatiscompiled,returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. Note:Ifparser==NULL,returnsXML_ERROR_INVALID_ARGUMENT.
*/
XMLPARSEAPI(enum XML_Error)
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
/* Sets the base to be used for resolving relative URIs in system identifiersindeclarations.Resolvingrelativeidentifiersis lefttotheapplication:thisvaluewillbepassedthroughasthe baseargumenttotheXML_ExternalEntityRefHandler, XML_NotationDeclHandlerandXML_UnparsedEntityDeclHandler.Thebase argumentwillbecopied.ReturnsXML_STATUS_ERRORifoutofmemory, XML_STATUS_OKotherwise.
*/
XMLPARSEAPI(enum XML_Status)
XML_SetBase(XML_Parser parser, const XML_Char *base);
/* Returns the number of the attribute/value pairs passed in last call totheXML_StartElementHandlerthatwerespecifiedinthestart-tag ratherthandefaulted.Eachattribute/valuepaircountsas2;thus thiscorrespondstoanindexintotheattsarraypassedtothe XML_StartElementHandler.Returns-1ifparser==NULL.
*/
XMLPARSEAPI(int)
XML_GetSpecifiedAttributeCount(XML_Parser parser);
/* Returns the index of the ID attribute passed in the last call to XML_StartElementHandler,or-1ifthereisnoIDattributeor parser==NULL.Eachattribute/valuepaircountsas2;thusthis correspondstoanindexintotheattsarraypassedtothe XML_StartElementHandler.
*/
XMLPARSEAPI(int)
XML_GetIdAttributeIndex(XML_Parser parser);
# ifdef XML_ATTR_INFO /* Source file byte offsets for the start and end of attribute names and values. Thevalueindicesareexclusiveofsurroundingquotes;thusinaUTF-8source fileanattributevalueof"blah"willyield: info->valueEnd-info->valueStart=4bytes.
*/ typedefstruct {
XML_Index nameStart; /* Offset to beginning of the attribute name. */
XML_Index nameEnd; /* Offset after the attribute name's last byte. */
XML_Index valueStart; /* Offset to beginning of the attribute value. */
XML_Index valueEnd; /* Offset after the attribute value's last byte. */
} XML_AttrInfo;
/* Returns an array of XML_AttrInfo structures for the attribute/value pairs passedinlastcalltotheXML_StartElementHandlerthatwerespecified inthestart-tagratherthandefaulted.Eachattribute/valuepaircounts as1;thusthenumberofentriesinthearrayis XML_GetSpecifiedAttributeCount(parser)/2.
*/
XMLPARSEAPI(const XML_AttrInfo *)
XML_GetAttributeInfo(XML_Parser parser); # endif
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is detected.ThelastcalltoXML_ParsemusthaveisFinaltrue;len maybezeroforthiscall(oranyother).
Thoughthereturnvaluesforthesefunctionshasalwaysbeen describedasaBooleanvalue,theimplementation,atleastforthe 1.95.xseries,hasalwaysreturnedexactlyoneoftheXML_Status values.
*/
XMLPARSEAPI(enum XML_Status)
XML_Parse(XML_Parser parser, constchar *s, int len, int isFinal);
XMLPARSEAPI(void *)
XML_GetBuffer(XML_Parser parser, int len);
XMLPARSEAPI(enum XML_Status)
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. Mustbecalledfromwithinacall-backhandler,exceptwhenaborting (resumable=0)analreadysuspendedparser.Somecall-backsmay stillfollowbecausetheywouldotherwisegetlost.Examples: -endElementHandler()foremptyelementswhenstoppedin startElementHandler(), -endNameSpaceDeclHandler()whenstoppedinendElementHandler(), andpossiblyothers.
/* Resumes parsing after it has been suspended with XML_StopParser(). Mustnotbecalledfromwithinahandlercall-back.Returnssame statuscodesasXML_Parse()orXML_ParseBuffer(). AdditionalerrorcodeXML_ERROR_NOT_SUSPENDEDpossible.
/* Returns status of parser with respect to being initialized, parsing, finished,orsuspendedandprocessingthefinalbuffer. XXXXML_Parse()andXML_ParseBuffer()shouldreturnXML_ParsingStatus, XXXwithXML_FINISHED_OKorXML_FINISHED_ERRORreplacingXML_FINISHED
*/
XMLPARSEAPI(void)
XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
/* Creates an XML_Parser object that can parse an external general entity;contextisa'\0'-terminatedstringspecifyingtheparse context;encodingisa'\0'-terminatedstringgivingthenameof theexternallyspecifiedencoding,orNULLifthereisno externallyspecifiedencoding.Thecontextstringconsistsofa sequenceoftokensseparatedbyformfeeds(\f);atokenconsisting ofanamespecifiesthatthegeneralentityofthenameisopen;a tokenoftheformprefix=urispecifiesthenamespacefora particularprefix;atokenoftheform=urispecifiesthedefault namespace.Thiscanbecalledatanypointafterthefirstcallto anExternalEntityRefHandlersolongerastheparserhasnotyet beenfreed.Thenewparseriscompletelyindependentandmay safelybeusedinaseparatethread.ThehandlersanduserDataare initializedfromtheparserargument.ReturnsNULLifoutofmemory. OtherwisereturnsanewXML_Parserobject.
*/
XMLPARSEAPI(XML_Parser)
XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding);
/* Sets the hash salt to use for internal hash calculations. HelpsinpreventingDoSattacksbasedonpredictinghash functionbehavior.Thismustbecalledbeforeparsingisstarted. Returns1ifsuccessful,0whencalledafterparsinghasstarted. Note:Ifparser==NULL,thefunctionwilldonothingandreturn0. DEPRECATEDsinceExpat2.8.0.
*/
XMLPARSEAPI(int)
XML_SetHashSalt(XML_Parser parser, unsignedlong hash_salt);
/* Sets the hash salt to use for internal hash calculations. HelpsinpreventingDoSattacksbasedonpredictinghashfunctionbehavior. Thismustbecalledbeforeparsingisstarted. ReturnsXML_TRUEifsuccessful,XML_FALSEwhencalledafterparsinghas startedorwhenparserisNULL. AddedinExpat2.8.0.
*/
XMLPARSEAPI(XML_Bool)
XML_SetHashSalt16Bytes(XML_Parser parser, const uint8_t entropy[16]);
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then XML_GetErrorCodereturnsinformationabouttheerror.
*/
XMLPARSEAPI(enum XML_Error)
XML_GetErrorCode(XML_Parser parser);
/* These functions return information about the current parse location.Theymaybecalledfromanycallbackcalledtoreport someparseevent;inthiscasethelocationisthelocationofthe firstofthesequenceofcharactersthatgeneratedtheevent.When calledfromcallbacksgeneratedbydeclarationsinthedocument prologue,thelocationidentifiedisn'tasneatlydefined,butwill bewithintherelevantmarkup.Whencalledoutsideofthecallback functions,thepositionindicatedwillbejustpastthelastparse event(regardlessofwhethertherewasanassociatedcallback).
/* Return the number of bytes in the current event. Returns0iftheeventisinaninternalentity.
*/
XMLPARSEAPI(int)
XML_GetCurrentByteCount(XML_Parser parser);
/* If XML_CONTEXT_BYTES is >=1, returns the input buffer, sets theintegerpointedtobyoffsettotheoffsetwithinthisbuffer ofthecurrentparseposition,andsetstheintegerpointedtobysize tothesizeofthisbuffer(thenumberofinputbytes).Otherwise returnsaNULLpointer.AlsoreturnsaNULLpointerifaparseisn't active.
NOTE:Thecharacterpointerreturnedshouldnotbeusedoutside thehandlerthatmakesthecall.
*/
XMLPARSEAPI(constchar *)
XML_GetInputContext(XML_Parser parser, int *offset, int *size);
/* For backwards compatibility with previous versions. */ # define XML_GetErrorLineNumber XML_GetCurrentLineNumber # define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber # define XML_GetErrorByteIndex XML_GetCurrentByteIndex
/* Frees the content model passed to the element declaration handler */
XMLPARSEAPI(void)
XML_FreeContentModel(XML_Parser parser, XML_Content *model);
/* Exposing the memory handling functions used in Expat */
XMLPARSEAPI(void *)
XML_ATTR_MALLOC
XML_ATTR_ALLOC_SIZE(2)
XML_MemMalloc(XML_Parser parser, size_t size);
/* Frees memory used by the parser. */
XMLPARSEAPI(void)
XML_ParserFree(XML_Parser parser);
/* Returns a string describing the error. */
XMLPARSEAPI(const XML_LChar *)
XML_ErrorString(enum XML_Error code);
/* Return a string containing the version number of this expat */
XMLPARSEAPI(const XML_LChar *)
XML_ExpatVersion(void);
typedefstruct { int major; int minor; int micro;
} XML_Expat_Version;
/* Return an XML_Expat_Version structure containing numeric version numberinformationforthisversionofexpat.
*/
XMLPARSEAPI(XML_Expat_Version)
XML_ExpatVersionInfo(void);
/* Added in Expat 1.95.5. */ enum XML_FeatureEnum {
XML_FEATURE_END = 0,
XML_FEATURE_UNICODE,
XML_FEATURE_UNICODE_WCHAR_T,
XML_FEATURE_DTD,
XML_FEATURE_CONTEXT_BYTES,
XML_FEATURE_MIN_SIZE,
XML_FEATURE_SIZEOF_XML_CHAR,
XML_FEATURE_SIZEOF_XML_LCHAR,
XML_FEATURE_NS,
XML_FEATURE_LARGE_SIZE,
XML_FEATURE_ATTR_INFO, /* Added in Expat 2.4.0. */
XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT, /* Added in Expat 2.6.0. */
XML_FEATURE_GE, /* Added in Expat 2.7.2. */
XML_FEATURE_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT,
XML_FEATURE_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT, /* Additional features must be added to the end of this enum. */
};
# ifdefined(XML_DTD) || (defined(XML_GE) && XML_GE == 1) /* Added in Expat 2.4.0 for XML_DTD defined and
* added in Expat 2.6.0 for XML_GE == 1. */
XMLPARSEAPI(XML_Bool)
XML_SetBillionLaughsAttackProtectionMaximumAmplification(
XML_Parser parser, float maximumAmplificationFactor);
/* Added in Expat 2.4.0 for XML_DTD defined and
* added in Expat 2.6.0 for XML_GE == 1. */
XMLPARSEAPI(XML_Bool)
XML_SetBillionLaughsAttackProtectionActivationThreshold(
XML_Parser parser, unsignedlonglong activationThresholdBytes);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.