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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:58:34+00:00 2026-05-13T11:58:34+00:00

Does anybody know how I can get this xml into the domDocument? Right now,

  • 0

Does anybody know how I can get this xml into the domDocument?

Right now, it throws an error saying it is missing a top level element.
What I see is that feed is the toplevel element, so it’s a mystery to me.
This only happens if I run it threw the domDocument and not when I echo it out directly.
The xml validator also gives no errors.

This is the xml:

$xml="<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:gphoto='http://schemas.google.com/photos/2007' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;CEANSXg7cSp7ImA9WxBRGUU.&quot;'><id>http://picasaweb.google.com/data/feed/user/rich3607/albumid/5424469095880909921</id><updated>2010-01-08T20:33:18.609Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#album'/><title>tsa_ch</title><subtitle>chauffeurs</subtitle><rights>private</rights><icon>http://lh6.ggpht.com/_Q3ykLtTspk4/S0eV5xMQ5GE/AAAAAAAAAIY/req43lh-f4I/s160-c/Tsa_ch.jpg</icon><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://picasaweb.google.com/data/feed/api/user/rich3607/albumid/5424469095880909921?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><link rel='alternate' type='text/html' href='http://picasaweb.google.com/rich3607/Tsa_ch?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><link rel='http://schemas.google.com/photos/2007#slideshow' type='application/x-shockwave-flash' href='http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&amp;RGB=0x000000&amp;feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Frich3607%2Falbumid%2F5424469095880909921%3Fauthkey%3DGv1sRgCMvZ79uI6Z__ZQ%26alt%3Drss'/><link rel='http://schemas.google.com/photos/2007#report' type='text/html' href='http://picasaweb.google.com/lh/reportAbuse?uname=rich3607&amp;aid=5424469095880909921'/><link rel='http://schemas.google.com/acl/2007#accessControlList' type='application/atom+xml' href='http://picasaweb.google.com/data/feed/api/user/rich3607/albumid/5424469095880909921/acl?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><link rel='self' type='application/atom+xml' href='http://picasaweb.google.com/data/feed/api/user/rich3607/albumid/5424469095880909921?start-index=1&amp;max-results=500&amp;kind=tag'/><author><name>rich</name><uri>http://picasaweb.google.com/rich3607</uri></author><generator version='1.00' uri='http://picasaweb.google.com/'>Picasaweb</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>500</openSearch:itemsPerPage><gphoto:id>5424469095880909921</gphoto:id><gphoto:location/><gphoto:access>private</gphoto:access><gphoto:timestamp>1262937600000</gphoto:timestamp><gphoto:numphotos>2</gphoto:numphotos><gphoto:numphotosremaining>998</gphoto:numphotosremaining><gphoto:bytesUsed>5866</gphoto:bytesUsed><gphoto:user>rich3607</gphoto:user><gphoto:nickname>rich</gphoto:nickname><gphoto:allowPrints>true</gphoto:allowPrints><gphoto:allowDownloads>true</gphoto:allowDownloads><entry gd:etag='W/&quot;CEANSXg7cSp7ImA9WxBRGUU.&quot;'><id>http://picasaweb.google.com/data/entry/user/rich3607/albumid/5424469095880909921/tag/smarty</id><updated>2010-01-08T20:33:18.609Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#tag'/><title>smarty</title><summary>smarty</summary><link rel='alternate' type='text/html' href='http://picasaweb.google.com/lh/searchbrowse?q=smarty&amp;psc=G&amp;uname=rich3607&amp;filter=0'/><link rel='self' type='application/atom+xml' href='http://picasaweb.google.com/data/entry/api/user/rich3607/albumid/5424469095880909921/tag/smarty?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><author><name>rich</name><uri>http://picasaweb.google.com/rich3607</uri></author></entry><entry gd:etag='W/&quot;CEANSXg7cSp7ImA9WxBRGUU.&quot;'><id>http://picasaweb.google.com/data/entry/user/rich3607/albumid/5424469095880909921/tag/00tx343</id><updated>2010-01-08T20:33:18.609Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#tag'/><title>00tx343</title><summary>00tx343</summary><link rel='alternate' type='text/html' href='http://picasaweb.google.com/lh/searchbrowse?q=00tx343&amp;psc=G&amp;uname=rich3607&amp;filter=0'/><link rel='self' type='application/atom+xml' href='http://picasaweb.google.com/data/entry/api/user/rich3607/albumid/5424469095880909921/tag/00tx343?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><author><name>rich</name><uri>http://picasaweb.google.com/rich3607</uri></author></entry><entry gd:etag='W/&quot;CEANSXg7cSp7ImA9WxBRGUU.&quot;'><id>http://picasaweb.google.com/data/entry/user/rich3607/albumid/5424469095880909921/tag/xpl-amsterdam</id><updated>2010-01-08T20:33:18.609Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#tag'/><title>xpl-amsterdam</title><summary>xpl-amsterdam</summary><link rel='alternate' type='text/html' href='http://picasaweb.google.com/lh/searchbrowse?q=xpl-amsterdam&amp;psc=G&amp;uname=rich3607&amp;filter=0'/><link rel='self' type='application/atom+xml' href='http://picasaweb.google.com/data/entry/api/user/rich3607/albumid/5424469095880909921/tag/xpl-amsterdam?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><author><name>rich</name><uri>http://picasaweb.google.com/rich3607</uri></author><gphoto:weight>2</gphoto:weight></entry><entry gd:etag='W/&quot;CEANSXg7cSp7ImA9WxBRGUU.&quot;'><id>http://picasaweb.google.com/data/entry/user/rich3607/albumid/5424469095880909921/tag/stupid</id><updated>2010-01-08T20:33:18.609Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#tag'/><title>stupid</title><summary>stupid</summary><link rel='alternate' type='text/html' href='http://picasaweb.google.com/lh/searchbrowse?q=stupid&amp;psc=G&amp;uname=rich3607&amp;filter=0'/><link rel='self' type='application/atom+xml' href='http://picasaweb.google.com/data/entry/api/user/rich3607/albumid/5424469095880909921/tag/stupid?authkey=Gv1sRgCMvZ79uI6Z__ZQ'/><author><name>rich</name><uri>http://picasaweb.google.com/rich3607</uri></author></entry></feed>";

this does not work

@$dom = new DOMDocument();      
$dom_xml = $dom->loadXML($xml); 
$output= $dom_xml->saveXML(); 
echo $output;

thanks in adv, Richard

  • 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-13T11:58:35+00:00Added an answer on May 13, 2026 at 11:58 am

    $dom->loadXML($xml); doesn’t return an object when called in an object context (i.e. $obj->loadxml()) but modifies the internal state of the object itself.

    e.g.

    $doc = new DOMDocument();      
    $doc->loadXML($xml) or die('loadxml failed');
    $output= $doc->saveXML(); 
    echo phpversion(), "\n";
    echo '|savexml|=', strlen($output), "\n";
    echo '|children| = ', $doc->documentElement->childNodes->length, "\n";
    

    prints (on my machine)

    5.3.1
    |savexml|=5840
    |children| = 33
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know how can I send an object, to be more specific a
does anybody know if there is a way to do for loops in drools
We provide a webservice to a third-party that expects a 500 error when an
I have recently made a new homepage for my company so that employees can
I can't work out how to stop an absolutely positioned element at a particular
I have a UILocalNotification object that I have setup with repeat intervals day, week,
I am writing an App where we want to have several pages in a
I'm trying to prepend a string a read-only, multi-line TextBox using the following code:
Hey guys, I run a large website where the URL structure for the content
I would like to create a UIButton which uses a stretchable image as Background

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.