xml_parse_into_struct function to determine tag path

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yaron
Forum Contributor
Posts: 157
Joined: Fri Aug 22, 2003 8:40 am

xml_parse_into_struct function to determine tag path

Post by yaron »

Hell all,

I'm using xml_parse_into_struct to parse an xml file.
What I want to do is to to get the tag path for each value in the xml file.
this is what i use to get the path

Code: Select all

<?php
if($item['type'] == "open" || $item['type'] == "complete")
	array_push($tags, $item['tag']);

?>
This is working fine but I need to pop the last value in the $tags array when I see type close like this:

Code: Select all

<?php
if($item['type'] == "close")
   array_pop($tags);
?>
This part doesn't work and I keep adding tags to the array and not popping them when one closes.
any ideas?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

It would be useful to see more code.
Post Reply