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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:00:26+00:00 2026-05-16T06:00:26+00:00

So i have this XML structure: <fields> <field name=agent_description label=Agent Description size=area /> <field

  • 0

So i have this XML structure:

<fields>
    <field name="agent_description" label="Agent Description" size="area" />
    <field name="agent_phone" label="Agent Phone" size="field" />
    <field name="agent_email" label="Agent EMail" size="field" />
    <field name="agent_listing_url" label="Agent Listing" size="field" />
    <field name="profile_video_title" label="Profile Video Title" size="field" />
    <field name="profile_video_sub_title" label="Profile Video Sub Title" size="field" />
    <field name="profile_video_url" label="Profile Video (YouTube)" size="field" />

</fields>

i would like to parse this into an array structure that looks like this:

array(
            array("name" => "agent_description", 
                "label" => "Agent Description",
                "size" => "area"),

            array("name" => "agent_phone", 
                "label" => "Agent Phone",
                "size" => "field"),

            array("name" => "agent_email", 
                "label" => "Agent EMail",
                "size" => "field"),

            array("name" => "agent_listing_url", 
                "label" => "Agent Listing",
                "size" => "field"),

            array("name" => "profile_video_title", 
                "label" => "Profile Video Title",
                "size" => "field"),

            array("name" => "profile_video_sub_title", 
                "label" => "Profile Video Sub Title",
                "size" => "field"),

            array("name" => "profile_video_url", 
                "label" => "Profile Video (YouTube)",
                "size" => "field"),
)

whats the best way to accomplish this?

  • 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-16T06:00:27+00:00Added an answer on May 16, 2026 at 6:00 am
    $xml = simplexml_load_string($xml);
    $fields = array();
    foreach ($xml->field as $f) {
        $f = (array) $f->attributes();
        $fields[] = $f['@attributes'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have xml structure like this: <Group id=2 name=Third parentid=0 /> <Group id=6 name=Five
I have this xml <products> <product> <name>Demo</name> </product> <product> <name>Black Beauty III</name> <description>Beautiful les
I have the following XML structure... <Fields> <Field> <Company>My Company</Company> </Field> <Field> <Address2>Villa at
I have an XML document with this structure: <Fruits> <Fruit> <Code>1</Code> <Name>Apple</Name> </Fruit> </Fruits>
I have the following XML structure: <row> <field name=Id>1</field> <field name=AreaId>1</field> <field name=Name>ת&quot;א</field> </row>
I have a directory structure that looks like this: /a/f.xml /b/f.xml /c/f.xml /d/f.xml What
I have an xml file that contains a structure.. In this structure, I have
I have this xml file which has text init. i.e Hi my name is
I have a table like this : YEAR int, Fields XML My XML column
I have some XML that is structured like this: <whatson> <productions> <production> <category>Film</category> </production>

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.