> Expat4D Home > Documentation > Command Reference

xml_GetAttributes ( parserID; names; values ) --> noAttributes


  • --> parserID : longint
  • --> names : text array
  • --> values : text array
  • <-- noAtributes : longint

This command is called during a "startElementHandler" callback to return any attributes and values found in the element into two text arrays. The command can be called as many times as necessary during a "startElementHandler" callback, but at no other time.

Pass this command the current parserID and two text arrays, and the text arrays will be populated with the attribute names and values so that they're easy to work with. e.g.

`Method: handler_startElement (parser; elementName; numberOfAttributes)

C_LONGINT($1;$parser)
C_TEXT($2;$elementName)
C_LONGINT($3;$numberOfAttributes)

$parser:=$1
$elementName:=$2
$numberOfAttributes:=$3

tagDepth:=tagDepth+1

If($numberOfAttributes>0)

  ARRAY TEXT($attrNames;0)
  ARRAY TEXT($attrValues;0)

    `get the attributes from the element into the arrays
  $noAttributes:=xml_GetAttributes($parser;$attrNames;$attrValues)

    `do something with the arrays...

End if
   
  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: 9th June 2001 at 5:59 PM