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">
Did you know?Explore Trending and Topic pages for more stories like this.
<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

Session
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not

Breaking results into week blocks
I have a set of dates (and times), which are returned from a mySQL query.

These usually span

Material Issuing for receiving batch
Dear All experts in MM/ PP,

Material issuing from main stores to factory is currently usi

Extracting URL pointer within XML tag
Hi.

I'm trying to extract text between two quotation marks in XML. For example, I want to ex

Saving PHP output as a file
I wondered if anyone knows how to save the rendered output of a PHP script as a file?

I have

AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug

RSS feed - FeedList for WordPress
Hi,

I'm trying to alter the FeedList plugin for WordPress so that I can click on the title of

UDP server recvfrom() always returns -1? :(
Hello all,
I am getting a very strange error in my code :( I am writing a server application in C

Mastering Regular Expressions, Third Edition, is available.
The Third Edition of Mastering Regular Expressions is available.

QuoteThis third edition is 5

$_GET problem
Hi all,

Have a bit of a problem with a little piece of code, I am not sure if this should be

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