Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

dynamic pulldown generated from xml
Hi!
I'm rather new to php programming, so please don't bash me if this seems
trivial to you.
What I am trying to do is write a small programm which reads an xml file
via domxml and then outputs dynamic pulldown lists (for javascript),
which depend on each other. The problem isn't generating the lists, but
rather getting php to output the elements in the right order.
Just a small xml file example:

<country>West India
<region>Assam
<location>Nalbari</location>
</region>
<region> Bihar
<location>Bodh Gaya</location>
<location>Chatra</location>
</region>
</country>

followed by further countries and regions etc.
I have no problem reading tagnames and content tags, but I'm not quite
sure on how to start.
I managed the first list by simply using get_element_by tagname, but the
first isn't dynamic.
What I need is a way to iterate through the elements and output content
of the parent and of all its child nodes (in that order). I tried to do
this recursively, but I always end up getting last children first and
then the algorithm goes back up the array and gets the next node. Giving
me this output:

West India | Assam | Nalbari | Bihar Bodh | Gaya | Chatra

Actually my code behaves, just as you would expect a tree walking
algorithm to work, it's just that I want the output in this order:

first: West India | and | all | the | other | countries...

2nd: parent:West India | Assam | Bihar

3rd: parent:Assam | Nalbari
parent:Bihar | Bodh Gaya | Chatra

Any help would be great, maybe just a hint into the right direction
would do the trick.

Thank you,
Sean

Report this thread to moderator Post Follow-up to this message
Old Post
sean
03-27-04 04:12 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 02:55 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.