XMLReader.StartElement
From Xojo Documentation
Event
XMLReader.StartElement(Name as String,AttributeList as XMLAttributeList)
Supported for all project types and targets.
Supported for all project types and targets.
Called at the start of the XML element, Name and AttributeList.
Notes
This event handler is called as each XML node is processed. You can then check the name to determine how you want to proceed.
Examples
The following XML is contained in a constant called kTestXml:
<?xml version="1.0" encoding="UTF-8"?> <League> <Team name="Seagulls"> <Player name="Bob" position="1B" /> <Player name="Tom" position="2B" /> </Team> <Team name="Pigeons"> <Player name="Bill" position="1B" /> <Player name="Tim" position="2B" /> </Team> <Team name="Crows"> <Player name="Ben" position="1B" /> <Player name="Ty" position="2B" /> </Team> </League>
This code in the StarElement event handler will display the XML as it is processed:
Select Case name
Case "Team"
// On the Team node, get the name attribute and
// display it
// OutPut is a ListBox
Output.AddRow(attributeList.Value("name"))
Case "Player"
// Get each player node and display the player name
// and position
// Output is a ListBox
Output.AddRow("", attributeList.Value("name"), attributeList.Value("position"))
End Select
Case "Team"
// On the Team node, get the name attribute and
// display it
// OutPut is a ListBox
Output.AddRow(attributeList.Value("name"))
Case "Player"
// Get each player node and display the player name
// and position
// Output is a ListBox
Output.AddRow("", attributeList.Value("name"), attributeList.Value("position"))
End Select