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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:19:33+00:00 2026-06-10T18:19:33+00:00

I have a simple xml file with nodes and some other info. And i

  • 0

I have a simple xml file with nodes and some other info. And i want to pull out the index from the series node.

XML:

  <record>
    <id>5055</id>
    <uuid>83885ffc-93d8-41ba-aee2-e5c0ae48fc68</uuid>
    <publisher>Now Comics</publisher>
    <size>5803436</size>
    <title sort="Terminator - The Burning Earth 5, The">The Terminator - The Burning Earth 5</title>
    <authors sort="Unknown">
      <author>Unknown</author>
    </authors>
    <timestamp>2012-05-13T19:38:03-07:00</timestamp>
    <pubdate>2012-05-13T19:38:03-07:00</pubdate>
    <series index="5.0">The Terminator: The Burning Earth</series>
    <cover>M:/Comics/Unknown/The Terminator - The Burning Earth 5 (5055)/cover.jpg</cover>
    <formats>
      <format>M:/Comics/Unknown/The Terminator - The Burning Earth 5 (5055)/The Terminator - The Burning Earth 5 - Unknown.cbr</format>
    </formats>
  </record>

PHP:

$dom = new DOMDocument();  
$dom->load($loc);  
foreach ($dom->getElementsByTagName('record') as $e) {

$publisher = $e->getElementsByTagName('publisher')->item(0)->textContent; 
$arc = $e->getElementsByTagName('series')->item(0)->textContent;    
$uuid = $e->getElementsByTagName('uuid')->item(0)->textContent;

}

Now in the xml file at <series index="5.0">The Terminator: The Burning Earth</series> i want to pull out that index="5.0"

  • 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-10T18:19:34+00:00Added an answer on June 10, 2026 at 6:19 pm

    You use the getAttribute() method.

    $dom = new DOMDocument();
    $dom->load($loc);
    foreach ($dom->getElementsByTagName('record') as $e) {
    
        $publisher = $e->getElementsByTagName('publisher')->item(0)->textContent;
        $uuid = $e->getElementsByTagName('uuid')->item(0)->textContent;
    
        $series = $e->getElementsByTagName('series')->item(0);
        $series_index = $series->getAttribute('index');
        $arc = $series->textContent;
    }
    
    echo 'Publisher: '.$publisher.'<br />', //Now Comics
         'UUID: '.$uuid.'<br />', //UUID: 83885ffc-93d8-41ba-aee2-e5c0ae48fc68
         'Index: '.$series_index.'<br />', //Index: 5.0
         'Title: '.$arc.'<hr />'; //Title: The Terminator: The Burning Earth
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple xml file and I want to remove everything before the
I have written simple code to get content from xml file to php. $xml
I have an XML file which has a simple nodes like: <question lang='en'>Do you
I have a LINQ query from an XML file. I am filtering out certain
i have a simple xml file in a wcf service that i am trying
I have this simple XML file : <?xml version=1.0 encoding=utf-8 ?> <Artists> <artist artistId=1>
I have a really simple XML file that I'm trying to read, but I
I have a large xml file (approx. 10 MB) in following simple structure: <Errors>
I have a map that reads an XML file; it's all very simple and
I have an HTML file and i want to convert to XML only using

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.