Hi
I am facing a problem with xml parsing.My xml is like this
<textlist><textitem>
<text>
disc 1
</text>
<type>
disc_title
</type>
</textitem>
<textitem>
<text>
cd
</text>
<type>
cd_title
</type>
</textitem>
<textitem>
<text>
disk asdf
</text>
<type>
disc_text
</type>
</textitem>
<textitem>
<text>
cd has ddf
</text>
<type>
cd_text
</type>
</textitem>
<textitem>
<text>
disc_img.png
</text>
<type>
disc_image
</type>
</textitem>
</textlist>
To fetch the disc related data i have stored types in db in a table in three columns(item_title(disc_title),item_text(disc_text),item_image(disc_image)) .While parsing I want to fetching the types from db and comparing them with xml (<type>) types and read corresponding <text> values.But the problem is the tags are not in sequence.for disc title ,text,image are not in sequence.How is it possible to read the disc info and store in an array for further processing.
eg.I want the data like item_array['title'],item_array['text'],item_array['image'].I have tried like this
$info = $xml->{'textlist'}->{'textitem'};
foreach(info as $item_details)
{
if(in_array( $item_details->{'type'},$dbtablearray['item_title']))
{
$title = $item_details->{'text'};
}
if(in_array( $item_details->{'type'},$dbtablearray['item_text']))
{
$text = $item_details->{'text'};
}
}
$item_array =array('title'=>$title ........) like this