getElementsByAttribute

The getElementsByAttribute allows you to retrieve a single DOMIT_Element or a DOMIT_NodeList of DOMIT_Elements that contain an attribute that matches the specified name and value. This is a useful substitute for getElementByID (which can only be used with namespace awareness turned on).

To get a node list of all elements containing an attribute named 'myAttr' and a value of '3', for example, you would do this:

$myNodeList =& $xmldoc->getElementsByAttribute('myAttr', '3'); 

Note that there is a third boolean parameter for getElementsByAttribute, which if set to true will return the first matching element rather than an entire node list of elements.


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.