balagod 0 Newbie Poster

Hai,
I got xml parser to read xml file the output is like multi dimensional array ,i want to search particular id and get that matched id details from that array if the element have child to read child array also
I give one example here

<map>
<page id="home" name="Home" content="home.xml" template="home.php" bar="home_bar.xml"/>
<page id="training" name="Training" content="training.xml" template="text.php" bar="training_bar.xml">
<page id="training-trainings" name="Trainings" content="training-trainings.xml" template="text.php" bar="training_bar.xml"/>
<page id="training-workshops" name="Workshops" content="training-workshops.xml" template="text.php" bar="training_bar.xml"/>
</page>
</map>

If i give search id ="training"
The out put is the values in
id="training"
name="Training"
content="training.xml"
template="text.php"
bar="training_bar.xml"

2.If i give search id ="home"
The out put is the values in
id="home"
name="Home"
content="home.xml"
template="home.php"
bar="home_bar.xml"

and child nodes values are need
id="training"
name="Training"
content="training.xml"
template="text.php"
bar="training_bar.xml"

2nd child
id="training-trainings"
name="Trainings"
content="training-trainings.xml"
template="text.php"
bar="training_bar.xml"
<page id="training-workshops" name="Workshops" content="training-workshops.xml" template="text.php" bar="training_bar.xml"/>

My Xml parser out put is like this
Array
(
[map] => Array
(
[page] => Array
(
[0] => Array
(
[id] => home
[name] => Home
[content] => home.xml
[template] => home.php
[bar] => home_bar.xml
[value] =>
)

[1] => Array
(
[page] => Array
(
[0] => Array
(
[id] => training-trainings
[name] => Trainings
[content] => training-trainings.xml
[template] => text.php
[bar] => training_bar.xml
[value] =>
)

[1] => Array
(
[id] => training-workshops
[name] => Workshops
[content] => training-workshops.xml
[template] => text.php
[bar] => training_bar.xml
[value] =>
)

)

[id] => training
[name] => Training
[content] => training.xml
[template] => text.php
[bar] => training_bar.xml
[value] =>
)

)

[value] =>
)

)

Any Expert help me

Thanks
Bala

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.