You are here: Error with DOMDocument->saveXML() « PHP « IT news, forums, messages
Error with DOMDocument->saveXML()

Posted by Stephen Leaf on 09/28/05 20:37

Ok how I have things set up is I have a Document Object which when
instantiated creates a root element and adds it to the DOM object.
After that all population of this node is done on the requested page.

When I'm done populating I output my header()'s and then echo my Document
Object. I've overridden the __toString() method.
Once here it does 1 of 2 things.
Transform via XSL or just dump the XML via saveXML()
to do this either I do a:
$this->outXML = isset($_GET['xml']);
This makes it so on any page I can add a ?xml and get the raw untransformed
XML.

So first I don't have that switch on and I get my fully populated website
nicely done up by XSL.
Then I throw that switch on and I get:
<br />
<b>Fatal error</b>: Method Document::__toString() must return a string value
in <b>/srv/www/localhost/htdocs/db/index.php</b> on line <b>140</b><br />

which is very interesting because as I just said the transform via XSL was
done just fine which proves that I do in fact have a fully populated node.
So thinking I might have made an error with that ?xml switch I check my code
over.. everything is in order but for the sake of testing I commented out the
transformXML line and paste my return saveXML line refresh... same error.
So now we know that there is nothing wrong my ?xml switch.

So now it could still be the method saveXML(). I've not tested this
functionality of my site in a while I did recently upgrade to 5.0.5 I'm not
positive but I'm pretty sure it's worked since then tho. But anyway to test
the method I did a:
$this->Dom = DOMDocument::loadXML("<a>asdf</a>");
echo $this->Dom->saveXML(); // Same line that's always been there.

and it works. So the function does work... Now what?
Is there anything else I can try? could this be a PHP bug? I am completely
confused on what is going on...
I've not checked my E_NOTICE's yet.. actually not quite sure how to turn these
on, on a per site basis (if that's even possible.) I'll take even a server
wide solution if it means getting more on how to fix this. I'd figure this
part out myself but I'm due to get off to work in... -4 mins (or 4 mins
ago :)).

Thanks,
Stephen Leaf

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация