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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:48:51+00:00 2026-06-03T09:48:51+00:00

Hi, i have a simple problem. When i try to convert an atom XML

  • 0

Hi, i have a simple problem. When i try to convert an atom XML string to simplexml object or using simplexml_load_data function, it seems to drop many attributes data..

like in my original string i have

<?xml version="1.0" encoding="UTF-8"?>
<feed gd:kind="customsearch#search" xmlns="http://www.w3.org/2005/Atom" xmlns:cse="http://schemas.google.com/cseapi/2010" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
 <title>Google Custom Search - flower</title>
 <id>tag:www.googleapis.com,2010-09-29:/customsearch/v1?q=flower&amp;&amp;num=10&amp;start=1&amp;safe=off</id>
 <author>
  <name>- Google Custom Search</name>
 </author>
 <updated>1970-01-16T10:55:22.093Z</updated>
 <opensearch:Url type="application/atom+xml" template="https://www.googleapis.com/customsearch/v1?q={searchTerms}&amp;num={count?}&amp;start={startIndex?}&amp;lr={language?}&amp;safe={cse:safe?}&amp;cx={cse:cx?}&amp;cref={cse:cref?}&amp;sort={cse:sort?}&amp;filter={cse:filter?}&amp;gl={cse:gl?}&amp;cr={cse:cr?}}&amp;googlehost={cse:googleHost?}&amp;c2coff={?cse:disableCnTwTranslation}&amp;hq={cse:hq?}&amp;hl={cse:hl?}&amp;siteSearch={cse:siteSearch?}&amp;siteSearchFilter={cse:siteSearchFilter?}&amp;exactTerms={cse:exactTerms?}&amp;excludeTerms={cse:excludeTerms?}&amp;linkSite={cse:linkSite?}&amp;orTerms={cse:orTerms?}&amp;relatedSite={cse:relatedSite?}&amp;dateRestrict={cse:dateRestrict?}&amp;lowRange={cse:lowRange?}&amp;highRange={cse:highRange?}&amp;searchType={cse:searchType?}&amp;fileType={cse:fileType?}&amp;rights={cse:rights?}&amp;imgsz={cse:imgsz?}&amp;imgtype={cse:imgtype?}&amp;imgc={cse:imgc?}&amp;imgcolor={cse:imgcolor?}&amp;alt=atom"/>
 <opensearch:Query role="request" title="Google Custom Search - flower" totalResults="98800000" searchTerms="flower" count="10" startIndex="1" inputEncoding="utf8" outputEncoding="utf8" cse:safe="off" cse:cx="g"/>
 <opensearch:Query role="cse:nextPage" title="Google Custom Search - flower" totalResults="98800000" searchTerms="flower" count="10" startIndex="11" inputEncoding="utf8" outputEncoding="utf8" cse:safe="off" cse:cx="0vv1rbg"/>
 <opensearch:totalResults>98800000</opensearch:totalResults>
 <opensearch:startIndex>1</opensearch:startIndex>

but when i convert it to xml using

        $xml = simplexml_load_string($rs);
        print_r($xml);

my output is like below. All the key information like number of searches, total results set is gone..

SimpleXMLElement Object
(
    [title] => Google Custom Search - flower
    [id] => tag:www.googleapis.com,2010-09-29:/customsearch/v1?q=flower&cx=&num=10&start=1&safe=off
    [author] => SimpleXMLElement Object
        (
            [name] => Search Engine - Google Custom Search
        )

    [updated] => 1970-01-16T10:55:22.093Z
    [entry] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [id] => http://en.wikipedia.org/wiki/Flower
                    [updated] => 1970-01-16T10:55:22.093Z
                    [title] => <b>Flower</b> - Wikipedia, the free encyclopedia
                    [link] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [href] => http://en.wikipedia.org/wiki/Flower
                                    [title] => en.wikipedia.org
                                )

                        )

                    [summary] => A <b>flower</b>, sometimes known as a bloom or blossom, is the reproductive structure <br>  found in <b>flowering</b> plants (plants of the division Magnoliophyta, also called <b>...</b>
                )
  • 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-03T09:48:52+00:00Added an answer on June 3, 2026 at 9:48 am

    Those elements are not gone, you just can’t “see” them in a standard dump, because they are in a different namespace. You can still iterate over them like this:

    foreach ($xml->children('opensearch', TRUE) as $element) {
        echo $element->getName(), "\n";
    }
    

    Where 'opensearch' indicates the namespace prefix and TRUE means that you used the document specific prefix instead of the full namespace url.

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

Sidebar

Related Questions

I have a simple problem but no matter what I try I can't see
I have some problem's with a simple application in JSF 2.0. I try to
I have a simple problem with XML got from database. Now, this XML can
I have this simple problem. I'll try to explain with a sample code An
I'm writing a script to convert very simple function documentation to XML in python.
I have a weird problem. I have a simple function to open a popup
Error: Cannot convert type 'string' to 'object[*,*]' That's the error I have been getting.
I have a simple problem that i cannot solve. I have a dictionary: aa
I have a simple problem but I am not sure how to solve it.
I have a simple problem. I have a path to a file in user

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.