Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9256571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:58:31+00:00 2026-06-18T11:58:31+00:00

I am having trouble getting all the data from my XML. Can any one

  • 0

I am having trouble getting all the data from my XML. Can any one shed some light please.

My XML is as follows

<storeitems>
<PRODUCT ITEM="3002074730">
<SPECIALS_ID>14713</SPECIALS_ID>
<FULL_PRICE>27.00</FULL_PRICE>
<SPECIALS_NEW_PRODUCTS_PRICE>25.65</SPECIALS_NEW_PRODUCTS_PRICE>
</PRODUCT>
<PRODUCT ITEM="SE-0088-10-3">
<SPECIALS_ID>29555</SPECIALS_ID>
<FULL_PRICE>53.99</FULL_PRICE>
<SPECIALS_NEW_PRODUCTS_PRICE>51.29</SPECIALS_NEW_PRODUCTS_PRICE>
</PRODUCT>
<storeitems>

My code is as follows

$xml = new SimpleXMLElement($data);

foreach($xml->PRODUCT as $post) {

    echo $post->SPECIALS_ID .'<BR>';
    echo $post->FULL_PRICE . '<BR>';
    echo $post->SPECIALS_NEW_PRODUCTS_PRICE . '<BR>';
}

This does what I expect but can you assist me in getting this part of the XML to echo please

<PRODUCT ITEM="3002074730">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:58:33+00:00Added an answer on June 18, 2026 at 11:58 am
    echo $post->attributes();
    

    will print the value of your item (first) attribute (it’s an object that does that when it’s called in a string-context).

    If you add more attributes and you want to get them all, you can iterate over $post->attributes():

    foreach($post->attributes() as $name => $value){
      ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble getting some data.... I was wondering if someone can help me,
im having trouble getting a string (containing a URL) from one activity to another.
I'm having trouble getting JSON data from my Rails app to display on a
I'm having trouble getting JQuery to load in IE7, works fine in all other
I am having trouble getting dynamic content coming from a custom handler to be
I am having trouble with drilling down some data, this is the table structure
I'm having some trouble here. I've got a tableview, with 7 cells, all of
I am moving from Apache 1.3 to Apache 2.063 and am having trouble getting
I'm having trouble getting this loop to return all of the rows that I
I am getting some data from the net, which gets parsed with JSoup in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.