$WBGETXML - get XML

Availability
$WBGETXML is available for use with all WBSP commands.

Syntax
$WBGETXML{Source|ArrName|NodeName|limit|show}
$WBGETXML[Source|ArrName|NodeName|limit|show]

Parameters
Source - Either Internet address of the XML file you want to include in your page (URL) or a string value containing XML code. URL can be either absolute (containing entire address including protocol, server, path and resource) or relative (to document root of virtual server if it starts with slash / character, or to the directory where the WBSP file is located). XML source code must start with "<?xml" (without quotations)
ArrName - name that will be used as prefix for all variables where XML node values will be stored.
NodeName - Name of the parent node for which all child nodes will be retrieved
limit - optional parameter. Contains the number of items to be included in arrays
show - optional parameter  - if set to true (T,ON,1) WhizBase will show the last index (length-1) of resulting array

Returns
Set of arrays containing values of all child nodes of NodeName of as well as array containing all the parent node (NodeName) values (all child nodes in one line separated by space). Arrays are named following this convention: ArrName_NodeName() and ArrName_NodeName_ChildNodeName(). See the example.

Example

[FormFields]
wb_command=R
<!--WB_BeginTemplate-->
<html>
<head>
  <title>GetXML</title>
</head>
<body>
$wbsetv[xmlcnt|$wbgetxml[XMLSample.xml|conditions|condition|5|T]]
$wbsetv[loopcounter|0]
$WBWHILE[$wbgetv[loopcounter]<=$wbgetv[xmlcnt]|
No.: $wbgetv[loopcounter]<br/>
Condition (full parent node): <b>$wbgetv[conditions_condition($wbgetv[loopcounter])]</b><br/>
Code: $wbgetv[conditions_condition_code($wbgetv[loopcounter])]<br/>
Day_Icon: $wbgetv[conditions_condition_day_icon($wbgetv[loopcounter])]<br/>
Night_Icon: $wbgetv[conditions_condition_night_icon($wbgetv[loopcounter])]<br/>
Description: $wbgetv[conditions_condition_description($wbgetv[loopcounter])]<br/>
$wbsetv[loopcounter|$wbcalc[$wbgetv[loopcounter]+1]]
]
</body>
</html>

File XMLSample.xml

<?xml version="1.0" encoding="UTF-8"?>
<codes>
  <condition>
    <code>XXX</code>
    <description>XXX description</description>
    <day_icon>XXXDayIcon.png</day_icon>
    <night_icon>XXXNightIcon.png</night_icon>
  </condition>
  <condition>
    <code>YYY</code>
    <description>YYY description</description>
    <day_icon>DayYYYIcon.png</day_icon>
    <night_icon>NightYYYIcon.png</night_icon>
  </condition>
  <condition>
    <code>ZZZ</code>
    <description>ZZZ description</description>
    <day_icon>DayIconZZZ.png</day_icon>
    <night_icon>NightIconZZZ.png</night_icon>
  </condition>
</codes>

After running this example, the resulting page in browser should look like this:

No.: 0
Condition (full parent node): XXX XXX description XXXDayIcon.png XXXNightIcon.png
Code: XXX
Day_Icon: XXXDayIcon.png
Night_Icon: XXXNightIcon.png
Description: XXX description
No.: 1
Condition (full parent node): YYY YYY description DayYYYIcon.png NightYYYIcon.png
Code: YYY
Day_Icon: DayYYYIcon.png
Night_Icon: NightYYYIcon.png
Description: YYY description
No.: 2
Condition (full parent node): ZZZ ZZZ description DayIconZZZ.png NightIconZZZ.png
Code: ZZZ
Day_Icon: DayIconZZZ.png
Night_Icon: NightIconZZZ.png
Description: ZZZ description