CatchXML()

Syntax

Result = CatchXML(#XML, *Address, Size [, Flags [, Encoding]])
Description
Creates a new XML tree from XML data in the given memory area. The markup can be parsed in blocks by multiple calls to this function to allow parsing XML data while it arrives from the network for example.

Parameters

#XML A number to identify the new XML. #PB_Any can be used to auto-generate this number.
*Address A readable memory location.
Size Size (in bytes) of the memory location.
Flags (optional) If omitted, the memory location must contain all XML data. To parse XML in multiple blocks, the following flags can be used:
  #PB_XML_StreamStart: Start parsing the first block
  #PB_XML_StreamNext : Continue parsing with a new block
  #PB_XML_StreamEnd  : End parsing after this block
When calling this function with #PB_XML_StreamStart or #PB_XML_StreamEnd, the 'Size' parameter can be 0 to start/end a parsing operation without actually parsing more data.

Note that when parsing in blocks, all data already parsed is accessible in the XML tree even before a call with #PB_XML_StreamEnd is made.
Encoding (optional) The encoding to use when loading the XML tree (this overwrites the encoding set in the XML declaration). Valid values are:
  #PB_UTF8 (default)
  #PB_Ascii
  #PB_Unicode
This parameter should be used when the document does not have an XML declaration, or the encoding information is provided outside of the XML document, for example through a mime type header in a communication protocol.

Return value

This function only returns zero on memory errors or invalid Flags. To check for parser errors XMLStatus() should be used. In case of a parsing error, all data parsed before the error is accessible in the XML tree.

See Also

FreeXML(), CreateXML(), LoadXML(), ParseXML()

Supported OS

All

XML Index - ChildXMLNode() ->