> Expat4D Home > Documentation > Command Reference

xml_UseUserDataAsHandlerArg ( parserID )


  • --> parserID : longint

This function allows you to set that the 1st parameter passed to a handler function is the "UserData" value you set with xml_SetUserData instead of the parserID. This saves you calling xml_GetUserData in the handler routine when you're not interested in the parserID.

There is a problem though. Because of the way that we have to extract attributes from a start element, you wont be able to get the attributes from a start tag if you don't have the parserID, and there is currently no way of getting it using the UserData. This is something which will be implemented in a future release.

`Method: parseXML (text)

C_TEXT($1;$xmlText)
$xmlText:=$1

C_LONGINT($parser)
$parser:=xml_ParserCreate("")

C_LONGINT($parser)
$parserObject:=OT New

xml_SetElementHandler($parser;"handler_startElement";"handler_endElement")
xml_SetUserData($parser;$parserObject)
xml_UseUserDataAsHandlerArg($parser)

C_LONGINT($errorCode)
$errorCode:=xml_Parse($parser;$xmlText;1)
xml_ParserFree($parser)
   

See Also: xml_UseParserIDAsHandlerArg.

  Expat4D Logo

Developer Documentation

Creating Parsers, Destroying Parsers, Parsing Text

Configuring Handler Methods

Position and Error Reporting Functions

Miscellaneous Functions

Output Buffer Functions

Error Codes


> Expat4D Home > Documentation > Command Reference

Last Modified: 27th April 2001 at 9:00 PM