XML Grouping


Posted on 16th Feb 2014 07:03 pm by admin

I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, here's the XML

<categories>
<category id="12345">
<title>category title 1</title>
<tips>
<tip id="0">
<title>hello world</title>
<content>some content</content>
</tip>
<tip id="1">
<title>foo</title>
<content>foo content</content>
</tip>
</tips>
</category>
<category id="7890">
<title> category title 2</title>
<tips>
<tip id="2">
<title>another tip title</title>
<content>blah blah</content>
</tip>
<tip id="3">
<title>another tip title</title>
<content>blah blah</content>
</tip>

</tips>
</category>
</categories>


How would I just grab the tip titles for the 2nd category (7890)? Hope I'm making sense.
I can loop through the array using foreach, but have no way to determine if a tip belongs to the 1st or 2nd category. Ideas??

Please help!

Thanks

No comments posted yet

Your Answer:

Login to answer
170 Like 5 Dislike
Previous forums Next forums
Other forums

links using header()
Hi All

I'm not sure where to ask for help on this but I hope someone can offer some. I'm at

Switch letters in message (basic cryptology)...
I am trying to switch letters around in a message for an application on my site (see here). The prob

Custom Container in module pool program
Hello everyone,

I have created a custom control in my module pool screen. Now I want to s

How to replace search button with link?
hi to everbody.
i have a search submit form and button like this :

<form id="f

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

Using unserialize()
Hi there.

I have some data in my database that is serialized.

e.g.

a:2:{i:0

Transport data between itab and textfield on ALV event
Hallo,

I have a ALV Grid ( cl_gui_alv_grid ) and I also have hotspot click event with a h

Problem with the Update command used with a sqldataadapter
I'm connected to a database on an SQL Server and I'm using a sqldataadapter, sqlconnection, sqldatas

MySQL query problem
When I try to run the following piece of code, I get this error:
QuoteWarning: mysql_query(): sup

Problem with PHP/mySQL login code
Hello,

There is an error in my login script and I can't figure out what it is...
I believe

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash