I am using PHP and am using the simplexml_load_string. I am having difficulties getting the values at the child node level.
$tmpObject=simplexml_load_string("video.xml");
$tmpObject=$tmpObject->xpath("//video-block");
$this->videoObject=array_merge($this->videoObject,$tmpObject);
foreach($this->videoObject as $key => $video) {
echo "$key) Name: ".$video->name."
";
echo "$key) : ".$video->path."
";
}
How do i retrieve the values for height and file from \video-block\video-data-structure\video-player\media
Here are the video.xml contents:
<system-video>
<video-block>
<name>video1</name>
<path>http://mycompany.com</path>
<dynamic-metadata>
<name>Navigation Level</name>
<value>Undefined</value>
</dynamic-metadata>
<video-data-structure>
<video-player>
<player>
<width>505</width>
<height>405</height>
</player>
<media>
<playlistfile/>
<file>playvideo.m4v</file>
<image>http://mycompany.com/jsmith.jpg</image>
<duration/>
<start/>
</media>
</video-player>
</video-data-structure>
</video-block>
<video-block>
<name>video2</name>
<path>http://mycompany.com</path>
<dynamic-metadata>
<name>Navigation Level</name>
<value>Undefined</value>
</dynamic-metadata>
<video-data-structure>
<video-player>
<player>
<width>505</width>
<height>405</height>
</player>
<media>
<playlistfile/>
<file>playvideo2.m4v</file>
<image>http://mycompany.com/Tmatthews.jpg</image>
<duration/>
<start/>
</media>
</video-player>
</video-data-structure>
</video-block>
</system-video>