> Expat4D Home > Documentation > Command Reference

xml_SetCDATASectionHandler ( parserID; startCDATAHandler; endCDATAHandler )


  • --> parserID : longint
  • --> startCDATAHandler : string[31]
  • --> endCDATAHandler : string[31]

Set the handler method for character data (CDATA) sections in the xml document. These handlers don't receive any data. They simple tell the processing that a CDATA section is starting or ending.

For example, if you are creating a parser for transforming XML documents which only implements the CDATA and Default handlers, CDATA sections, e.g. <![CDATA[...]>, would be handed to the Default handler which is not always what you want. These two handlers get around this for you by at least letting you know when a CDATA section is starting or ending so that you can handle it yourself.

`Method: handler_CDATAstart (parser)

C_LONGINT($1;$parser)

$parser:=$1
   

`Method: handler_CDATAend (parser)

C_LONGINT($1;$parser)

$parser:=$1
   

`Method: parseXML (text)

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

C_LONGINT($parser)
$parser:=xml_ParserCreate("")
xml_SetElementHandler($parser;"handler_startElement";"handler_endElement")
xml_SetCDATASectionHandler($parser;"handler_CDATAstart";"handler_CDATAend")
xml_SetCDATAHandler($parser;"handler_CDATA")

C_LONGINT($errorCode)
$errorCode:=xml_Parse($parser;$xmlText;1)
xml_ParserFree($parser)
   
  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