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 6742951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:54:12+00:00 2026-05-26T11:54:12+00:00

This is driving me crazy, I am trying to get to a specific part

  • 0

This is driving me crazy, I am trying to get to a specific part of this object and it is driving me crazy, here is the object contents:

XMLHandler Object
(
    [doc:XMLHandler:private] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [state] => Live
                )

            [newsListItem] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [href] => http://api.contentplus.co.uk/6cb5ea15-d6b1-4c40-9db7-cb2a3315080b/news/800773226/
                                )

                            [id] => 800773226
                            [publishDate] => 2011-10-24T10:04:49
                            [lastModifiedDate] => 2011-10-24T11:20:40
                            [headline] => Relationships matter on social media
                        )

                )

        )

    [format] => html
) 

I want to get the value of [id] I am trying to access it like this:

echo $niList->doc->newsListItem[0]->id;

but this is giving me nothing, I know I am close (well I hope I am) but I just cant quite get it right, could anyone help please.

Thanks all.

  • 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-05-26T11:54:13+00:00Added an answer on May 26, 2026 at 11:54 am

    Your object dump says

    doc:XMLHandler:private
    

    which means doc is a private property of XMLHandler. As such, you can only access it from within that object via $this. But you are trying to access it from outside the object when you do

    echo $niList->newsListItem[0]->id;
    

    This wont work. Add a method to that XMLHandler object that does what you want to do with that newslistitem id. Also see the chapter on Visibility in the PHP Manual:

    • http://docs.php.net/manual/en/language.oop5.visibility.php
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is driving me crazy. I'm trying to get the footer div to be
This one is driving me crazy. Here's the XAML: <UserControl x:Class=SilverlightApplication1.Page xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml> <Grid
This is driving me crazy, I am trying to do something like: $this->data =
This is driving me crazy! I have read at least 5 questions on here
This has been driving me crazy for 2 days. I have been trying to
This is driving me crazy. I'm trying to figure out how to upload a
ok this is driving me crazy. I have been trying to parse a xml
I'm sure I'm doing something silly, but this is driving me crazy. I'm trying
This has been driving me crazy.. I am trying to return a value from
so this xpath query is driving me crazy. What I'm trying to do is

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.