Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Reading Plist simplexml - Whats the Correct Syntax
    primarykey
    data
    text
    <p>I'm reading a plist using <code>simplexml_load_file</code> the plist I have opens as checked using <code>var_dump</code> however I'm not sure of the syntax to actually access the items. All i need to get is 2 pieces of info.</p> <p>The var_dump from simplexml_load_file looks like the below. All i want is the text "SimpleCalculator"</p> <pre><code>object(SimpleXMLElement)#1 (2) { ["@attributes"]=&gt; array(1) { ["version"]=&gt; string(3) "3.0" } ["dict"]=&gt; object(SimpleXMLElement)#2 (2) { ["key"]=&gt; string(5) "items" ["array"]=&gt; object(SimpleXMLElement)#3 (1) { ["dict"]=&gt; object(SimpleXMLElement)#4 (3) { ["key"]=&gt; array(2) { [0]=&gt; string(6) "assets" [1]=&gt; string(8) "metadata" } ["array"]=&gt; object(SimpleXMLElement)#5 (1) { ["dict"]=&gt; object(SimpleXMLElement)#7 (2) { ["key"]=&gt; array(2) { [0]=&gt; string(4) "kind" [1]=&gt; string(3) "url" } ["string"]=&gt; array(2) { [0]=&gt; string(16) "software-package" [1]=&gt; string(7) "__URL__" } } } ["dict"]=&gt; object(SimpleXMLElement)#6 (2) { ["key"]=&gt; array(5) { [0]=&gt; string(17) "bundle-identifier" [1]=&gt; string(14) "bundle-version" [2]=&gt; string(4) "kind" [3]=&gt; string(5) "title" [4]=&gt; string(8) "subtitle" } ["string"]=&gt; array(5) { [0]=&gt; string(16) "SimpleCalculator" [1]=&gt; string(3) "000" [2]=&gt; string(8) "software" [3]=&gt; string(33) "com.mywork.demo" [4]=&gt; string(3) "1.0" } } } } } } </code></pre> <p>And the XML Looks like:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="3.0"&gt; &lt;dict&gt; &lt;key&gt;items&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;assets&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;kind&lt;/key&gt; &lt;string&gt;software-package&lt;/string&gt; &lt;key&gt;url&lt;/key&gt; &lt;string&gt;__URL__&lt;/string&gt; &lt;/dict&gt; &lt;/array&gt; &lt;key&gt;metadata&lt;/key&gt; &lt;dict&gt; &lt;key&gt;bundle-identifier&lt;/key&gt; &lt;string&gt;SimpleCalculator&lt;/string&gt; &lt;key&gt;bundle-version&lt;/key&gt; &lt;string&gt;000&lt;/string&gt; &lt;key&gt;kind&lt;/key&gt; &lt;string&gt;software&lt;/string&gt; &lt;key&gt;title&lt;/key&gt; &lt;string&gt;com.mywork.demo&lt;/string&gt; &lt;key&gt;subtitle&lt;/key&gt; &lt;string&gt;1.0&lt;/string&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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