FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » DOMDocument::saveHTML() Method Not Accepting Single Argument
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: DOMDocument::saveHTML() Method Not Accepting Single Argument [message #178951 is a reply to message #178950] Mon, 27 August 2012 06:07 Go to previous message
SMH is currently offline  SMH
Messages: 3
Registered: July 2012
Karma:
Junior Member
Adam Harvey <usenet(at)adamharvey(dot)name> wrote on Mon 27 Aug 2012 08:09:11a

> On Mon, 27 Aug 2012 04:25:49 +0000, SMH wrote:
>> Using PHP 5.2
>>
>> I keep getting the warning:
>>
>> Warning: DOMDocument::saveHTML() expects exactly 0 parameters,
>> 1 given in <php script document>
>>
>>
>>
>> Is this a bug?
>
> The manual page you linked to has a changelog, which indicates that the
> parameter was added in PHP 5.3.6.
>
>> However, some filenames contained characters, like '&', and I had to use
>> method DOMDocument:createEntityReference() to append them as child nodes
>> to the element.
>
> Why? If you're adding the text as text nodes, there's no need to
> explicitly create entity references: $doc->createTextNode('foo&bar');
> results in a valid text node which will be saved as "foo&amp;bar" when
> save() or saveXML() are called.
>
>> But when I try to retrieve with 'textContent' property, only child nodes
>> of type DOMText are returned concatenated, not entity references.
>
> Entity references aren't text content, at least as far as libxml and PHP
> are concerned.
>
>> I figured saveHTML([DOMElement]) might fix this.
>
> It may, but not until you use a version of PHP that supports it. :)

Thanks, Adam.

I think I resorted to using it because of some error or other warning I got
with special HTML characters, and it probably applied to THAT situation, but
clearly not to THIS situation; over-thinking, I guess.

Your explanations resulted in warning-free code.

I'll remember to read the changelog too to make sure that the syntax applies
to the current version. I use 5.2 because I think that is the latest
version produced as a ready binary for Win 7 running Apache 2.2, but then
again, I could certainly even be wrong on that as well. :)

> Adam
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Does this indicate a bug in PHP?
Next Topic: How can i know the propery of a javascript object how can i see what object inclue
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 02:44:03 GMT 2024

Total time taken to generate the page: 0.04911 seconds