Re: DOMDocument getElementsByAttribute ??
| From: | Michael A. Peters | Date: | Tue, 10 Mar 2009 00:12:55 +0000 |
| Subject: | Re: DOMDocument getElementsByAttribute ?? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289728@lists.php.net to get a copy of this message | ||
Nathan Rixham wrote:
Michael A. Peters wrote:I figured it out - $document->getElementsByTagName("*"); seems to work just fine. I do need to find out more about XPath - unfortunately reading the examples that are out in the wild is troublesome because it seems 95% of them involve the deprecated dom model from pre php 5, so to make sense of them I would have to port the examples to php5 DOMDocument first.Seems like such a function does not exist in php. I can write my own function that does it using DOMElement->hasAttribute() - but I'm not sure how to get an array of every element in the DOM to test them for the attribute. Any hints? I'm sure it's simple, I'm just not seeing the function that does it.DOMXPath :)