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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:08:22+00:00 2026-06-01T00:08:22+00:00

I have an xml string below that I’ve turned into an object using $content

  • 0

I have an xml string below that I’ve turned into an object using

$content = mb_convert_encoding($content, "ASCII");
$obj = new SimpleXMLElement($content);

The structure of obj is perfectly matching the xml. However trying to get an array of sets without the parent “set” node is causing me issues.
I do

foreach($obj->group as $currentGroup)
{

From inside here if I do $currentGroup->sets I then see a set node with numbering under it, 0 and 1, and under it the structure of the subtest.
My problem is it I try to do $currentGroup->sets->set (to try to get an array of sets without the parent then I get the first set automatically and none of the others ones.
enter image description here

<global>
    <group name="bce">
        <sets>
            <set name="a">
                <subsets>
                    <subset name="bla"/>
                    <subset name="bla2"/>
                    <subset name="bla3"/>
                </subsets>
            </set>
            <set name="b" />
                <subsets>
                    <subset name="bla"/>
                    <subset name="bla2"/>
                    <subset name="bla3"/>
                </subsets>
            </set>
            <set name="c" />
                <subsets>
                    <subset name="bla"/>
                    <subset name="bla2"/>
                    <subset name="bla3"/>
                </subsets>
            </set>
            <set name="d" />
                <subsets>
                    <subset name="bla"/>
                    <subset name="bla2"/>
                    <subset name="bla3"/>
                </subsets>
            </set>
        </subgroupones>
    </group>
    <group name="ert">
        <sets>
            <set name="aa">
                <subsets>
                    <subset name="bla"/>
                    <subset name="bla2"/>
                    <subset name="bla3"/>
                </subsets>
            </set>
            <set name="bb" />
                <subsets>
                    <subset name="bla"/>
                    <subset name="bla2"/>
                    <subset name="bla3"/>
                </subsets>
            </set>
        </subgroupones>
    </group>
</global>
  • 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-01T00:08:23+00:00Added an answer on June 1, 2026 at 12:08 am

    So you want an array of the set nodes? Should be $currentGroup->sets->children() unless I’m missing something.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml document object that I need to convert into a string.
I have an object that can build itself from an XML string, and write
Currently, I have a String object that contains XML elements: String carsInGarage = garage.getCars();
I have an XML string that is loaded into an XMLDocument, similar to the
I have code as below: var s : String = hello world var xml
I have to replace the content of this xml string through java <My:tag>value_1 22&#xA;value_2
I have a function that outputs an XML string: <expensesAC> <cashflow> <month>6</month> <cash>300</cash> <projected>null</projected>
I'm attempting to remove Component elements from the XML below that have File children
I have an XML file containing seed data that I'm trying to load into
I have an XML file that I need to transform using an XSL script.

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.