944,162 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7461
  • PHP RSS
Jul 20th, 2006
0

multi dimensional array search xml parser

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
balagod is offline Offline
20 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: File upload problem
Next Thread in PHP Forum Timeline: php mysql problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC