Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieving CDATA contents from XML using PHP and simplexml
    primarykey
    data
    text
    <p>I have the following XML structure:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;course xml:lang="nl"&gt; &lt;body&gt; &lt;item id="787900813228567" view="12000" title="0x|Beschrijving" engtitle="0x|Description"&gt;&lt;![CDATA[Dit college leert studenten hoe ze een onderzoek kunn$ &lt;item id="5453116633894965" view="12000" title="0x|Onderwijsvorm" engtitle="0x|Method of instruction"&gt;&lt;![CDATA[instructiecollege]]&gt;&lt;/item&gt; &lt;item id="7433550075448316" view="12000" title="0x|Toetsing" engtitle="0x|Examination"&gt;&lt;![CDATA[Opdrachten/werkstuk]]&gt;&lt;/item&gt; &lt;item id="015071401858970545" view="12000" title="0x|Literatuur" engtitle="0x|Required reading"&gt;&lt;![CDATA[Wayne C. Booth, Gregory G. Colomb, Joseph M. Wi$ &lt;item id="5960589172957031" view="12000" title="0x|Uitbreiding" engtitle="0x|Expansion"&gt;&lt;![CDATA[]]&gt;&lt;/item&gt; &lt;item id="3610066867901779" view="12000" title="0x|Aansluiting" engtitle="0x|Place in study program"&gt;&lt;![CDATA[]]&gt;&lt;/item&gt; &lt;item id="19232369892482925" view="12000" title="0x|Toegangseisen" engtitle="0x|Course requirements"&gt;&lt;![CDATA[]]&gt;&lt;/item&gt; &lt;item id="3332396346891524" view="12000" title="0x|Doelgroep" engtitle="0x|Target audience"&gt;&lt;![CDATA[]]&gt;&lt;/item&gt; &lt;item id="6606851872934866" view="12000" title="0x|Aanmelden bij" engtitle="0x|Enrollment at"&gt;&lt;![CDATA[]]&gt;&lt;/item&gt; &lt;item id="1478643580820973" view="12000" title="0x|Informatie bij" engtitle="0x|Information at"&gt;&lt;![CDATA[Docent]]&gt;&lt;/item&gt; &lt;item id="9710608434763993" view="12000" title="0x|Rooster" engtitle="0x|Schedule"&gt;&lt;![CDATA[1e semester, maandag 15.00-17.00, zaal 1175/030]]&gt;&lt;/item&gt; &lt;/body&gt; &lt;/course&gt; </code></pre> <p>I want to get the data from one of the item tags. To get to this tag, I use the following xpath:</p> <pre><code>$description = $xml-&gt;xpath("//item[@title='0x|Beschrijving']"); </code></pre> <p>This does indeed return an array in the form of:</p> <pre><code>Array ( [0] =&gt; SimpleXMLElement Object ( [@attributes] =&gt; Array ( [id] =&gt; 787900813228567 [view] =&gt; 12000 [title] =&gt; 0x|Beschrijving [engtitle] =&gt; 0x|Description ) ) ) </code></pre> <p>But where is the actual information (that is stored between the item tags) located? I must be doing something wrong, but I can't figure out what that might be... Probably something really simple... Help would be appreciated.</p>
    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.
 

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