php-dom

PHP DOM UTF-8 problem

First of all, my database uses Windows-1250 as native charset. I am outputting the data as UTF-8. I'm using iconv() function all over my website to convert Windows-1250 strings to UTF-8 strings and it works perfect. The problem is when I'm using PHP DOM to parse some HTML stored in the database (the HTML is an output from a WYSIWYG edi...

How can I find out the namespace of an element in PHP DOM?

This sounds like a pretty easy question to answer but I haven't been able to get it to work. I'm running PHP 5.2.6. I have a DOM element (the root element) which, when I go to $element->saveXML(), it outputs an xmlns attribute: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"...

PHP problem with DOM parsing

Hi all. The code pasted below, works on my PC, but not on my hosting (which have PHP 5.2.13 installed). $source = file_get_contents('http://example.com/example', 0); $dom = new DOMDocument; @$dom->loadHTML($source); $dom->preserveWhiteSpace = false; $xpath = new DOMXPath($dom); $tags = $xpath->query('//div[@class="item"]'); $xml = '<...