Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6879

Re: DOMDocument::saveHTML() Method Not Accepting Single Argument

From Adam Harvey <usenet@adamharvey.name>
Newsgroups comp.lang.php
Subject Re: DOMDocument::saveHTML() Method Not Accepting Single Argument
Date 2012-08-27 05:09 +0000
Organization A noiseless patient Spider
Message-ID <k1evdn$7li$1@dont-email.me> (permalink)
References <XnsA0BC4B91261FBSMH1960@88.198.244.100>

Show all headers | View raw


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. :)

Adam

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

DOMDocument::saveHTML() Method Not Accepting Single Argument SMH <garyconditswellhungrelative@yahooDOT.com> - 2012-08-27 04:25 +0000
  Re: DOMDocument::saveHTML() Method Not Accepting Single Argument Adam Harvey <usenet@adamharvey.name> - 2012-08-27 05:09 +0000
    Re: DOMDocument::saveHTML() Method Not Accepting Single Argument SMH <garyconditswellhungrelative@yahooDOT.com> - 2012-08-27 06:07 +0000

csiph-web