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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:53:55+00:00 2026-05-19T21:53:55+00:00

How do i get all the seat child nodes and their attributes from this

  • 0

How do i get all the “seat” child nodes and their attributes from this XML file?

   <seatmap id="1">
      <seat row="A" seatnum="01" available="1" />
      <seat row="A" seatnum="02" available="1" />
      <seat row="A" seatnum="03" available="1" />
      <seat row="A" seatnum="04" available="1" />
      <seat row="A" seatnum="05" available="1" />
    </seatmap>

I have different seatmaps, so i want to get them by querying with an ID
then assigning all the ‘seat’ nodes and their attributes to variables.

I’ve been using DOM methods so far, but maybe simpleXML or XPath would be easier as its really
confusing as you drill down from DOMDocumet, DOMElement, DOMNode.

Any help would be great, cheers!

  • 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-19T21:53:55+00:00Added an answer on May 19, 2026 at 9:53 pm
    $XML = <<<XML
    <parent>
       <seatmap id="1">
          <seat row="A" seatnum="01" available="1" />
          <seat row="A" seatnum="02" available="1" />
          <seat row="A" seatnum="03" available="1" />
          <seat row="A" seatnum="04" available="1" />
          <seat row="A" seatnum="05" available="1" />
        </seatmap>
    </parent>
    XML;
    
    $xml_nodes = new SimpleXMLElement($XML);
    
    $nodes = $xml_nodes->xpath('//seatmap[@id = "1"]/seat'); // Replace the ID value with whatever seatmap id you're trying to access
    
    foreach($nodes as $seat)
    {
        // You can then access: $seat['row'], $seat['seatnum'], $seat['available']
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i get all child nodes from sql table? (MemberJoiners table on pict)
I am trying to get all tags values from xml and want to store
I would like to get all values which Intersect from this LINQ query: Where(x
How can i get all data from this 2 tables: Events cid date 1
To get all contacts I'm using ABAddressBookCopyArrayOfAllPeople method but, this method return all contacts
I am trying to get all Books from the server (local PHP script), that
I'm trying to get all downloads from an repo on github with help of
How can I get all the attributes of a HTML tag? listinp = soup('input')
i'm trying to get all the images from a facebook group using facebook API
How can i get all the nested tag elements from a struts2 tag? for

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.