Re: DOM Question. No pun intended.

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

 



mwilliams@xxxxxxxxxxxxxxxxxxxxxxx wrote:
Rob,

I wasn't aware that that would work. I mean I suppose it should, but basically
this is what I'm doing:

1) Create a new DOMDocument
2) DOMDocument->loadHTML()
3) find the elements I want with getElementsByTag() then finding the one with
the correct attributes

. . .at this point, I need the equivalent of DOMDocument->saveHTML() so that it outputs the *exact* html content. Are you saying that saveXML() will do what I
want it to do; tags and all?

It is the best option, though in reality there may not be a way to do this exactly as you want due to HTML not having to be valid XML. By exact, unless the input is valid XHTML, loadHTML is going to cause the HTML to be fiexed to be proper XML, so using $doc->saveXML($node) you will get the serialized of the element as it was created when loading the HTML (this includes any "fixes" the parser may have made.

Rob

--
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