Re: Error with DOMDocument->saveXML()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 29 September 2005 09:37 am, Scott Fletcher wrote:
> It is just that not many work with XML often enough to know well enough how
> to use it.  I noticed many folks have different way of using XML that
> doesn't best fit our need.
It is a newer idea of how to do things.

>
> I have this same problem as well.  So, you're not the only one here as I
> have this same problem as well.
Glad I'm not in this boat alone!

I almost have a sneaky suspicion that it has something to do with the 
__toString()
I've noticed in the past I couldn't do somethings that I normally could do in 
custom functions. think it had something to do with constants but then that 
was when I didn't have much experience with php5 objects so it's very likely 
that was just stupidity on my behalf.
Not played around with it too much since then however. So I guess nows a 
better time than ever. hopefully I can duplicate this behavior in a smaller 
class that I can just post to the list.

>
> "Stephen Leaf" <smileaf@xxxxxxxxxxx> wrote in message
> news:200509290932.17829.smileaf@xxxxxxxxxxxxxx
>
> > On Thursday 29 September 2005 04:20 am, Andy Pieters wrote:
> > > Hi
> > >
> > > > <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 />
> > >
> > > That's just what it says, check your program flow.
> > >
> > > You overrided the tostring function and somewhere in that new function
>
> you
>
> > > jump out of it because of a flag that is set, and thus not returning
> > > anything, which is equal to return null.
> >
> > I'd love to say that is possible however it's not.
> > function __toString() {
> > # Transform...
> > if (!$this->outXML) {
> > $XSlt = new xsltprocessor();
> > $XSlt->registerPHPFunctions();
> > $XSlt->importStyleSheet(DomDocument::load($this->style));
> > return $XSlt->transformToXML($this->Dom);
> > } else {
> > return $this->Dom->saveXML();
> > }
> > }
> > As you can see there is nothing that could make it jump out. very
> > straight forward and all cases handled via else.
> > The line: return $this->Dom->saveXML(); is somehow returning null.
> >
> > Thank you for the advice on how to enable notices.
> > being I always include my Document script I just added
> > error_reporting(E_ALL); to the top.
> >
> > Sadly I'm getting no Notices about my problem. Am getting 1 notice but
>
> nothing
>
> > of any interest

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux