<?xml version="1.0" encoding="utf-8"?>
<s1 title="XML"><p></p>
<s2 id="XML Functions" title="XML Functions">
<p><p>Contents</p>
<ol><li>
<link anchor="X">XML Functions</link><ol><li>
<link anchor="x">xml()</link><ol><li><ol><li>
<link anchor="X-1">XML Example</link></li>
</ol>
</li>
</ol>
</li>
<li>
<link anchor="G">GetFortsFromXML()</link><ol><li><ol><li>
<link anchor="F">Forts Example</link></li>
</ol>
</li>
</ol>
</li>
<li>
<link anchor="G-1">GetTroopsFromXML()</link><ol><li><ol><li>
<link anchor="T">Troops Example</link></li>
</ol>
</li>
</ol>
</li>
<li>
<link anchor="G-2">GetResourcesFromXML()</link><ol><li><ol><li>
<link anchor="R">Resources Example</link></li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p> </p>
<p></p>
<s3 id="xml()" title="xml()">
<p>The <strong>xml()</strong> function allows you to manipulate xml files/links by fetch the data from within them. </p>
<p></p>
<s5 id="XML Example" title="XML Example">
<p></p>
<source><![CDATA[url = "http://battleXXXXX.evony.com/logfile/20150810/AA/BB/ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.xml"
get url
if $error die "Failed to load the xml file {url}."
report = xml($result)]]></source><p>In this example if the URL was successfully loaded it will attempt to extract any XML values from it. These are applied to the variable &quot;report&quot;. </p>
<p></p>

<br/>------------------------------------------------------------------------------<br/>
<p> </p>
<p></p>
</s5>
</s4>
</s3>
<s3 id="GetFortsFromXML()" title="GetFortsFromXML()">
<p>This converts fortifications in an XML list to a FortificationsBean. An optional second parameter can specify a property name containing the number of fortifications (default = &quot;count&quot;). </p>
<p></p>
<s5 id="Forts Example" title="Forts Example">
<p></p>
<source><![CDATA[url = "http://battleXXXXX.evony.com/logfile/20150810/AA/BB/ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.xml"
get url
if $error die "Failed to load the XML file {url}."
report = xml($result)
forts = GetFortsFromXML(report.scoutReport.scoutInfo.fortifications.fortificationsType)]]></source><p>This example shows us creating a FortificationsBean object under the variable &apos;forts&apos;. The object contains the forts information from the XML report. </p>
<p></p>

<br/>------------------------------------------------------------------------------<br/>
<p> </p>
<p></p>
</s5>
</s4>
</s3>
<s3 id="GetTroopsFromXML()" title="GetTroopsFromXML()">
<p>This converts troops in an XML list to a TroopBean. An optional second parameter can specify a property name containing the number of troops (default = &quot;count&quot;) This functions replaces no longer available xmlTroopsToTroopBean() function. </p>
<p></p>
<s5 id="Troops Example" title="Troops Example">
<p></p>
<source><![CDATA[url = "http://battleXXXXX.evony.com/logfile/20150810/AA/BB/ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.xml"
get url
if $error end
report = xml($result)
troops = GetTroopsFromXML(report.scoutReport.scoutInfo.troops.troopStrType)]]></source><p>This example shows us creating a TroopBean object under the variable &apos;troops&apos;. The object contains the troop information from the XML report. </p>

<br/>------------------------------------------------------------------------------<br/>
<p> </p>
<p></p>
</s5>
</s4>
</s3>
<s3 id="GetResourcesFromXML()" title="GetResourcesFromXML()">
<p>Same purpose as troops and fortifications above.. but for resources. </p>
<p></p>
<s5 id="Resources Example" title="Resources Example">
<p></p>
<source><![CDATA[// requires valid report url with "default.html?" removed
     url = "http://battleXXXXX.evony.com/logfile/20150710/AA/BB/ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.xml"
     get url
     if $error end
     report = xml($result)
     res = GetResourcesFromXML(report.battleReport.lootResource)
     if res echo "Resources: " + res]]></source><p></p>

<br/>------------------------------------------------------------------------------<br/>
<p> <jump href="/wiki/CategoryFunctions">CategoryFunctions</jump> </p>
</s5></s4></s3></s2></s1>