Reply to Re: DOMElement doesn't seem to extend DOMNode...?

Your name:

Reply:


Posted by taps128 on 11/13/07 06:16

Sean Quinn wrote:
> I realize what the documentation says, but when creating both a new
> DOMElement object, or extending the DOMElement object I don't have
> access to any DOMNode methods in PHP 5.2.0.
> e.g.
>
> class HtmlElement extends DOMElement
> {
> ...
> }
>
> $htmlElement = new HtmlElement();
> $htmlElement->appendChild(...);
>
> Will not work because the method is supposedly undefined. In
> addition:
>
> $domEl = new DOMElement();
> $domEl->appendChild(...);
>
> ... doesn't seem to work either. I've looked through several sources
> online and offline which all seem to indicate that calls to DOMNode
> methods should be working, but they aren't for me. Am I going crazy?
> Am I doing something wrong? Anyone please help! Thanks!
>
You can't append an child to an initialized DOMElement until it's
appended to the DOMDocument.
$dom=new DOMDocument();
$ele=new DOMElement('p');
$dom->appendChild($ele);
$ele2=new DOMELement('br');
$ele->appendChild($ele2);

[Back to original 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

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