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

  • Home
  • SEARCH
  • 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 8692095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:15:05+00:00 2026-06-13T00:15:05+00:00

I use Simplexml and xpath to parse my XML. This is my xml output:

  • 0

I use Simplexml and xpath to parse my XML.

This is my xml output:

<?xml version="1.0"?>
<api>
 <query>
<categorymembers>
  <cm pageid="30908" ns="0" title="Thomas Acda" />
  <cm pageid="46896" ns="0" title="Elvan Akyildiz" />
  <cm pageid="21162" ns="0" title="Jenny Arean" />
  <cm pageid="30913" ns="0" title="Tijl Beckand" />
  <cm pageid="829" ns="0" title="Yoka Berretty" />
  <cm pageid="45" ns="0" title="Wim de Bie" />
  <cm pageid="31894" ns="0" title="Jan Blaaser" />
  <cm pageid="832" ns="0" title="Karin Bloemen" />
  <cm pageid="833" ns="0" title="Hetty Blok" />
  <cm pageid="12473" ns="0" title="Ron Boszhard" />
  <cm pageid="34605" ns="0" title="Ansje van Brandenberg" />
  <cm pageid="8451" ns="0" title="Claudia de Breij" />
  <cm pageid="678" ns="0" title="Jos Brink" />
  <cm pageid="29595" ns="0" title="Joke Bruys" />
  <cm pageid="30909" ns="0" title="Horace Cohen" />
  <cm pageid="689" ns="0" title="Gerard Cox" />
  <cm pageid="32008" ns="0" title="Pieke Dassen" />
  <cm pageid="31047" ns="0" title="Wieteke van Dort" />
  </categorymembers>
 </query>
</api>

and this my code to display the title.

<?php
 $xml = new SimpleXMLElement('http://www.beeldengeluidwiki.nl/api.php?action=query&list=categorymembers&cmtitle=Category:Cabaretier&cmlimit=400', null, true);
$data = $xml->xpath("/api/query/categorymembers/cm");

foreach ($data as $item) {
echo $item['title'];
}

?>
  • 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-13T00:15:06+00:00Added an answer on June 13, 2026 at 12:15 am

    They are attributes

    $xml = new SimpleXMLElement($xml);
    echo "<pre>";
    foreach($xml->query->categorymembers->children() as $cm)
    {
        list($pageid, $ns, $title) = $cm->attributes();
        echo $pageid , " " , $ns  , " " , $title , PHP_EOL ;
    }
    

    Output

    30908 0 Thomas Acda
    46896 0 Elvan Akyildiz
    21162 0 Jenny Arean
    30913 0 Tijl Beckand
    829 0 Yoka Berretty
    45 0 Wim de Bie
    31894 0 Jan Blaaser
    832 0 Karin Bloemen
    833 0 Hetty Blok
    12473 0 Ron Boszhard
    34605 0 Ansje van Brandenberg
    8451 0 Claudia de Breij
    678 0 Jos Brink
    29595 0 Joke Bruys
    30909 0 Horace Cohen
    689 0 Gerard Cox
    32008 0 Pieke Dassen
    31047 0 Wieteke van Dort
    

    See Live Demo

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

Sidebar

Related Questions

Following suggestions on this site, I have adopted SimpleXML from org.simpleframework.xml. I use this
I am accessing the gData Api on YouTube. I'll use this xml for reference.
I'm trying to use SimpleXML to read some NCBI BLAST XML output, and I'm
I've been trying to use SimpleXML , but it doesn't seem to like XML
Welcome all It is possible to use SimpleXML for android in commercial apps? THis
I need an XML parser like SimpleXML, to use in commercial apps. I think
What's the best API I can use to do some simple XML read/writing? I'm
First things first. I know how to parse XML/HTML with simplexml, and I know
simply i use simplexml_load_file to parse xml file when i used it to parse
I use SimpleXml to write XML file to internal storage in Android device. The

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.