Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i fetch value from this xml
    text
    copied!<p>I have xml file from an external url <a href="http://www.xmlcharts.com/cache/precious-metals.xml" rel="nofollow">http://www.xmlcharts.com/cache/precious-metals.xml</a></p> <pre><code>&lt;prices&gt; &lt;pricelist currency="usd"&gt; &lt;price timestamp="1356079920" per="ozt" commodity="gold"&gt;1649.45&lt;/price&gt; &lt;price timestamp="1356079680" per="ozt" commodity="palladium"&gt;676.00&lt;/price&gt; &lt;price timestamp="1356079740" per="ozt" commodity="platinum"&gt;1553.75&lt;/price&gt; &lt;price timestamp="1356079860" per="ozt" commodity="silver"&gt;29.95&lt;/price&gt; &lt;/pricelist&gt; &lt;pricelist currency="eur"&gt; &lt;price timestamp="1356079920" per="ozt" commodity="gold"&gt;1248.80&lt;/price&gt; &lt;price timestamp="1356079680" per="ozt" commodity="palladium"&gt;511.80&lt;/price&gt; &lt;price timestamp="1356079740" per="ozt" commodity="platinum"&gt;1176.34&lt;/price&gt; &lt;price timestamp="1356079860" per="ozt" commodity="silver"&gt;22.68&lt;/price&gt; &lt;/pricelist&gt; &lt;pricelist currency="chf"&gt; &lt;price timestamp="1356079920" per="ozt" commodity="gold"&gt;1507.76&lt;/price&gt; &lt;price timestamp="1356079680" per="ozt" commodity="palladium"&gt;617.93&lt;/price&gt; &lt;price timestamp="1356079740" per="ozt" commodity="platinum"&gt;1420.28&lt;/price&gt; &lt;price timestamp="1356079860" per="ozt" commodity="silver"&gt;27.38&lt;/price&gt; &lt;/pricelist&gt; &lt;/prices&gt; </code></pre> <p>I have used PHP for loading this via </p> <pre><code>$xmlobj = simplexml_load_file($feedurl); print_r($xmlobj-&gt;pricelist); </code></pre> <p>which give output like:</p> <pre><code>SimpleXMLElement Object ( [pricelist] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [@attributes] =&gt; Array ( [currency] =&gt; usd ) [price] =&gt; Array ( [0] =&gt; 1649.45 [1] =&gt; 676.00 [2] =&gt; 1553.75 [3] =&gt; 29.95 ) ) [1] =&gt; SimpleXMLElement Object ( [@attributes] =&gt; Array ( [currency] =&gt; eur ) [price] =&gt; Array ( [0] =&gt; 1248.80 [1] =&gt; 511.80 [2] =&gt; 1176.34 [3] =&gt; 22.68 ) ) [2] =&gt; SimpleXMLElement Object ( [@attributes] =&gt; Array ( [currency] =&gt; chf ) [price] =&gt; Array ( [0] =&gt; 1507.76 [1] =&gt; 617.93 [2] =&gt; 1420.28 [3] =&gt; 27.38 ) ) ) ) </code></pre> <p>I have tried <code>$xmlobj-&gt;pricelist</code> but cant get the <strong>price</strong> value...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload